tAdd dynamic package loading for Py2App osx binaries - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 2bf32880e85cb092e55f4c42be2aea872e4d2b0e DIR parent 3ef3bebeb37d5d89821209334eec62c7bb3063af HTML Author: Maran <maran.hidskes@gmail.com> Date: Tue, 27 Jan 2015 12:18:04 +0100 Add dynamic package loading for Py2App osx binaries Diffstat: M electrum | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- DIR diff --git a/electrum b/electrum t@@ -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