mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Generalize binary building, add static resources, add spec files for mitmproxy, mitmdump and mitmweb
We're now ready to use the same script (more or less) to build Windows binaries.
This commit is contained in:
parent
0cc8c44c22
commit
e4f510685e
32
release/mitmdump.spec
Normal file
32
release/mitmdump.spec
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
a = Analysis(['./mitmdump'],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=None,
|
||||||
|
runtime_hooks=None,
|
||||||
|
excludes=None,
|
||||||
|
cipher=block_cipher,
|
||||||
|
)
|
||||||
|
a.datas = Tree(
|
||||||
|
"./libmproxy/onboarding/templates",
|
||||||
|
prefix="libmproxy/onboarding/templates"
|
||||||
|
)
|
||||||
|
a.datas += Tree(
|
||||||
|
"./libmproxy/onboarding/static",
|
||||||
|
prefix="libmproxy/onboarding/static"
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
name='mitmdump',
|
||||||
|
debug=False,
|
||||||
|
strip=None,
|
||||||
|
upx=True,
|
||||||
|
console=True )
|
32
release/mitmproxy.spec
Normal file
32
release/mitmproxy.spec
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
a = Analysis(['./mitmproxy'],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=None,
|
||||||
|
runtime_hooks=None,
|
||||||
|
excludes=None,
|
||||||
|
cipher=block_cipher,
|
||||||
|
)
|
||||||
|
a.datas = Tree(
|
||||||
|
"./libmproxy/onboarding/templates",
|
||||||
|
prefix="libmproxy/onboarding/templates"
|
||||||
|
)
|
||||||
|
a.datas += Tree(
|
||||||
|
"./libmproxy/onboarding/static",
|
||||||
|
prefix="libmproxy/onboarding/static"
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
name='mitmproxy',
|
||||||
|
debug=False,
|
||||||
|
strip=None,
|
||||||
|
upx=True,
|
||||||
|
console=True )
|
40
release/mitmweb.spec
Normal file
40
release/mitmweb.spec
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
a = Analysis(['./mitmweb'],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=None,
|
||||||
|
runtime_hooks=None,
|
||||||
|
excludes=None,
|
||||||
|
cipher=block_cipher,
|
||||||
|
)
|
||||||
|
a.datas = Tree(
|
||||||
|
"./libmproxy/onboarding/templates",
|
||||||
|
prefix="libmproxy/onboarding/templates"
|
||||||
|
)
|
||||||
|
a.datas += Tree(
|
||||||
|
"./libmproxy/onboarding/static",
|
||||||
|
prefix="libmproxy/onboarding/static"
|
||||||
|
)
|
||||||
|
a.datas += Tree(
|
||||||
|
"./libmproxy/web/templates",
|
||||||
|
prefix="libmproxy/web/templates"
|
||||||
|
)
|
||||||
|
a.datas += Tree(
|
||||||
|
"./libmproxy/web/static",
|
||||||
|
prefix="libmproxy/web/static"
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
name='mitmweb',
|
||||||
|
debug=False,
|
||||||
|
strip=None,
|
||||||
|
upx=True,
|
||||||
|
console=True )
|
@ -5,36 +5,45 @@
|
|||||||
# A few quirks to note, which should be re-checked every release:
|
# A few quirks to note, which should be re-checked every release:
|
||||||
# - We require the latest development version of PyInstaller.
|
# - We require the latest development version of PyInstaller.
|
||||||
|
|
||||||
# - PyInstaller has trouble detecting the zope.interfaces package. This is
|
# To run, first install netlib and mitmproxy, then run
|
||||||
# required by Twisted, which for mysterious reasons is required by Urwid. The
|
#
|
||||||
# answer is to touch the __init__.py file in the zope directory. On my system:
|
# ./release/osx-binaries
|
||||||
# touch /Library/Python/2.7/site-packages/zope/__init__.py
|
#
|
||||||
|
# From the top-level mitmproxy directory.
|
||||||
|
|
||||||
# To run, first install netlib and mitmproxy, then change into the pyinstaller
|
usage ()
|
||||||
# directory, and then run this script.
|
{
|
||||||
|
echo 'Usage : ./release/osx-binaries /path/to/pyinstaller.py'
|
||||||
|
echo 'Run from the top-level mitmproxy directory'
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
TMPDIR=/tmp
|
if [ "$1" = "" ]
|
||||||
DST=$TMPDIR/osx-mitmproxy
|
then
|
||||||
MITMPROXY=~/mitmproxy/mitmproxy
|
usage
|
||||||
PYINST_CMD="./pyinstaller.py -F --clean"
|
fi
|
||||||
|
|
||||||
rm -rf $TMPDIR/osx-mitmproxy*
|
|
||||||
mkdir -p $DST
|
|
||||||
rm -rf mitmproxy
|
|
||||||
rm -rf mitmdump
|
|
||||||
|
|
||||||
$PYINST_CMD $MITMPROXY/mitmproxy
|
TMPDIR=./tmp
|
||||||
$MITMPROXY/mitmproxy --version || exit 1
|
PYINST_CMD=$1" -F --clean"
|
||||||
cp mitmproxy/dist/mitmproxy $DST
|
|
||||||
|
|
||||||
$PYINST_CMD $MITMPROXY/mitmdump
|
rm -f dist/*
|
||||||
$MITMPROXY/mitmdump --version || exit 1
|
rm -rf $TMPDIR
|
||||||
cp mitmdump/dist/mitmdump $DST
|
|
||||||
|
|
||||||
cshape $MITMPROXY/doc-src $DST/doc
|
$PYINST_CMD ./release/mitmdump.spec
|
||||||
|
./dist/mitmdump --version || exit 1
|
||||||
|
|
||||||
|
$PYINST_CMD ./release/mitmproxy.spec
|
||||||
|
./dist/mitmproxy --version || exit 1
|
||||||
|
|
||||||
|
$PYINST_CMD ./release/mitmweb.spec
|
||||||
|
./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
|
||||||
|
|
||||||
VBASE=osx-mitmproxy-`$MITMPROXY/mitmdump --shortversion 2>&1`
|
|
||||||
mv $DST $TMPDIR/$VBASE
|
|
||||||
TGZDST=$TMPDIR/$VBASE.tgz
|
|
||||||
cd $TMPDIR
|
cd $TMPDIR
|
||||||
tar -czvf $VBASE.tgz $VBASE
|
tar -czvf $DST.tgz $DST
|
||||||
|
Loading…
Reference in New Issue
Block a user