From e7f58cc2fc6cdb0418ca6e3403ee347f6de82657 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Fri, 21 Feb 2020 15:45:33 +0100 Subject: [PATCH] [ADD] pyinstaller feature based on #12 --- wexpect.spec | 37 +++++++++++++++++++++++++++++++++++++ wexpect/host.py | 7 +++---- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 wexpect.spec diff --git a/wexpect.spec b/wexpect.spec new file mode 100644 index 0000000..6aef23e --- /dev/null +++ b/wexpect.spec @@ -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') diff --git a/wexpect/host.py b/wexpect/host.py index 3e9d365..ce45856 100644 --- a/wexpect/host.py +++ b/wexpect/host.py @@ -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: