Skip to content

Commit a31a5a7

Browse files
committed
BUG: handle git-describe failing to find a tag
This can happen with shallow clones, e.g., on Travis-CI.
1 parent 55878a3 commit a31a5a7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎make_version.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ def main():
77
if len(output) == 3:
88
version, build, commit = output
99
else:
10-
raise Exception("Could not git describe, (got %s)" % output)
10+
# If the clone is shallow, describe output won't have tag and
11+
# number of commits. This is a particular issue on Travis-CI,
12+
# which by default clones with a depth of 50.
13+
# This behaviour isn't well documented in git-describe docs,
14+
# but see, e.g., https://stackoverflow.com/a/36389573/1008142
15+
# and https://github.com/travis-ci/travis-ci/issues/3412
16+
version = 'unknown'
17+
build = 'unknown'
18+
commit = output
1119

1220
print("Version: %s" % version)
1321
print("Build: %s" % build)

0 commit comments

Comments
 (0)