Runtime hook for pyinstaller to load plugins and setup %PATH%.
This commit is contained in:
parent
11cf001d1a
commit
2ace579107
|
@ -10,7 +10,7 @@ site_root = os.path.abspath(HOMEPATH)
|
|||
spec_root = os.path.abspath(SPECPATH)
|
||||
arch = 32 if ctypes.sizeof(ctypes.c_voidp) == 4 else 64
|
||||
cdrivePath = site_root[0:3]
|
||||
srcPath = os.path.join(spec_root[:-20], "src")
|
||||
srcPath = os.path.join(spec_root[:-20], "pybitmessage")
|
||||
sslName = 'OpenSSL-Win%i' % arch
|
||||
openSSLPath = os.path.join(cdrivePath, sslName)
|
||||
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
|
||||
|
@ -22,9 +22,7 @@ os.chdir(srcPath)
|
|||
|
||||
snapshot = False
|
||||
|
||||
os.rename(
|
||||
os.path.join(srcPath, '__init__.py'),
|
||||
os.path.join(srcPath, '__init__.py.backup'))
|
||||
hookspath=os.path.join(spec_root, 'hooks')
|
||||
|
||||
a = Analysis(
|
||||
[os.path.join(srcPath, 'bitmessagemain.py')],
|
||||
|
@ -39,14 +37,10 @@ a = Analysis(
|
|||
'setuptools.msvc', '_cffi_backend',
|
||||
'plugins.menu_qrcode', 'plugins.proxyconfig_stem'
|
||||
],
|
||||
runtime_hooks=None,
|
||||
runtime_hooks=[os.path.join(hookspath, 'pyinstaller_rthook_plugins.py')],
|
||||
excludes=['bsddb', 'bz2', 'tcl', 'tk', 'Tkinter', 'tests']
|
||||
)
|
||||
|
||||
os.rename(
|
||||
os.path.join(srcPath, '__init__.py.backup'),
|
||||
os.path.join(srcPath, '__init__.py'))
|
||||
|
||||
|
||||
def addTranslations():
|
||||
extraDatas = []
|
||||
|
|
17
packages/pyinstaller/hooks/pyinstaller_rthook_plugins.py
Normal file
17
packages/pyinstaller/hooks/pyinstaller_rthook_plugins.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
"""Runtime PyInstaller hook to load plugins"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
homepath = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||
|
||||
os.environ['PATH'] += ';' + ';'.join([
|
||||
homepath, os.path.join(homepath, 'Tor'),
|
||||
os.path.abspath(os.curdir)
|
||||
])
|
||||
|
||||
try:
|
||||
import pybitmessage.plugins.menu_qrcode
|
||||
import pybitmessage.plugins.proxyconfig_stem # noqa:F401
|
||||
except ImportError:
|
||||
pass
|
Reference in New Issue
Block a user