Skip to content

Commit

Permalink
fix #432 (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanpa committed May 25, 2019
1 parent 6a6a62e commit e0f47c1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

import subprocess

import os
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
Expand Down Expand Up @@ -32,8 +32,12 @@ def run(self):

# comment if preparing PyPI package
version = '1.7'
sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
version_git = version + '+' + sha[:7]

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

with open('tensorboardX/__init__.py', 'a') as f:
f.write('\n__version__ = "{}"\n'.format(version_git))
Expand Down

0 comments on commit e0f47c1

Please sign in to comment.