commit 2bf32880e85cb092e55f4c42be2aea872e4d2b0e
parent 3ef3bebeb37d5d89821209334eec62c7bb3063af
Author: Maran <maran.hidskes@gmail.com>
Date: Tue, 27 Jan 2015 12:18:04 +0100
Add dynamic package loading for Py2App osx binaries
Diffstat:
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/electrum b/electrum
@@ -26,14 +26,23 @@ import sys
import time
import traceback
+is_local = False
+is_android = False
+
+if sys.platform == 'darwin':
+ is_bundle = getattr(sys, 'frozen') == "macosx_app"
+ if is_bundle:
+ sys.path.insert(0, os.getcwd() + "/lib/python2.7/packages")
+else:
+ is_bundle = getattr(sys, 'frozen', False)
+ is_local = not is_bundle and os.path.dirname(os.path.realpath(__file__)) == os.getcwd()
+ is_android = 'ANDROID_DATA' in os.environ
+ if is_local:
+ sys.path.append('packages')
-is_bundle = getattr(sys, 'frozen', False)
is_local = not is_bundle and os.path.dirname(os.path.realpath(__file__)) == os.getcwd()
is_android = 'ANDROID_DATA' in os.environ
-if is_local:
- sys.path.insert(0,'packages')
-
import __builtin__
__builtin__.use_local_modules = is_local or is_android