summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2017-08-07 14:16:57 -0700
committerKali Kaneko <kali@leap.se>2017-08-14 18:10:14 -0400
commit0862810bca720d0d8fe4300569e2cce5ff6d37d4 (patch)
tree7cecb101cc204d1b7ec1f56692fd31949b8785e1
parent523ec97cafcaff3090edbe18a1edcb4e615370a0 (diff)
[bug] report version correctly in bundles
- Resolves: #8992
-rw-r--r--pkg/bundles/build.mk2
-rw-r--r--src/leap/bitmask/__init__.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/pkg/bundles/build.mk b/pkg/bundles/build.mk
index 158293b1..0db7f3a1 100644
--- a/pkg/bundles/build.mk
+++ b/pkg/bundles/build.mk
@@ -20,6 +20,7 @@ bundle: bundle_clean
cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/common/cacert.pem $(DIST)/
cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/bitmask_js $(DIST)/leap/
cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/pixelated_www $(DIST)/leap/
+ echo `git describe` > $(DIST)/version
mv $(DIST) _bundlelib && mkdir $(DIST_VERSION) && mv _bundlelib $(DIST_VERSION)/lib/
cd pkg/launcher && make
cp pkg/launcher/bitmask $(DIST_VERSION)
@@ -55,6 +56,7 @@ bundle_osx_helpers:
bundle_osx_missing:
cp $(DIST_VERSION)/lib/_scrypt.so $(OSX_CON)/
cp $(DIST_VERSION)/lib/bitmaskd.tac $(OSX_CON)/
+ cp $(DIST_VERSION)/lib/version $(OSX_CON)/
cp -r $(DIST_VERSION)/lib/leap $(OSX_CON)/
mv dist/Bitmask.app/Contents/MacOS/bitmask $(OSX_CON)/bitmask-app
cp pkg/osx/bitmask-wrapper $(OSX_CON)/bitmask
diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py
index 6fd6174d..48490a05 100644
--- a/src/leap/bitmask/__init__.py
+++ b/src/leap/bitmask/__init__.py
@@ -1,5 +1,7 @@
+import os
import sys
import pkg_resources
+from .util import here
from ._version import get_versions
if not getattr(sys, 'frozen', False):
@@ -10,5 +12,12 @@ if not getattr(sys, 'frozen', False):
# 'pip install -e .' and 'pip install leap.common'
pkg_resources.get_distribution('leap.bitmask')
-__version__ = get_versions()['version']
-del get_versions
+ __version__ = get_versions()['version']
+ del get_versions
+
+else:
+ try:
+ __version__ = open(os.path.join(
+ here(), 'version')).read().strip()
+ except Exception:
+ __version__ = '0+0xacab-unknown'