@@ -30,18 +30,16 @@ def run(self):
3030with open ('HISTORY.rst' ) as history_file :
3131 history = history_file .read ()
3232
33- # comment if preparing PyPI package
34- # version = '1.8'
33+ preparing_PyPI_package = False
34+ version_git = version = '1.8'
3535
36- # if os.path.exists('.git'):
37- # sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
38- # version_git = version + '+' + sha[:7]
39- # else:
40- # version_git = version
36+ if not preparing_PyPI_package :
37+ if os .path .exists ('.git' ):
38+ sha = subprocess .check_output (['git' , 'rev-parse' , 'HEAD' ]).decode ('ascii' ).strip ()
39+ version_git = version_git + '+' + sha [:7 ]
4140
42- # with open('tensorboardX/__init__.py', 'a') as f:
43- # f.write('\n__version__ = "{}"\n'.format(version_git))
44- # end of comment
41+ with open ('tensorboardX/__init__.py' , 'a' ) as f :
42+ f .write ('\n __version__ = "{}"\n ' .format (version_git ))
4543
4644requirements = [
4745 'numpy' ,
@@ -90,8 +88,8 @@ def run(self):
9088
9189
9290# checklist: update History.rst readme.md
93- # version=version_git <--- change to sha-less version (in setup.py)
94- # __version__ = "1.x" ( __init__.py)
91+ # change preparing_PyPI_package to True
92+ # remove __version__ = "1.old" in __init__.py
9593# commit
9694# add tag
9795# python setup.py sdist bdist_wheel --universal
0 commit comments