summaryrefslogtreecommitdiff
path: root/.ci/package-version.py
diff options
context:
space:
mode:
authorElvis Pranskevichus <elvis@magic.io>2018-03-30 19:47:52 -0400
committerElvis Pranskevichus <elvis@magic.io>2018-03-30 20:50:17 -0400
commita1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f (patch)
tree283ca8f24adc74d1092cf24b7bd66174a0014b51 /.ci/package-version.py
parent0e715340a78863d973302981ab98b232d6f51735 (diff)
downloadimmutables-a1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f.tar.gz
immutables-a1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f.zip
CI integration
Diffstat (limited to '.ci/package-version.py')
-rwxr-xr-x.ci/package-version.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/.ci/package-version.py b/.ci/package-version.py
new file mode 100755
index 0000000..bbf2ff4
--- /dev/null
+++ b/.ci/package-version.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+
+import os.path
+import sys
+
+
+def main():
+ version_file = os.path.join(
+ os.path.dirname(os.path.dirname(__file__)),
+ 'immutables', '__init__.py')
+
+ with open(version_file, 'r') as f:
+ for line in f:
+ if line.startswith('__version__ ='):
+ _, _, version = line.partition('=')
+ print(version.strip(" \n'\""))
+ return 0
+
+ print('could not find package version in immutables/__init__.py',
+ file=sys.stderr)
+ return 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())