Skip to content

Commit ea1108f

Browse files
committed
change version parsing logic, old one does not work in Docker
1 parent 77dc8c7 commit ea1108f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: find_version.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@
2424

2525
# used in local dev releases
2626
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).splitlines()[0].decode()
27+
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
28+
tag = subprocess.check_output(['git', 'describe', '--tags']).splitlines()[0].decode().split('-')
2729

28-
if os.name == 'posix':
29-
version = os.getenv('TRAVIS_TAG', git_hash)
30-
else:
31-
version = os.getenv('APPVEYOR_REPO_TAG_NAME', git_hash)
32-
33-
if version != git_hash:
30+
if len(tag) == 1:
3431
# tag identifies the build and should be a sequential revision number
32+
version = tag[0]
3533
opencv_version += ".{}".format(version)
3634
else:
3735
# local version identifier, not to be published on PyPI
36+
version = git_hash
3837
opencv_version += "+{}".format(version)
3938

4039
print("Version: ", opencv_version)

0 commit comments

Comments
 (0)