mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-05-02 06:36:20 -04:00
fancy --version that includes git branch and timestamp of last commit if available
This commit is contained in:
parent
0bcc583b40
commit
3127e02cbb
7 changed files with 50 additions and 10 deletions
25
setup.py
25
setup.py
|
@ -3,8 +3,27 @@
|
|||
import setuptools
|
||||
import glob
|
||||
|
||||
VERSION_BYTES = b'0.2'
|
||||
|
||||
def full_version_bytes():
|
||||
import subprocess, time
|
||||
try:
|
||||
git_branch = subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD'])
|
||||
t_bytes = subprocess.check_output(['git', 'log', '-1', '--pretty=format:%ct'])
|
||||
t = int(t_bytes.strip().decode('utf-8'))
|
||||
tm = time.gmtime(t)
|
||||
timestamp_utc = time.strftime("%Y%m%d%H%M%S", time.gmtime(t))
|
||||
return VERSION_BYTES + b'-' + git_branch.strip() + b'-' + timestamp_utc.encode('utf-8')
|
||||
except subprocess.CalledProcessError:
|
||||
return VERSION_BYTES
|
||||
|
||||
version_bytes = full_version_bytes()
|
||||
with open('umbra/version.txt', 'wb') as out:
|
||||
out.write(version_bytes)
|
||||
out.write(b'\n');
|
||||
|
||||
setuptools.setup(name='umbra',
|
||||
version='0.1',
|
||||
version=version_bytes.decode('utf-8'),
|
||||
description='Browser automation via chrome debug protocol',
|
||||
url='https://github.com/internetarchive/umbra',
|
||||
author='Eldon Stegall',
|
||||
|
@ -12,9 +31,9 @@ setuptools.setup(name='umbra',
|
|||
long_description=open('README.md').read(),
|
||||
license='Apache License 2.0',
|
||||
packages=['umbra'],
|
||||
package_data={'umbra':['behaviors.d/*.js']},
|
||||
package_data={'umbra':['behaviors.d/*.js', 'version.txt']},
|
||||
install_requires=['kombu', 'websocket-client-py3==0.13.1','argparse'],
|
||||
scripts=glob.glob("bin/*"),
|
||||
scripts=glob.glob('bin/*'),
|
||||
zip_safe=False,
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha Development Status',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue