Skip to content

Commit 1cb26d1

Browse files
committed
Fix release check for multiple versions of git
1 parent 265df60 commit 1cb26d1

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
@@ -50,14 +50,17 @@ def finalize_options(self):
5050
pass
5151

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

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

0 commit comments

Comments
 (0)