aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-05-18 08:09:42 +1200
committerAldo Cortesi <aldo@corte.si>2018-05-18 08:09:42 +1200
commite1de592e46c7d7b129dbfb80de1f64a24e9d82ee (patch)
treee21687cd701c45abbf3d758ef362a202d9ad1977
parent2bbfcfae927c89d42b0b0c3d1abac268ee68dff7 (diff)
downloadmitmproxy-e1de592e46c7d7b129dbfb80de1f64a24e9d82ee.tar.gz
mitmproxy-e1de592e46c7d7b129dbfb80de1f64a24e9d82ee.tar.bz2
mitmproxy-e1de592e46c7d7b129dbfb80de1f64a24e9d82ee.zip
Release cleanups
- rtool suck back in, the bastard! Delete it. - Ditch CONTRRIBUTORS, saving a step. I added this before Github had a contributors page, which is good enough: https://github.com/mitmproxy/mitmproxy/graphs/contributors - Remove some cruft from CI that we no longer use.
-rw-r--r--CONTRIBUTORS189
-rw-r--r--release/README.md2
-rwxr-xr-xrelease/ci.py10
-rwxr-xr-xrelease/rtool.py376
4 files changed, 0 insertions, 577 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
deleted file mode 100644
index b1d609d1..00000000
--- a/CONTRIBUTORS
+++ /dev/null
@@ -1,189 +0,0 @@
- 2407 Aldo Cortesi
- 1873 Maximilian Hils
- 556 Thomas Kriechbaumer
- 258 Shadab Zafar
- 97 Jason
- 83 Marcelo Glezer
- 68 Clemens
- 28 Jim Shaver
- 18 Henrik Nordstrom
- 16 Matthew Shao
- 14 Pedro Worcel
- 14 David Weinstein
- 13 Thomas Roth
- 11 Jake Drahos
- 11 Stephen Altamirano
- 11 arjun23496
- 11 Justus Wingert
- 10 András Veres-Szentkirályi
- 10 Zohar Lorberbaum
- 10 smill
- 10 Chris Czub
- 10 Sandor Nemes
- 10 Doug Freed
- 9 ikoz
- 9 Legend Tang
- 9 Rouli
- 9 Kyle Morton
- 8 Jason A. Novak
- 8 Chandler Abraham
- 7 Matthias Urlichs
- 7 Brad Peabody
- 7 dufferzafar
- 7 Alexis Hildebrandt
- 6 Felix Yan
- 5 Will Coster
- 5 Sam Cleveland
- 5 iroiro123
- 5 elitest
- 5 Tomaz Muraus
- 5 Choongwoo Han
- 4 Schamper
- 4 Youhei Sakurai
- 4 Bryan Bishop
- 4 root
- 4 Valtteri Virtanen
- 4 Clemens Brunner
- 4 Marc Liyanage
- 4 Wade 524
- 4 chhsiao90
- 4 yonder
- 4 Michael J. Bazzinotti
- 3 Ryan Welton
- 3 Ryan Laughlin
- 3 Kyle Manna
- 3 Eli Shvartsman
- 3 Vincent Haupert
- 3 Manish Kumar
- 3 Zack B
- 3 MatthewShao
- 3 redfast00
- 3 requires.io
- 3 Guillem Anguera
- 3 smill@cuckoo.sh
- 3 Chris Neasbitt
- 3 Benjamin Lee
- 2 Steven Van Acker
- 2 Slobodan Mišković
- 2 Jim Lloyd
- 2 isra17
- 2 israel
- 2 Sean Coates
- 2 Sachin Kelkar
- 2 jpkrause
- 2 Bennett Blodinger
- 2 lilydjwg
- 2 Michael Frister
- 2 Israel Nir
- 2 Cory Benfield
- 2 phackt
- 2 Anant
- 2 Jaime Soriano Pastor
- 2 Paul
- 2 Colin Bendell
- 2 依云
- 2 Heikki Hannikainen
- 2 Rob Wills
- 2 Niko Kommenda
- 2 Naveen Pai
- 2 strohu
- 2 alts
- 2 Yoginski
- 2 Mark E. Haase
- 2 Wade Catron
- 2 Terry Long
- 2 Krzysztof Bielicki
- 2 Nick Badger
- 1 Nicolas Esteves
- 1 Andrew Orr
- 1 Andrey Plotnikov
- 1 Andy Smith
- 1 Angelo Agatino Nicolosi
- 1 Anthony Zhang
- 1 BSalita
- 1 Ben Lerner
- 1 Bradley Baetz
- 1 Brady Law
- 1 Brett Randall
- 1 Chris Hamant
- 1 Christian Frichot
- 1 Dan Wilbraham
- 1 David Dworken
- 1 David Shaw
- 1 Doug Lethin
- 1 Drake Caraker
- 1 Edgar Boda-Majer
- 1 Eric Entzel
- 1 Felix Wolfsteller
- 1 FreeArtMan
- 1 Gabriel Kirkpatrick
- 1 Henrik Nordström
- 1 Israel Blancas
- 1 Ivaylo Popov
- 1 JC
- 1 Jakub Nawalaniec
- 1 Jakub Wilk
- 1 James Billingham
- 1 Jason Pepas
- 1 Jean Regisser
- 1 Jonathan Jones
- 1 Jorge Villacorta
- 1 Kit Randel
- 1 Kostya Esmukov
- 1 Linmiao Xu
- 1 Lucas Cimon
- 1 M. Utku Altinkaya
- 1 Mathieu Mitchell
- 1 Michael Bisbjerg
- 1 Mike C
- 1 Mike Fotinakis
- 1 Mikhail Korobov
- 1 Morton Fox
- 1 Nick HS
- 1 Nick Raptis
- 1 Aditya
- 1 Oleksandr Sheremet
- 1 Parth Ganatra
- 1 Pritam Baral
- 1 Quentin Pradet
- 1 Rich Somerfield
- 1 Rory McCann
- 1 Rune Halvorsen
- 1 Ryo Onodera
- 1 Sahil Chelaramani
- 1 Sahn Lam
- 1 Sanchit Sokhey
- 1 Seppo Yli-Olli
- 1 Sergey Chipiga
- 1 Stefan Wärting
- 1 Steve Phillips
- 1 Steven Noble
- 1 Suyash
- 1 Tai Dickerson
- 1 Tarashish Mishra
- 1 TearsDontFalls
- 1 Thiago Arrais
- 1 Tim Becker
- 1 Timothy Elliott
- 1 Tyler St. Onge
- 1 Ulrich Petri
- 1 Vyacheslav Bakhmutov
- 1 Wes Turner
- 1 Yuangxuan Wang
- 1 capt8bit
- 1 cle1000
- 1 davidpshaw
- 1 deployable
- 1 gecko655
- 1 jlhonora
- 1 joebowbeer
- 1 kronick
- 1 meeee
- 1 michaeljau
- 1 peralta
- 1 phil plante
- 1 sentient07
- 1 sethp-jive
- 1 starenka
- 1 vulnminer
- 1 vzvu3k6k
diff --git a/release/README.md b/release/README.md
index 044e0dc9..08972076 100644
--- a/release/README.md
+++ b/release/README.md
@@ -6,7 +6,6 @@ release for! The command examples assume that you have a git remote called
- Verify that `mitmproxy/version.py` is correct
- Update CHANGELOG
-- Update CONTRIBUTORS: `git shortlog -n -s > CONTRIBUTORS`
- Verify that all CI tests pass
- Create a major version branch - e.g. `v4.x`. Assuming you have a remote repo called `upstream` that points to the mitmproxy/mitmproxy repo::
- `git checkout -b v4.x upstream/master`
@@ -68,6 +67,5 @@ release for! The command examples assume that you have a git remote called
- `./upload-stable`
## Prepare for next release
-
- Last but not least, bump the version on master in
[https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/version.py](mitmproxy/version.py) for major releases.
diff --git a/release/ci.py b/release/ci.py
index 7550aae4..a5000879 100755
--- a/release/ci.py
+++ b/release/ci.py
@@ -12,7 +12,6 @@ import tarfile
import zipfile
from os.path import join, abspath, dirname, exists, basename
-import cryptography.fernet
import click
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
@@ -268,14 +267,5 @@ def upload():
])
-@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()))
-
-
if __name__ == "__main__":
cli()
diff --git a/release/rtool.py b/release/rtool.py
deleted file mode 100755
index 14a0a078..00000000
--- a/release/rtool.py
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/usr/bin/env python3
-
-import contextlib
-import fnmatch
-import os
-import platform
-import re
-import runpy
-import shlex
-import shutil
-import subprocess
-import tarfile
-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
-# scripts and executables on Windows go in ENV\Scripts\ instead of ENV/bin/
-if platform.system() == "Windows":
- VENV_BIN = "Scripts"
- PYINSTALLER_ARGS = [
- # 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",
- ]
-else:
- VENV_BIN = "bin"
- PYINSTALLER_ARGS = []
-
-# ZipFile and tarfile have slightly different APIs. Fix that.
-if platform.system() == "Windows":
- def Archive(name):
- a = zipfile.ZipFile(name, "w")
- a.add = a.write
- return a
-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")
-
-BUILD_DIR = join(RELEASE_DIR, "build")
-DIST_DIR = join(RELEASE_DIR, "dist")
-
-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", PLATFORM_TAG)
-
-VENV_DIR = join(BUILD_DIR, "venv")
-
-# Project Configuration
-VERSION_FILE = join(ROOT_DIR, "mitmproxy", "version.py")
-BDISTS = {
- "mitmproxy": ["mitmproxy", "mitmdump", "mitmweb"],
- "pathod": ["pathoc", "pathod"]
-}
-if platform.system() == "Windows":
- BDISTS["mitmproxy"].remove("mitmproxy")
-
-TOOLS = [
- tool
- for tools in sorted(BDISTS.values())
- for tool in tools
-]
-
-
-def git(args: str) -> str:
- with chdir(ROOT_DIR):
- return subprocess.check_output(["git"] + shlex.split(args)).decode()
-
-
-def get_version(dev: bool = False, build: bool = False) -> str:
- version = runpy.run_path(VERSION_FILE)["VERSION"]
- version = re.sub(r"\.dev.+?$", "", version) # replace dev suffix if present.
-
- last_tag, tag_dist, commit = git("describe --tags --long").strip().rsplit("-", 2)
- commit = commit.lstrip("g")[:7]
- tag_dist = int(tag_dist)
-
- if tag_dist > 0 and dev:
- dev_tag = ".dev{tag_dist:04}".format(tag_dist=tag_dist)
- else:
- dev_tag = ""
-
- if tag_dist > 0 and build:
- # The wheel build tag (we use the commit) must start with a digit, so we include "0x"
- build_tag = "-0x{commit}".format(commit=commit)
- else:
- build_tag = ""
-
- return version + dev_tag + build_tag
-
-
-def set_version(dev: bool) -> None:
- """
- Update version information in mitmproxy's version.py to either include the dev version or not.
- """
- v = get_version(dev)
- with open(VERSION_FILE) as f:
- content = f.read()
- content = re.sub(r'^VERSION = ".+?"', 'VERSION = "{}"'.format(v), content)
- with open(VERSION_FILE, "w") as f:
- f.write(content)
-
-
-def archive_name(bdist: str) -> str:
- if platform.system() == "Windows":
- ext = "zip"
- else:
- ext = "tar.gz"
- return "{project}-{version}-{platform}.{ext}".format(
- project=bdist,
- version=get_version(),
- platform=PLATFORM_TAG,
- ext=ext
- )
-
-
-def wheel_name() -> str:
- return "mitmproxy-{version}-py3-none-any.whl".format(
- version=get_version(True),
- )
-
-
-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()
- os.chdir(path)
- yield
- os.chdir(old_dir)
-
-
-@click.group(chain=True)
-def cli():
- """
- mitmproxy build tool
- """
- 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():
- """
- Update CONTRIBUTORS.md
- """
- with chdir(ROOT_DIR):
- print("Updating CONTRIBUTORS...")
- contributors_data = git("shortlog -n -s")
- with open("CONTRIBUTORS", "wb") as f:
- f.write(contributors_data.encode())
-
-
-@cli.command("wheel")
-def make_wheel():
- """
- Build a Python wheel
- """
- set_version(True)
- try:
- subprocess.check_call([
- "tox", "-e", "wheel",
- ], env={
- **os.environ,
- "VERSION": get_version(True),
- })
- finally:
- set_version(False)
-
-
-@cli.command("bdist")
-def make_bdist():
- """
- Build a binary distribution
- """
- if exists(PYINSTALLER_TEMP):
- shutil.rmtree(PYINSTALLER_TEMP)
- if exists(PYINSTALLER_DIST):
- shutil.rmtree(PYINSTALLER_DIST)
-
- os.makedirs(DIST_DIR, exist_ok=True)
-
- for bdist, tools in sorted(BDISTS.items()):
- with Archive(join(DIST_DIR, archive_name(bdist))) as archive:
- for tool in tools:
- # We can't have a folder and a file with the same name.
- if tool == "mitmproxy":
- tool = "mitmproxy_main"
- # This is PyInstaller, so it messes up paths.
- # We need to make sure that we are in the spec folder.
- with chdir(PYINSTALLER_SPEC):
- print("Building %s binary..." % tool)
- excludes = []
- if tool != "mitmweb":
- excludes.append("mitmproxy.tools.web")
- if tool != "mitmproxy_main":
- excludes.append("mitmproxy.tools.console")
-
- # Overwrite mitmproxy/version.py to include commit info
- set_version(True)
- try:
- subprocess.check_call(
- [
- "pyinstaller",
- "--clean",
- "--workpath", PYINSTALLER_TEMP,
- "--distpath", PYINSTALLER_DIST,
- "--additional-hooks-dir", PYINSTALLER_HOOKS,
- "--onefile",
- "--console",
- "--icon", "icon.ico",
- # This is PyInstaller, so setting a
- # different log level obviously breaks it :-)
- # "--log-level", "WARN",
- ]
- + [x for e in excludes for x in ["--exclude-module", e]]
- + PYINSTALLER_ARGS
- + [tool]
- )
- finally:
- set_version(False)
- # Delete the spec file - we're good without.
- os.remove("{}.spec".format(tool))
-
- # Test if it works at all O:-)
- executable = join(PYINSTALLER_DIST, tool)
- if platform.system() == "Windows":
- executable += ".exe"
-
- # Remove _main suffix from mitmproxy executable
- if "_main" in executable:
- shutil.move(
- executable,
- executable.replace("_main", "")
- )
- executable = executable.replace("_main", "")
-
- print("> %s --version" % executable)
- print(subprocess.check_output([executable, "--version"]).decode())
-
- archive.add(executable, basename(executable))
- print("Packed {}.".format(archive_name(bdist)))
-
-
-@cli.command("upload-release")
-@click.option('--username', prompt=True)
-@click.password_option(confirmation_prompt=False)
-@click.option('--repository', default="pypi")
-def upload_release(username, password, repository):
- """
- Upload wheels to PyPI
- """
- filename = wheel_name()
- print("Uploading {} to {}...".format(filename, repository))
- subprocess.check_call([
- "twine",
- "upload",
- "-u", username,
- "-p", password,
- "-r", repository,
- join(DIST_DIR, filename)
- ])
-
-
-@cli.command("upload-snapshot")
-@click.option("--host", envvar="SNAPSHOT_HOST", prompt=True)
-@click.option("--port", envvar="SNAPSHOT_PORT", type=int, default=22)
-@click.option("--user", envvar="SNAPSHOT_USER", prompt=True)
-@click.option("--private-key", default=join(RELEASE_DIR, "rtool.pem"))
-@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)
-@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
- """
- with pysftp.Connection(host=host,
- port=port,
- username=user,
- private_key=private_key,
- private_key_pass=private_key_password) as sftp:
- dir_name = "snapshots/v{}".format(get_version())
- sftp.makedirs(dir_name)
- with sftp.cd(dir_name):
- files = []
- if wheel:
- files.append(wheel_name())
- 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)
- remote_filename = re.sub(
- r"{version}(\.dev\d+(-0x[0-9a-f]+)?)?".format(version=get_version()),
- get_version(True, True),
- f
- )
- symlink_path = "../{}".format(f.replace(get_version(), "latest"))
-
- # Upload new version
- print("Uploading {} as {}...".format(f, remote_filename))
- with click.progressbar(length=os.stat(local_path).st_size) as bar:
- # We hide the file during upload
- sftp.put(
- local_path,
- "." + remote_filename,
- callback=lambda done, total: bar.update(done - bar.pos)
- )
-
- # Delete old versions
- old_version = f.replace(get_version(), "*")
- for f_old in sftp.listdir():
- if fnmatch.fnmatch(f_old, old_version):
- print("Removing {}...".format(f_old))
- sftp.remove(f_old)
-
- # Show new version
- sftp.rename("." + remote_filename, remote_filename)
-
- # update symlink for the latest release
- if sftp.lexists(symlink_path):
- print("Removing {}...".format(symlink_path))
- sftp.remove(symlink_path)
- if f != wheel_name():
- # "latest" isn't a proper wheel version, so this could not be installed.
- # https://github.com/mitmproxy/mitmproxy/issues/1065
- sftp.symlink("v{}/{}".format(get_version(), remote_filename), symlink_path)
-
-
-if __name__ == "__main__":
- cli()