[ADD] pyinstaller feature based on #12

This commit is contained in:
Benedek Racz 2020-02-21 15:45:33 +01:00
parent 62986d022c
commit e7f58cc2fc
2 changed files with 40 additions and 4 deletions

37
wexpect.spec Normal file
View File

@ -0,0 +1,37 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['wexpect\\__main__.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='wexpect',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='wexpect')

View File

@ -390,14 +390,13 @@ class SpawnBase:
https://github.com/pyinstaller/pyinstaller/issues/822
'''
if getattr(sys, '_MEIPASS', False):
if not hasattr(sys, '_MEIPASS'):
raise Exception(
'`sys.frozen` found, but `sys._MEIPASS` not. Only pyinstaller is'
' supported.'
'`sys.frozen` found, but `sys._MEIPASS` not. Only pyinstaller is supported.'
)
dirname = os.path.dirname(sys.executable)
console_executable = os.path.join(dirname, '__main__.exe')
console_executable = os.path.join(dirname, '..', 'wexpect', 'wexpect.exe')
commandLine = f'"{console_executable}" {console_args}'
else: