Skip to content

Commit 57587e5

Browse files
committed
Fix python3 compability for release check. Make sure we can run release check on shallow clone
1 parent c807667 commit 57587e5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ def finalize_options(self):
4949
pass
5050

5151
def run(self):
52-
from subprocess import check_output
53-
tag = check_output(['git', 'describe', 'HEAD']).strip()
52+
from subprocess import check_output, CalledProcessError
53+
try:
54+
tag = check_output(['git', 'describe', 'HEAD']).strip().decode('utf8')
55+
except CalledProcessError:
56+
tag = ''
5457
version = read_version()
5558
if tag != version:
5659
print('Missing %s tag on release' % version)
5760
raise SystemExit(1)
5861

59-
current_branch = check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
62+
current_branch = check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip().decode('utf8')
6063
if current_branch != 'master':
6164
print('Only release from master')
6265
raise SystemExit(1)

0 commit comments

Comments
 (0)