InstallBuilder (#1826)

This commit is contained in:
Maximilian Hils 2016-12-11 23:07:47 +01:00 committed by Thomas Kriechbaumer
parent 6dcd620c4a
commit 980a84326b
13 changed files with 216 additions and 14 deletions

View File

@ -16,6 +16,8 @@ environment:
secure: 6yBwmO5gv4vAwoFYII8qjQ==
SNAPSHOT_PASS:
secure: LPjrtFrWxYhOVGXzfPRV1GjtZE/wHoKq9m/PI6hSalfysUK5p2DxTG9uHlb4Q9qV
RTOOL_KEY:
secure: 0a+UUNbA+JjquyAbda4fd0JmiwL06AdG6torRPdCvbPDbKHnaW/BHHp1nRPytOKM
install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
@ -30,6 +32,29 @@ test_script:
tox -e wheel
tox -e rtool -- bdist
- ps: |
if(
($Env:TOXENV -match "py35") -and
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
tox -e rtool -- decrypt release\installbuilder\license.xml.enc release\installbuilder\license.xml
if (!(Test-Path "C:\projects\mitmproxy\release\installbuilder-installer.exe")) {
"Download InstallBuilder..."
(New-Object System.Net.WebClient).DownloadFile(
"https://installbuilder.bitrock.com/installbuilder-enterprise-16.11.1-windows-installer.exe",
"C:\projects\mitmproxy\release\installbuilder-installer.exe"
)
}
Start-Process "C:\projects\mitmproxy\release\installbuilder-installer.exe" "--mode unattended --unattendedmodeui none" -Wait
& 'C:\Program Files (x86)\BitRock InstallBuilder Enterprise 16.11.1\bin\builder-cli.exe' `
build `
.\release\installbuilder\mitmproxy.xml `
windows `
--license .\release\installbuilder\license.xml `
--setvars project.version=$Env:VERSION `
--verbose
}
deploy_script:
# we build binaries on every run, but we only upload them for master snapshots or tags.
ps: |
@ -37,10 +62,11 @@ deploy_script:
($Env:TOXENV -match "py35") -and
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
tox -e rtool -- upload-snapshot --bdist --wheel
tox -e rtool -- upload-snapshot --bdist --wheel --installer
}
cache:
- C:\projects\mitmproxy\release\installbuilder-installer.exe -> .appveyor.yml
- C:\Users\appveyor\AppData\Local\pip\cache
notifications:

View File

@ -1,4 +1,5 @@
# Taken from the latest pyinstaller master on 2016-11-27 (0729a2b).
# flake8: noqa
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.

2
release/installbuilder/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
license.xml
*.xml.backup

View File

