mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
windows: dll-load 'hack' needs to be applied not only from main script
but also when running tests, or just importing electrum from an interpreter
This commit is contained in:
parent
23a93ef7ad
commit
e42e17779d
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,16 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
# these are ~duplicated from run_electrum:
|
||||||
|
is_bundle = getattr(sys, 'frozen', False)
|
||||||
|
is_local = not is_bundle and os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "electrum.desktop"))
|
||||||
|
|
||||||
|
# when running from source, on Windows, also search for DLLs in inner 'electrum' folder
|
||||||
|
if is_local and os.name == 'nt':
|
||||||
|
if hasattr(os, 'add_dll_directory'): # requires python 3.8+
|
||||||
|
os.add_dll_directory(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
from .version import ELECTRUM_VERSION
|
from .version import ELECTRUM_VERSION
|
||||||
from .util import format_satoshis
|
from .util import format_satoshis
|
||||||
from .wallet import Wallet
|
from .wallet import Wallet
|
||||||
|
|
|
@ -51,12 +51,6 @@ os.environ['KIVY_DATA_DIR'] = os.path.abspath(os.path.dirname(__file__)) + '/ele
|
||||||
if is_local or is_android:
|
if is_local or is_android:
|
||||||
sys.path.insert(0, os.path.join(script_dir, 'packages'))
|
sys.path.insert(0, os.path.join(script_dir, 'packages'))
|
||||||
|
|
||||||
# when running from source, on Windows, also search for DLLs in inner 'electrum' folder
|
|
||||||
if is_local and os.name == 'nt':
|
|
||||||
dll_dir = os.path.join(os.path.dirname(__file__), 'electrum')
|
|
||||||
if hasattr(os, 'add_dll_directory'): # requires python 3.8+
|
|
||||||
os.add_dll_directory(dll_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def check_imports():
|
def check_imports():
|
||||||
# pure-python dependencies need to be imported here for pyinstaller
|
# pure-python dependencies need to be imported here for pyinstaller
|
||||||
|
|
Loading…
Add table
Reference in a new issue