giving up on using git revision in version number :( latest issue is when installing a package that calls git to compute a version number, but cwd is some other git project, you get the wrong thing

This commit is contained in:
Noah Levitt 2015-09-24 00:17:33 +00:00
parent 9699a40645
commit 8c69ca3b39
5 changed files with 5 additions and 29 deletions

View File

@ -22,7 +22,7 @@ arg_parser.add_argument('--enable-warcprox-features', dest='enable_warcprox_feat
arg_parser.add_argument("-v", "--verbose", dest="log_level",
action="store_const", default=logging.INFO, const=logging.DEBUG)
arg_parser.add_argument("--version", action="version",
version="brozzler {} - {}".format(brozzler.version, os.path.basename(__file__)))
version="brozzler {} - {}".format(brozzler.__version__, os.path.basename(__file__)))
args = arg_parser.parse_args(args=sys.argv[1:])
logging.basicConfig(stream=sys.stdout, level=args.log_level,

View File

@ -20,7 +20,7 @@ arg_parser.add_argument('--rethinkdb-db', dest='rethinkdb_db', default="brozzler
arg_parser.add_argument("-v", "--verbose", dest="log_level",
action="store_const", default=logging.INFO, const=logging.DEBUG)
arg_parser.add_argument("--version", action="version",
version="brozzler {} - {}".format(brozzler.version, os.path.basename(__file__)))
version="brozzler {} - {}".format(brozzler.__version__, os.path.basename(__file__)))
args = arg_parser.parse_args(args=sys.argv[1:])
logging.basicConfig(stream=sys.stdout, level=args.log_level,

View File

@ -28,7 +28,7 @@ arg_parser.add_argument('--enable-warcprox-features', dest='enable_warcprox_feat
arg_parser.add_argument("-v", "--verbose", dest="log_level",
action="store_const", default=logging.INFO, const=logging.DEBUG)
arg_parser.add_argument("--version", action="version",
version="brozzler {} - {}".format(brozzler.version, os.path.basename(__file__)))
version="brozzler {} - {}".format(brozzler.__version__, os.path.basename(__file__)))
args = arg_parser.parse_args(args=sys.argv[1:])
logging.basicConfig(stream=sys.stdout, level=args.log_level,

View File

@ -1,15 +1,6 @@
import json as _json
import logging as _logging
def _read_version():
import os
version_txt = os.path.sep.join(__file__.split(os.path.sep)[:-1] + ['version.txt'])
with open(version_txt, 'rb') as fin:
version_bytes = fin.read()
return version_bytes.strip().decode('utf-8')
version = _read_version()
class ShutdownRequested(Exception):
pass

View File

@ -1,23 +1,8 @@
import setuptools
import glob
VERSION_BYTES = b'1.0'
def full_version_bytes():
import subprocess, time
try:
commit_num_bytes = subprocess.check_output(['git', 'rev-list', '--count', 'HEAD'])
return VERSION_BYTES + b'.' + commit_num_bytes.strip()
except subprocess.CalledProcessError:
return VERSION_BYTES
version_bytes = full_version_bytes()
with open('brozzler/version.txt', 'wb') as out:
out.write(version_bytes)
out.write(b'\n');
setuptools.setup(name='brozzler',
version=version_bytes.decode('utf-8'),
version='1.0.1',
description='Distributed web crawling with browsers',
url='https://github.com/nlevitt/brozzler',
author='Noah Levitt',
@ -25,7 +10,7 @@ setuptools.setup(name='brozzler',
long_description=open('README.rst').read(),
license='Apache License 2.0',
packages=['brozzler'],
package_data={'brozzler': ['behaviors.d/*.js*', 'behaviors.yaml', 'version.txt']},
package_data={'brozzler': ['behaviors.d/*.js*', 'behaviors.yaml']},
scripts=glob.glob('bin/*'),
install_requires=[
'PyYAML',