diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index d25466e08..013bdf6df 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -179,8 +179,8 @@ RUN cd /opt \ && git remote add sombernight https://github.com/SomberNight/python-for-android \ && git remote add accumulator https://github.com/accumulator/python-for-android \ && git fetch --all \ - # commit: from branch accumulator/electrum_20210421d (note: careful with force-pushing! see #8162) - && git checkout "3c2750795ba93aa1a3e513a13c2ea2ac5bddba17^{commit}" \ + # commit: from branch sombernight/electrum_20210421d (note: careful with force-pushing! see #8162) + && git checkout "ec82acf894822373ae88247658a233c77e76f879^{commit}" \ && python3 -m pip install --no-build-isolation --no-dependencies --user -e . # build env vars diff --git a/run_electrum b/run_electrum index c587d7bed..7c363d539 100755 --- a/run_electrum +++ b/run_electrum @@ -44,8 +44,9 @@ script_dir = os.path.dirname(os.path.realpath(__file__)) is_pyinstaller = getattr(sys, 'frozen', False) is_android = 'ANDROID_DATA' in os.environ is_appimage = 'APPIMAGE' in os.environ +is_binary_distributable = is_pyinstaller or is_android or is_appimage # is_local: unpacked tar.gz but not pip installed, or git clone -is_local = (not is_pyinstaller and not is_android and not is_appimage +is_local = (not is_binary_distributable and os.path.exists(os.path.join(script_dir, "electrum.desktop"))) is_git_clone = is_local and os.path.exists(os.path.join(script_dir, ".git")) @@ -62,6 +63,19 @@ if is_pyinstaller: # causes ImportErrors and other runtime failures). (see #4072) _file = open(sys.executable, 'rb') +if is_binary_distributable: + # Ensure that asserts are enabled. + # Code *should not rely* on asserts being enabled. In particular, safety and security checks should + # always explicitly raise exceptions. However, this rule is mistakenly broken occasionally... + # In case we are a binary build, we know for a fact that we want the asserts, so enforce them. + # When running from source, defer to the user. (a warning is logged in __init__.py) + try: + assert False + except AssertionError: + pass + else: + sys.exit("Error: Running with asserts disabled, in a binary distributable! Please check build settings.") + def check_imports(): # pure-python dependencies need to be imported here for pyinstaller