@ -0,0 +1 @@
gAAAAABYSXtgysddnqWL5sAreDTENJZdFkEf9p2nfMZTynY2hEep8vIDwR0P1glL40C04kLUv3piHkqyz0I893b-_YpnZC-W7qwfhChoFxnAQd0NY_d1mLsCHF1nQK0k907IbextZ3XHSCqSkS2nw0S41p9sEbzWLludSRRqJRn-AmxAKdm5s43kheNpP5iArWKtBrtubgytIDanulTfibdAPHaZedyx3JDww3hIUgo2shird7L4q2xQsE0bBDBgGrlndZ6lYGJDKf600LpOPSzSON6uXdPefhPD1bZP0GAFTNMAkm0K39e9J-j9Xz5ao7bEswfR6pcYO1uQC9VmxJYdLkuY9vYiltED6m5dW--NXVx0pudr_e5BXfpT5-RdUHaGM0Od6EZggeD5PNgUtWXxmXd6C0gFBZZEx_KobDXrCD9s8tmRJjb3ACBSCh2NdfFCCfOU3JRHeSgANTDYzY0pcJicoE5UcvP2dEICVvEORwbTumtfWbuDSbXwHqcynVjkJbwxHhRMMeJtjnx4dbb6_wdp2RjOUilTb2ob40OWyU0szgpSe2-5XS_F7ixL7vMf00OHFtTDk0Wg_dv15IR3C-zK8WFWEr4b4POc1P6pRrKOLKIFIKBGGZWF-S-u3gedAL2VLpFoUCG5FMnnJGv2iNfNYkG20zObn9K6FG5uNq6T0ZvfJIjJYNvXV45mx7jhOg2R5HAkZXlx16iIv95qlHIvJR6UZKHqWr_Hp3YvaxatkqbFwpXxQU0xtMJO3dXafATFMW_l

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -0,0 +1,135 @@
<project>
<shortName>mitmproxy</shortName>
<fullName>mitmproxy</fullName>
<version>1.0</version>
<leftImage>logo-installer.png</leftImage>
<logoImage>logo-installer-icon.png</logoImage>
<componentList>
<component>
<name>default</name>
<description>Default Component</description>
<canBeEdited>1</canBeEdited>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>Program Files</description>
<destination>${installdir}</destination>
<name>programfiles</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<origin>logo.ico</origin>
</distributionFile>
</distributionFileList>
</folder>
<folder>
<description>Program Files/bin</description>
<destination>${installdir}/bin</destination>
<name>binaries</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<excludeFiles>*/patho*</excludeFiles>
<origin>../build/binaries/${platform_name}/*</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<postInstallationActionList>
<addDirectoryToPath>
<insertAt>end</insertAt>
<path>${installdir}/bin</path>
<scope>user</scope>
</addDirectoryToPath>
</postInstallationActionList>
<postUninstallationActionList>
<removeDirectoryFromPath>
<path>${installdir}/bin</path>
<scope>user</scope>
</removeDirectoryFromPath>
</postUninstallationActionList>
<startMenuShortcutList>
<startMenuShortcut>
<comment></comment>
<name>mitmproxy ui</name>
<runAsAdmin>0</runAsAdmin>
<runInTerminal>0</runInTerminal>
<windowsExec>${installdir}\bin\mitmweb.exe</windowsExec>
<windowsExecArgs></windowsExecArgs>
<windowsIcon>${installdir}/logo.ico</windowsIcon>
<windowsPath>${installdir}</windowsPath>
</startMenuShortcut>
<startMenuShortcut>
<comment></comment>
<name>mitmdump</name>
<runAsAdmin>0</runAsAdmin>
<runInTerminal>0</runInTerminal>
<windowsExec>${installdir}\bin\mitmdump.exe</windowsExec>
<windowsExecArgs></windowsExecArgs>
<windowsIcon>${installdir}/logo.ico</windowsIcon>
<windowsPath>${installdir}</windowsPath>
</startMenuShortcut>
</startMenuShortcutList>
</component>
</componentList>
<createOsxBundleDmg>1</createOsxBundleDmg>
<disableSplashScreen>1</disableSplashScreen>
<enableRollback>1</enableRollback>
<enableTimestamp>1</enableTimestamp>
<outputDirectory>../dist</outputDirectory>
<productDisplayIcon>logo.ico</productDisplayIcon>
<saveRelativePaths>1</saveRelativePaths>
<vendor>mitmproxy.org</vendor>
<windowsExecutableIcon>logo.ico</windowsExecutableIcon>
<finalPageActionList>
<runProgram>
<program>cmd</program>
<programArguments>/c start "mitmproxy ui" "${installdir}\bin\mitmweb.exe" &amp;</programArguments>
<progressText>Launch mitmproxy ui now</progressText>
<ruleList>
<platformTest>
<type>windows</type>
</platformTest>
</ruleList>
</runProgram>
<runProgram>
<program>${installdir}/mitmproxy</program>
<programArguments>&amp;</programArguments>
<progressText>Launch mitmproxy now</progressText>
<ruleList>
<platformTest>
<negate>1</negate>
<type>windows</type>
</platformTest>
</ruleList>
</runProgram>
</finalPageActionList>
<parameterList>
<directoryParameter>
<name>installdir</name>
<description>Installer.Parameter.installdir.description</description>
<explanation>Installer.Parameter.installdir.explanation</explanation>
<value></value>
<default>${platform_install_prefix}/${product_shortname}</default>
<allowEmptyValue>0</allowEmptyValue>
<ask>yes</ask>
<cliOptionName>prefix</cliOptionName>
<mustBeWritable>yes</mustBeWritable>
<mustExist>0</mustExist>
<width>40</width>
<postShowPageActionList>
<!-- This will skip the readytoinstall page -->
<setInstallerVariable name="next_page" value="installation"/>
</postShowPageActionList>
<preShowPageActionList>
<setInstallerVariable>
<name>ui.button(next).text</name>
<value>${msg(Installer.Button.Install)}</value>
</setInstallerVariable>
</preShowPageActionList>
</directoryParameter>
</parameterList>
</project>

View File

@ -13,6 +13,7 @@ import zipfile
from os.path import join, abspath, dirname, exists, basename
import click
import cryptography.fernet
import pysftp
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
@ -37,6 +38,12 @@ else:
def Archive(name):
return tarfile.open(name, "w:gz")
PLATFORM_TAG = {
"Darwin": "osx",
"Windows": "windows",
"Linux": "linux",
}.get(platform.system(), platform.system())
ROOT_DIR = abspath(join(dirname(__file__), ".."))
RELEASE_DIR = join(ROOT_DIR, "release")
@ -47,7 +54,7 @@ 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_DIST = join(BUILD_DIR, "binaries")
PYINSTALLER_DIST = join(BUILD_DIR, "binaries", PLATFORM_TAG)
VENV_DIR = join(BUILD_DIR, "venv")
@ -91,11 +98,6 @@ def get_snapshot_version() -> str:
def archive_name(bdist: str) -> str:
platform_tag = {
"Darwin": "osx",
"Windows": "win32",
"Linux": "linux"
}.get(platform.system(), platform.system())
if platform.system() == "Windows":
ext = "zip"
else:
@ -103,7 +105,7 @@ def archive_name(bdist: str) -> str:
return "{project}-{version}-{platform}.{ext}".format(
project=bdist,
version=get_version(),
platform=platform_tag,
platform=PLATFORM_TAG,
ext=ext
)
@ -114,6 +116,19 @@ def wheel_name() -> str:
)
def installer_name() -> str:
ext = {
"Windows": "exe",
"Darwin": "dmg",
"Linux": "run"
}[platform.system()]
return "mitmproxy-{version}-{platform}-installer.{ext}".format(
version=get_version(),
platform=PLATFORM_TAG,
ext=ext,
)
@contextlib.contextmanager
def chdir(path: str):
old_dir = os.getcwd()
@ -130,6 +145,24 @@ def cli():
pass
@cli.command("encrypt")
@click.argument('infile', type=click.File('rb'))
@click.argument('outfile', type=click.File('wb'))
@click.argument('key', envvar='RTOOL_KEY')
def encrypt(infile, outfile, key):
f = cryptography.fernet.Fernet(key.encode())
outfile.write(f.encrypt(infile.read()))
@cli.command("decrypt")
@click.argument('infile', type=click.File('rb'))
@click.argument('outfile', type=click.File('wb'))
@click.argument('key', envvar='RTOOL_KEY')
def decrypt(infile, outfile, key):
f = cryptography.fernet.Fernet(key.encode())
outfile.write(f.decrypt(infile.read()))
@cli.command("contributors")
def contributors():
"""
@ -238,7 +271,8 @@ def upload_release(username, password, repository):
@click.option("--private-key-password", envvar="SNAPSHOT_PASS", prompt=True, hide_input=True)
@click.option("--wheel/--no-wheel", default=False)
@click.option("--bdist/--no-bdist", default=False)
def upload_snapshot(host, port, user, private_key, private_key_password, wheel, bdist):
@click.option("--installer/--no-installer", default=False)
def upload_snapshot(host, port, user, private_key, private_key_password, wheel, bdist, installer):
"""
Upload snapshot to snapshot server
"""
@ -256,6 +290,8 @@ def upload_snapshot(host, port, user, private_key, private_key_password, wheel,
if bdist:
for bdist in sorted(BDISTS.keys()):
files.append(archive_name(bdist))
if installer:
files.append(installer_name())
for f in files:
local_path = join(DIST_DIR, f)

View File

@ -8,6 +8,7 @@ setup(
"click>=6.2, <7.0",
"twine>=1.6.5, <1.9",
"pysftp==0.2.8",
"cryptography>=1.6, <1.7",
],
entry_points={
"console_scripts": [

View File

@ -2,7 +2,7 @@
max-line-length = 140
max-complexity = 25
ignore = E251,C901,W503
exclude = mitmproxy/contrib/*,test/mitmproxy/data/*
exclude = mitmproxy/contrib/*,test/mitmproxy/data/*,release/build/*
addons = file,open,basestring,xrange,unicode,long,cmp
[tool:pytest]

View File

@ -8,7 +8,7 @@ basepython = python3.5
deps =
{env:CI_DEPS:}
-rrequirements.txt
passenv = CODECOV_TOKEN CI CI_* TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* SNAPSHOT_* OPENSSL_*
passenv = CODECOV_TOKEN CI CI_* TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* SNAPSHOT_* OPENSSL_* RTOOL_*
setenv = HOME = {envtmpdir}
commands =
mitmdump --sysinfo
@ -22,7 +22,7 @@ commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:lint]
commands =
mitmdump --sysinfo
flake8 --jobs 8 --count mitmproxy pathod examples test
flake8 --jobs 8 --count mitmproxy pathod examples test release
rstcheck README.rst
mypy --silent-imports \
mitmproxy/addons \