mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
OSX tarfiles, remove obsolete osx-binaries
This commit is contained in:
parent
a13fe94b7c
commit
bf773f822c
60
osx-binaries
60
osx-binaries
@ -1,60 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Quick and dangerous script for building OSX binaries.
|
|
||||||
|
|
||||||
# At the moment, pyinstaller has no support for entry points, except for this
|
|
||||||
# hideous hack on the wiki:
|
|
||||||
# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point
|
|
||||||
# Once this is fixed, we can ditch the redundant command scripts.
|
|
||||||
|
|
||||||
VENV=./venv
|
|
||||||
PYINST_CMD="$VENV/bin/pyinstaller -F --clean"
|
|
||||||
TMPDIR=./tmp
|
|
||||||
CACHE="~/Library/Application Support/pyinstaller"
|
|
||||||
MITMPROXY="../mitmproxy"
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d $VENV ]
|
|
||||||
then
|
|
||||||
echo "Failed: set up a dev environment as described in the README"
|
|
||||||
echo "and run from the top-level mitmproxy directory."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
source $VENV/bin/activate
|
|
||||||
|
|
||||||
if [ ! -f $VENV/bin/pyinstaller ]
|
|
||||||
then
|
|
||||||
echo "Installing pyinstaller..."
|
|
||||||
$VENV/bin/pip install \
|
|
||||||
--force-reinstall \
|
|
||||||
--upgrade \
|
|
||||||
https://github.com/pyinstaller/pyinstaller/archive/develop.zip
|
|
||||||
$VENV/bin/pip install --upgrade macholib
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Clearing caches..."
|
|
||||||
rm -f dist/*
|
|
||||||
rm -rf $TMPDIR
|
|
||||||
rm -rf $CACHE
|
|
||||||
|
|
||||||
# $PYINST_CMD $MITMPROXY/release/mitmdump.spec
|
|
||||||
# echo "Running mitmdump..."
|
|
||||||
# ./dist/mitmdump --version || exit 1
|
|
||||||
|
|
||||||
$PYINST_CMD $MITMPROXY/release/mitmproxy.spec
|
|
||||||
echo "Running mitmproxy..."
|
|
||||||
./dist/mitmproxy --version || exit 1
|
|
||||||
|
|
||||||
# $PYINST_CMD $MITMPROXY/release/mitmweb.spec
|
|
||||||
# echo "Running mitmweb..."
|
|
||||||
# ./dist/mitmweb --version || exit 1
|
|
||||||
|
|
||||||
# DST=osx-mitmproxy-`./dist/mitmdump --shortversion 2>&1`
|
|
||||||
# mkdir -p $TMPDIR/$DST
|
|
||||||
# cp ./dist/mitmproxy $TMPDIR/$DST
|
|
||||||
# cp ./dist/mitmdump $TMPDIR/$DST
|
|
||||||
# cshape ./doc-src $TMPDIR/$DST/doc
|
|
||||||
#
|
|
||||||
# cd $TMPDIR
|
|
||||||
# tar -czvf $DST.tar.gz $DST
|
|
66
rtool
66
rtool
@ -12,6 +12,7 @@ import glob
|
|||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import runpy
|
import runpy
|
||||||
|
import pprint
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
@ -42,15 +43,21 @@ VENV_PYINSTALLER = join(VENV_DIR, VENV_BIN, "pyinstaller")
|
|||||||
PROJECTS = {
|
PROJECTS = {
|
||||||
"netlib": {
|
"netlib": {
|
||||||
"tools": [],
|
"tools": [],
|
||||||
"vfile": join(ROOT_DIR, "netlib/netlib/version.py")
|
"vfile": join(ROOT_DIR, "netlib/netlib/version.py"),
|
||||||
|
"version": None,
|
||||||
|
"dir": None
|
||||||
},
|
},
|
||||||
"pathod": {
|
"pathod": {
|
||||||
"tools": ["pathod", "pathoc"],
|
"tools": ["pathod", "pathoc"],
|
||||||
"vfile": join(ROOT_DIR, "pathod/libpathod/version.py")
|
"vfile": join(ROOT_DIR, "pathod/libpathod/version.py"),
|
||||||
|
"version": None,
|
||||||
|
"dir": None
|
||||||
},
|
},
|
||||||
"mitmproxy": {
|
"mitmproxy": {
|
||||||
"tools": ["mitmproxy", "mitmdump", "mitmweb"],
|
"tools": ["mitmproxy", "mitmdump", "mitmweb"],
|
||||||
"vfile": join(ROOT_DIR, "mitmproxy/libmproxy/version.py")
|
"vfile": join(ROOT_DIR, "mitmproxy/libmproxy/version.py"),
|
||||||
|
"version": None,
|
||||||
|
"dir": None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
@ -201,42 +208,53 @@ def sdist(projects):
|
|||||||
@cli.command("osxbin")
|
@cli.command("osxbin")
|
||||||
@click.option(
|
@click.option(
|
||||||
'--project', '-p', 'projects',
|
'--project', '-p', 'projects',
|
||||||
multiple=True, type=click.Choice(PROJECTS.keys()), default=PROJECTS.keys()
|
multiple=True,
|
||||||
|
type=click.Choice(PROJECTS.keys()),
|
||||||
|
default=PROJECTS.keys()
|
||||||
)
|
)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def osxbin(ctx, projects):
|
def osxbin(ctx, projects):
|
||||||
if not os.path.exists(VENV_PYINSTALLER):
|
if not os.path.exists(VENV_PYINSTALLER):
|
||||||
subprocess.check_call(
|
print("Instaling PyInstaller...")
|
||||||
[
|
subprocess.check_call(
|
||||||
VENV_PIP,
|
[
|
||||||
"install",
|
VENV_PIP,
|
||||||
PYINSTALLER_URL
|
"install",
|
||||||
]
|
PYINSTALLER_URL
|
||||||
)
|
]
|
||||||
|
)
|
||||||
|
|
||||||
shutil.rmtree(PYINSTALLER_CACHE, ignore_errors=True)
|
shutil.rmtree(PYINSTALLER_CACHE, ignore_errors=True)
|
||||||
shutil.rmtree("./build", ignore_errors=True)
|
shutil.rmtree("./build", ignore_errors=True)
|
||||||
shutil.rmtree(PYINSTALLER_DIST, ignore_errors=True)
|
shutil.rmtree(PYINSTALLER_DIST, ignore_errors=True)
|
||||||
for p, conf in proj(projects):
|
for p, conf in proj(projects):
|
||||||
specs = glob.glob(os.path.join(conf["dir"], "release/*.spec"))
|
specs = glob.glob(os.path.join(conf["dir"], "release/*.spec"))
|
||||||
for spec in specs:
|
if specs:
|
||||||
subprocess.check_call(
|
for spec in specs:
|
||||||
[
|
|
||||||
VENV_PYINSTALLER,
|
|
||||||
"--distpath", PYINSTALLER_DIST,
|
|
||||||
spec
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if specs and os.path.exists(PYINSTALLER_DIST):
|
|
||||||
bins = os.listdir(PYINSTALLER_DIST)
|
|
||||||
for bin in bins:
|
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
[
|
[
|
||||||
os.path.join(PYINSTALLER_DIST, bin),
|
VENV_PYINSTALLER,
|
||||||
"--version"
|
"--distpath", PYINSTALLER_DIST,
|
||||||
|
spec
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
bins = os.listdir(PYINSTALLER_DIST)
|
||||||
|
|
||||||
|
base = os.path.join(DIST_DIR, "osx-" + p + "-" + conf["version"])
|
||||||
|
shutil.rmtree(base, ignore_errors=True)
|
||||||
|
os.makedirs(base)
|
||||||
|
for bin in bins:
|
||||||
|
bin = os.path.join(PYINSTALLER_DIST, bin)
|
||||||
|
subprocess.check_call([bin, "--version"])
|
||||||
|
shutil.move(bin, base)
|
||||||
|
subprocess.check_call(
|
||||||
|
[
|
||||||
|
"tar",
|
||||||
|
"-czvf",
|
||||||
|
base + ".tgz",
|
||||||
|
base
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cli.command("mkvenv")
|
@cli.command("mkvenv")
|
||||||
|
Loading…
Reference in New Issue
Block a user