diff --git a/setup.py b/setup.py index 41c95787..8a33cd91 100644 --- a/setup.py +++ b/setup.py @@ -30,18 +30,16 @@ def run(self): with open('HISTORY.rst') as history_file: history = history_file.read() -# comment if preparing PyPI package -# version = '1.8' +preparing_PyPI_package = False +version_git = version = '1.8' -# if os.path.exists('.git'): -# sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip() -# version_git = version + '+' + sha[:7] -# else: -# version_git = version +if not preparing_PyPI_package: + if os.path.exists('.git'): + sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip() + version_git = version_git + '+' + sha[:7] -# with open('tensorboardX/__init__.py', 'a') as f: -# f.write('\n__version__ = "{}"\n'.format(version_git)) -# end of comment + with open('tensorboardX/__init__.py', 'a') as f: + f.write('\n__version__ = "{}"\n'.format(version_git)) requirements = [ 'numpy', @@ -90,8 +88,8 @@ def run(self): # checklist: update History.rst readme.md -# version=version_git <--- change to sha-less version (in setup.py) -# __version__ = "1.x" (__init__.py) +# change preparing_PyPI_package to True +# remove __version__ = "1.old" in __init__.py # commit # add tag # python setup.py sdist bdist_wheel --universal