Browse Source

electrum: check_imports

283
ThomasV 9 years ago
parent
commit
6a833d9f98
  1. 14
      electrum

14
electrum

@ -31,7 +31,8 @@ if is_local or is_android:
elif is_bundle and sys.platform=='darwin': elif is_bundle and sys.platform=='darwin':
sys.path.insert(0, os.getcwd() + "/lib/python2.7/packages") sys.path.insert(0, os.getcwd() + "/lib/python2.7/packages")
if not is_android:
def check_imports():
# pure-python dependencies need to be imported here for pyinstaller # pure-python dependencies need to be imported here for pyinstaller
try: try:
import dns import dns
@ -44,20 +45,22 @@ if not is_android:
import google.protobuf import google.protobuf
except ImportError as e: except ImportError as e:
sys.exit("Error: %s. Try 'sudo pip install <module-name>'"%e.message) sys.exit("Error: %s. Try 'sudo pip install <module-name>'"%e.message)
# the following imports are for pyinstaller # the following imports are for pyinstaller
from google.protobuf import descriptor from google.protobuf import descriptor
from google.protobuf import message from google.protobuf import message
from google.protobuf import reflection from google.protobuf import reflection
from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pb2
# check that we have the correct version of ecdsa # check that we have the correct version of ecdsa
try: try:
from ecdsa.ecdsa import curve_secp256k1, generator_secp256k1 from ecdsa.ecdsa import curve_secp256k1, generator_secp256k1
except Exception: except Exception:
sys.exit("cannot import ecdsa.curve_secp256k1. You probably need to upgrade ecdsa.\nTry: sudo pip install --upgrade ecdsa") sys.exit("cannot import ecdsa.curve_secp256k1. You probably need to upgrade ecdsa.\nTry: sudo pip install --upgrade ecdsa")
# make sure that certificates are here
assert os.path.exists(requests.utils.DEFAULT_CA_BUNDLE_PATH)
if not is_android:
check_imports()
# load local module as electrum # load local module as electrum
if is_bundle or is_local or is_android: if is_bundle or is_local or is_android:
@ -251,9 +254,6 @@ def run_offline_command(config, config_options):
if __name__ == '__main__': if __name__ == '__main__':
# make sure that certificates are here
assert os.path.exists(requests.utils.DEFAULT_CA_BUNDLE_PATH)
# on osx, delete Process Serial Number arg generated for apps launched in Finder # on osx, delete Process Serial Number arg generated for apps launched in Finder
sys.argv = filter(lambda x: not x.startswith('-psn'), sys.argv) sys.argv = filter(lambda x: not x.startswith('-psn'), sys.argv)

Loading…
Cancel
Save