diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9755041b5..9609a4217 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,27 +1,30 @@ - 1126 Aldo Cortesi - 881 Maximilian Hils - 109 Thomas Kriechbaumer + 1813 Aldo Cortesi + 1228 Maximilian Hils + 282 Thomas Kriechbaumer 83 Marcelo Glezer 28 Jim Shaver 18 Henrik Nordstrom 17 Shadab Zafar 14 David Weinstein + 14 Pedro Worcel 13 Thomas Roth - 12 Pedro Worcel 11 Jake Drahos 11 Justus Wingert 11 Stephen Altamirano 10 András Veres-Szentkirályi 10 Chris Czub + 10 Sandor Nemes + 9 Kyle Morton 9 Legend Tang 9 Matthew Shao + 9 Rouli + 8 Chandler Abraham 8 Jason A. Novak - 8 Rouli 7 Alexis Hildebrandt - 7 Sandor Nemes - 5 Brad Peabody + 7 Brad Peabody + 7 Matthias Urlichs 5 Choongwoo Han - 5 Matthias Urlichs + 5 Sam Cleveland 5 Tomaz Muraus 5 elitest 5 iroiro123 @@ -32,8 +35,10 @@ 4 Wade 524 4 Youhei Sakurai 4 root + 3 Benjamin Lee 3 Chris Neasbitt 3 Eli Shvartsman + 3 Felix Yan 3 Guillem Anguera 3 Kyle Manna 3 MatthewShao @@ -43,6 +48,7 @@ 2 Bennett Blodinger 2 Colin Bendell 2 Heikki Hannikainen + 2 Israel Nir 2 Jaime Soriano Pastor 2 Jim Lloyd 2 Krzysztof Bielicki @@ -50,14 +56,19 @@ 2 Michael Frister 2 Nick Badger 2 Niko Kommenda + 2 Paul 2 Rob Wills + 2 Sean Coates 2 Terry Long 2 Wade Catron 2 alts 2 isra17 2 israel + 2 requires.io + 1 Andrey Plotnikov 1 Andy Smith 1 Ben Lerner + 1 Bradley Baetz 1 Chris Hamant 1 Dan Wilbraham 1 David Dworken @@ -65,7 +76,6 @@ 1 Doug Lethin 1 Eric Entzel 1 Felix Wolfsteller - 1 Felix Yan 1 FreeArtMan 1 Gabriel Kirkpatrick 1 Henrik Nordström @@ -77,8 +87,8 @@ 1 Jean Regisser 1 Jorge Villacorta 1 Kit Randel - 1 Kyle Morton 1 Lucas Cimon + 1 M. Utku Altinkaya 1 Mathieu Mitchell 1 Michael Bisbjerg 1 Mike C @@ -88,7 +98,7 @@ 1 Nick Raptis 1 Nicolas Esteves 1 Oleksandr Sheremet - 1 Paul + 1 Pritam Baral 1 Rich Somerfield 1 Rory McCann 1 Rune Halvorsen @@ -102,6 +112,7 @@ 1 Suyash 1 Tarashish Mishra 1 TearsDontFalls + 1 Tim Becker 1 Timothy Elliott 1 Ulrich Petri 1 Vyacheslav Bakhmutov @@ -113,11 +124,13 @@ 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 vzvu3k6k 1 依云 diff --git a/dev.bat b/dev.bat index d979c73b0..8336f127b 100644 --- a/dev.bat +++ b/dev.bat @@ -12,3 +12,4 @@ echo. echo * Created virtualenv environment in %VENV%. echo * Installed all dependencies into the virtualenv. echo * Activated virtualenv environment. +pause \ No newline at end of file diff --git a/mitmproxy/setup.py b/mitmproxy/setup.py index 5bce0c5a4..004656ccb 100644 --- a/mitmproxy/setup.py +++ b/mitmproxy/setup.py @@ -53,7 +53,7 @@ setup( # https://packaging.python.org/en/latest/requirements/#install-requires # It is not considered best practice to use install_requires to pin dependencies to specific versions. install_requires=[ - "netlib>={}, <{}".format(version.MINORVERSION, version.NEXT_MINORVERSION), + "netlib=={}".format(version.VERSION), "h2>=2.1.0, <2.2", "tornado>=4.3, <4.4", "configargparse>=0.10, <0.11", @@ -88,9 +88,9 @@ setup( "pytest-cov>=2.2.1, <2.3", "pytest-timeout>=1.0.0, <1.1", "coveralls>=1.1, <1.2", - "pathod>={}, <{}".format(version.MINORVERSION, version.NEXT_MINORVERSION), + "pathod=={}".format(version.VERSION), "sphinx>=1.3.5, <1.4", - "sphinx-autobuild>=0.5.2, <0.6", + "sphinx-autobuild>=0.5.2, <0.7", "sphinxcontrib-documentedlist>=0.3.0, <0.4" ], 'contentviews': [ diff --git a/netlib/netlib/version.py b/netlib/netlib/version.py index bc35c30fa..379fee0fa 100644 --- a/netlib/netlib/version.py +++ b/netlib/netlib/version.py @@ -2,10 +2,5 @@ from __future__ import (absolute_import, print_function, division) IVERSION = (0, 17) VERSION = ".".join(str(i) for i in IVERSION) -MINORVERSION = ".".join(str(i) for i in IVERSION[:2]) NAME = "netlib" NAMEVERSION = NAME + " " + VERSION - -NEXT_MINORVERSION = list(IVERSION) -NEXT_MINORVERSION[1] += 1 -NEXT_MINORVERSION = ".".join(str(i) for i in NEXT_MINORVERSION[:2]) diff --git a/pathod/setup.py b/pathod/setup.py index ba329eda1..e4160d131 100644 --- a/pathod/setup.py +++ b/pathod/setup.py @@ -48,7 +48,7 @@ setup( ] }, install_requires=[ - "netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION), + "netlib=={}".format(version.VERSION), "requests>=2.9.1, <2.10", "Flask>=0.10.1, <0.11", "pyparsing>=2.1,<2.2" diff --git a/release/mitmdump.spec b/release/mitmdump.spec index c3b5ecd04..a7bca16ab 100644 --- a/release/mitmdump.spec +++ b/release/mitmdump.spec @@ -2,7 +2,7 @@ from PyInstaller.utils.hooks import collect_data_files -a = Analysis(['../mitmdump'], +a = Analysis(['../mitmproxy/mitmdump'], binaries=None, datas=collect_data_files("libmproxy.onboarding"), hiddenimports=[], diff --git a/release/mitmproxy.spec b/release/mitmproxy.spec index 2666828ab..7cafadbf7 100644 --- a/release/mitmproxy.spec +++ b/release/mitmproxy.spec @@ -2,7 +2,7 @@ from PyInstaller.utils.hooks import collect_data_files -a = Analysis(['../mitmproxy'], +a = Analysis(['../mitmproxy/mitmproxy'], binaries=None, datas=collect_data_files("libmproxy.onboarding"), hiddenimports=[], diff --git a/release/mitmweb.spec b/release/mitmweb.spec index e1fea1a33..cba9b5cd7 100644 --- a/release/mitmweb.spec +++ b/release/mitmweb.spec @@ -2,7 +2,7 @@ from PyInstaller.utils.hooks import collect_data_files -a = Analysis(['../mitmweb'], +a = Analysis(['../mitmproxy/mitmweb'], binaries=None, datas=collect_data_files("libmproxy"), hiddenimports=[], diff --git a/release/pathoc.spec b/release/pathoc.spec index 22649076f..707d21de2 100644 --- a/release/pathoc.spec +++ b/release/pathoc.spec @@ -2,7 +2,7 @@ from PyInstaller.utils.hooks import collect_data_files -a = Analysis(['../pathoc'], +a = Analysis(['../pathod/pathoc'], binaries=None, datas=None, hiddenimports=['_cffi_backend'], diff --git a/release/pathod.spec b/release/pathod.spec index 706b6b68e..4e515ac98 100644 --- a/release/pathod.spec +++ b/release/pathod.spec @@ -2,7 +2,7 @@ from PyInstaller.utils.hooks import collect_data_files -a = Analysis(['../pathod'], +a = Analysis(['../pathod/pathod'], binaries=None, datas=collect_data_files("libpathod"), hiddenimports=['_cffi_backend'], diff --git a/release/rtool.py b/release/rtool.py index 136b3066c..abeb23629 100644 --- a/release/rtool.py +++ b/release/rtool.py @@ -14,7 +14,6 @@ import platform import click import pysftp import fnmatch -from six.moves import shlex_quote # https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes # scripts and executables on Windows go in ENV\Scripts\ instead of ENV/bin/ @@ -34,7 +33,8 @@ else: RELEASE_DIR = join(os.path.dirname(os.path.realpath(__file__))) DIST_DIR = join(RELEASE_DIR, "dist") -ROOT_DIR = join(RELEASE_DIR, "..") +ROOT_DIR = os.path.normpath(join(RELEASE_DIR, "..")) +VERSION_FILE = join(ROOT_DIR, "netlib/netlib/version.py") BUILD_DIR = join(RELEASE_DIR, "build") PYINSTALLER_TEMP = join(BUILD_DIR, "pyinstaller") @@ -47,19 +47,16 @@ VENV_PYINSTALLER = join(VENV_DIR, VENV_BIN, "pyinstaller") ALL_PROJECTS = { "netlib": { "tools": [], - "vfile": join(ROOT_DIR, "netlib/netlib/version.py"), "dir": join(ROOT_DIR, "netlib"), "python_version": "py2.py3" # this is the format in wheel filenames }, "pathod": { "tools": ["pathod", "pathoc"], - "vfile": join(ROOT_DIR, "pathod/libpathod/version.py"), "dir": join(ROOT_DIR, "pathod"), "python_version": "py2" }, "mitmproxy": { "tools": ["mitmproxy", "mitmdump", "mitmweb"], - "vfile": join(ROOT_DIR, "mitmproxy/libmproxy/version.py"), "dir": join(ROOT_DIR, "mitmproxy"), "python_version": "py2" } @@ -70,21 +67,18 @@ if platform.system() == "Windows": projects = {} -def get_version(project): - return runpy.run_path(projects[project]["vfile"])["VERSION"] +def get_version(): + return runpy.run_path(VERSION_FILE)["VERSION"] -def get_snapshot_version(project): - last_tag, tag_dist, commit = subprocess.check_output( - ["git", "describe", "--tags", "--long"], - cwd=projects[project]["dir"] - ).strip().rsplit("-", 2) +def get_snapshot_version(): + last_tag, tag_dist, commit = git("describe --tags --long").strip().rsplit(b"-", 2) tag_dist = int(tag_dist) if tag_dist == 0: - return get_version(project) + return get_version() else: return "{version}dev{tag_dist:04}-{commit}".format( - version=get_version(project), # this should already be the next version + version=get_version(), # this should already be the next version tag_dist=tag_dist, commit=commit ) @@ -102,7 +96,7 @@ def archive_name(project): ext = "tar.gz" return "{project}-{version}-{platform}.{ext}".format( project=project, - version=get_version(project), + version=get_version(), platform=platform_tag, ext=ext ) @@ -111,14 +105,14 @@ def archive_name(project): def sdist_name(project): return "{project}-{version}.tar.gz".format( project=project, - version=get_version(project) + version=get_version() ) def wheel_name(project): return "{project}-{version}-{py_version}-none-any.whl".format( project=project, - version=get_version(project), + version=get_version(), py_version=projects[project]["python_version"] ) @@ -143,6 +137,11 @@ def chdir(path): os.chdir(old_dir) +def git(args): + with chdir(ROOT_DIR): + return subprocess.check_output(["git"] + shlex.split(args)) + + @click.group(chain=True) @click.option( '--project', '-p', @@ -161,14 +160,11 @@ def contributors(): """ Update CONTRIBUTORS.md """ - for project, conf in projects.items(): - with chdir(conf["dir"]): - print("Updating %s/CONTRIBUTORS..." % project) - contributors_data = subprocess.check_output( - shlex.split("git shortlog -n -s") - ) - with open("CONTRIBUTORS", "w") as f: - f.write(contributors_data) + with chdir(ROOT_DIR): + print("Updating CONTRIBUTORS...") + contributors_data = git("shortlog -n -s") + with open("CONTRIBUTORS", "w") as f: + f.write(contributors_data) @cli.command("set-version") @@ -179,35 +175,15 @@ def set_version(version): """ print("Update versions...") version = ", ".join(version.split(".")) - for p, conf in projects.items(): - print("Update %s..." % os.path.normpath(conf["vfile"])) - with open(conf["vfile"], "rb") as f: - content = f.read() - new_content = re.sub( - r"IVERSION\s*=\s*\([\d,\s]+\)", "IVERSION = (%s)" % version, - content - ) - with open(conf["vfile"], "wb") as f: - f.write(new_content) - - -def _git(project, args): - print("%s> %s..." % (project, " ".join(shlex_quote(a) for a in args))) - subprocess.check_call( - ["git"] + list(args), - cwd=projects[project]["dir"] + print("Update %s..." % VERSION_FILE) + with open(VERSION_FILE, "rb") as f: + content = f.read() + new_content = re.sub( + r"IVERSION\s*=\s*\([\d,\s]+\)", "IVERSION = (%s)" % version, + content ) - - -@cli.command("git") -@click.argument('args', nargs=-1, required=True) -def git(args): - """ - Run a git command on every project - """ - for project, conf in projects.items(): - _git(project, args) - print("") + with open(VERSION_FILE, "wb") as f: + f.write(new_content) @cli.command("sdist") @@ -274,7 +250,7 @@ def bdist(ctx, use_existing_sdist, pyinstaller_version): if conf["tools"]: with Archive(join(DIST_DIR, archive_name(p))) as archive: for tool in conf["tools"]: - spec = join(conf["dir"], "release", "%s.spec" % tool) + spec = join(RELEASE_DIR, "%s.spec" % tool) print("Building %s binary..." % tool) subprocess.check_call( [ @@ -347,7 +323,7 @@ def upload_snapshot(host, port, user, private_key, private_key_password, sdist, private_key=private_key, private_key_pass=private_key_password) as sftp: for project, conf in projects.items(): - dir_name = "snapshots/v{}".format(get_version(project)) + dir_name = "snapshots/v{}".format(get_version()) sftp.makedirs(dir_name) with sftp.cd(dir_name): files = [] @@ -360,15 +336,17 @@ def upload_snapshot(host, port, user, private_key, private_key_password, sdist, for f in files: local_path = join(DIST_DIR, f) - remote_filename = f.replace(get_version(project), get_snapshot_version(project)) - symlink_path = "../{}".format(f.replace(get_version(project), "latest")) + remote_filename = f.replace(get_version(), get_snapshot_version()) + symlink_path = "../{}".format(f.replace(get_version(), "latest")) - old_version = f.replace(get_version(project), "*") - for f in sftp.listdir(): - if fnmatch.fnmatch(f, old_version): - print("Removing {}...".format(f)) - sftp.remove(f) + # 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) + # Upload new version print("Uploading {} as {}...".format(f, remote_filename)) with click.progressbar(length=os.stat(local_path).st_size) as bar: sftp.put( @@ -379,11 +357,11 @@ def upload_snapshot(host, port, user, private_key, private_key_password, sdist, # We hide the file during upload. sftp.rename("." + remote_filename, remote_filename) - # add symlink + # update symlink for the latest release if sftp.lexists(symlink_path): print("Removing {}...".format(symlink_path)) sftp.remove(symlink_path) - sftp.symlink("v{}/{}".format(get_version(project), remote_filename), symlink_path) + sftp.symlink("v{}/{}".format(get_version(), remote_filename), symlink_path) @cli.command("wizard") @@ -396,10 +374,9 @@ def wizard(ctx, next_version, username, password, repository): """ Interactive Release Wizard """ - for project, conf in projects.items(): - is_dirty = subprocess.check_output(["git", "status", "--porcelain"], cwd=conf["dir"]) - if is_dirty: - raise RuntimeError("%s repository is not clean." % project) + is_dirty = git("status --porcelain") + if is_dirty: + raise RuntimeError("Repository is not clean.") # update contributors file ctx.invoke(contributors) @@ -411,13 +388,12 @@ def wizard(ctx, next_version, username, password, repository): click.confirm("Please test the release now. Is it ok?", abort=True) except click.Abort: # undo changes - ctx.invoke(git, args=["checkout", "CONTRIBUTORS"]) + git("checkout CONTRIBUTORS") raise # Everything ok - let's ship it! - for p in projects.keys(): - _git(p, ["tag", "v" + get_version(p)]) - ctx.invoke(git, args=["push", "--tags"]) + git("tag v{}".format(get_version())) + git("push --tags") ctx.invoke( upload_release, username=username, password=password, repository=repository @@ -427,10 +403,8 @@ def wizard(ctx, next_version, username, password, repository): # version bump commit ctx.invoke(set_version, version=next_version) - ctx.invoke( - git, args=["commit", "-a", "-m", "bump version"] - ) - ctx.invoke(git, args=["push"]) + git("commit -a -m \"bump version\"") + git("push") click.echo("All done!")