fix pyinstaller (#1788)

This commit is contained in:
Maximilian Hils 2016-11-25 16:46:49 +01:00 committed by GitHub
parent de9e724a66
commit e3dc46a8cd
9 changed files with 27 additions and 122 deletions

View File

@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('mitmproxy.addons.onboardingapp')

View File

@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('pydivert.windivert_dll')

View File

@ -40,6 +40,8 @@ BUILD_DIR = join(RELEASE_DIR, "build")
DIST_DIR = join(RELEASE_DIR, "dist") DIST_DIR = join(RELEASE_DIR, "dist")
PYINSTALLER_SPEC = join(RELEASE_DIR, "specs") PYINSTALLER_SPEC = join(RELEASE_DIR, "specs")
# PyInstaller 3.2 does not bundle pydivert's Windivert binaries
PYINSTALLER_HOOKS = join(RELEASE_DIR, "hooks")
PYINSTALLER_TEMP = join(BUILD_DIR, "pyinstaller") PYINSTALLER_TEMP = join(BUILD_DIR, "pyinstaller")
PYINSTALLER_DIST = join(BUILD_DIR, "binaries") PYINSTALLER_DIST = join(BUILD_DIR, "binaries")
@ -166,7 +168,7 @@ def make_wheel():
print("Creating wheel...") print("Creating wheel...")
subprocess.check_call( subprocess.check_call(
[ [
"python", "./setup.py", "-q", "python3", "./setup.py", "-q",
"bdist_wheel", "--dist-dir", DIST_DIR, "--universal" "bdist_wheel", "--dist-dir", DIST_DIR, "--universal"
], ],
cwd=ROOT_DIR cwd=ROOT_DIR
@ -175,7 +177,7 @@ def make_wheel():
print("Creating virtualenv for test install...") print("Creating virtualenv for test install...")
if exists(VENV_DIR): if exists(VENV_DIR):
shutil.rmtree(VENV_DIR) shutil.rmtree(VENV_DIR)
subprocess.check_call(["virtualenv", "-q", VENV_DIR]) subprocess.check_call(["python3", "-m", "virtualenv", "-q", VENV_DIR])
with chdir(DIST_DIR): with chdir(DIST_DIR):
print("Install wheel into virtualenv...") print("Install wheel into virtualenv...")
@ -198,7 +200,11 @@ def make_wheel():
@cli.command("bdist") @cli.command("bdist")
@click.option("--use-existing-wheel/--no-use-existing-wheel", default=False) @click.option("--use-existing-wheel/--no-use-existing-wheel", default=False)
@click.argument("pyinstaller_version", envvar="PYINSTALLER_VERSION", default="PyInstaller~=3.1.1") @click.argument(
"pyinstaller_version",
envvar="PYINSTALLER_VERSION",
default="git+https://github.com/pyinstaller/pyinstaller.git@483c819d6a256b58db6740696a901bd41c313f0c"
)
@click.argument("setuptools_version", envvar="SETUPTOOLS_VERSION", default="setuptools>=25.1.0,!=25.1.1") @click.argument("setuptools_version", envvar="SETUPTOOLS_VERSION", default="setuptools>=25.1.0,!=25.1.1")
@click.pass_context @click.pass_context
def make_bdist(ctx, use_existing_wheel, pyinstaller_version, setuptools_version): def make_bdist(ctx, use_existing_wheel, pyinstaller_version, setuptools_version):
@ -230,12 +236,20 @@ def make_bdist(ctx, use_existing_wheel, pyinstaller_version, setuptools_version)
"--clean", "--clean",
"--workpath", PYINSTALLER_TEMP, "--workpath", PYINSTALLER_TEMP,
"--distpath", PYINSTALLER_DIST, "--distpath", PYINSTALLER_DIST,
"--additional-hooks-dir", PYINSTALLER_HOOKS,
# PyInstaller 3.2 does not handle Python 3.5's ucrt correctly.
"-p", r"C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86",
"--onefile",
"--console",
"--icon", "icon.ico",
# This is PyInstaller, so setting a # This is PyInstaller, so setting a
# different log level obviously breaks it :-) # different log level obviously breaks it :-)
# "--log-level", "WARN", # "--log-level", "WARN",
"%s.spec" % tool tool
] ]
) )
# Delete the spec file - we're good without.
os.remove("{}.spec".format(tool))
# Test if it works at all O:-) # Test if it works at all O:-)
executable = join(PYINSTALLER_DIST, tool) executable = join(PYINSTALLER_DIST, tool)

View File

@ -6,10 +6,10 @@ setup(
py_modules=["rtool"], py_modules=["rtool"],
install_requires=[ install_requires=[
"click>=6.2, <7.0", "click>=6.2, <7.0",
"twine>=1.6.5, <1.8", "twine>=1.6.5, <1.9",
"virtualenv>=14.0.5, <15.1", "virtualenv>=14.0.5, <15.2",
"wheel>=0.29.0, <0.30", "wheel>=0.29.0, <0.30",
"pysftp>=0.2.8, !=0.2.9, <0.3", "pysftp==0.2.8",
], ],
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [

View File

@ -1,23 +0,0 @@
# -*- mode: python -*-
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(['mitmdump'],
binaries=None,
datas=collect_data_files("mitmproxy.addons.onboardingapp"),
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='mitmdump',
debug=False,
strip=None,
upx=True,
console=True,
icon='icon.ico' )

View File

@ -1,23 +0,0 @@
# -*- mode: python -*-
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(['mitmproxy'],
binaries=None,
datas=collect_data_files("mitmproxy.addons.onboardingapp"),
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='mitmproxy',
debug=False,
strip=None,
upx=True,
console=True,
icon='icon.ico' )

View File

@ -1,23 +0,0 @@
# -*- mode: python -*-
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(['mitmweb'],
binaries=None,
datas=collect_data_files("mitmproxy"),
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='mitmweb',
debug=False,
strip=None,
upx=True,
console=True,
icon='icon.ico' )

View File

@ -1,23 +0,0 @@
# -*- mode: python -*-
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(['pathoc'],
binaries=None,
datas=None,
hiddenimports=['_cffi_backend'],
hookspath=None,
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='pathoc',
debug=False,
strip=None,
upx=True,
console=True,
icon='icon.ico' )

View File

@ -1,23 +0,0 @@
# -*- mode: python -*-
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(['pathod'],
binaries=None,
datas=collect_data_files("pathod"),
hiddenimports=['_cffi_backend'],
hookspath=None,
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='pathod',
debug=False,
strip=None,
upx=True,
console=True,
icon='icon.ico' )