mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 16:42:13 -06:00
build up2k.exe
This commit is contained in:
parent
52bd5642da
commit
5ceb3a962f
30
bin/up2k.py
30
bin/up2k.py
|
@ -1,9 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
|
S_VERSION = "1.3"
|
||||||
|
S_BUILD_DT = "2023-03-05"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
up2k.py: upload to copyparty
|
up2k.py: upload to copyparty
|
||||||
2023-03-05, v1.3, ed <irc.rizon.net>, MIT-Licensed
|
2021, ed <irc.rizon.net>, MIT-Licensed
|
||||||
https://github.com/9001/copyparty/blob/hovudstraum/bin/up2k.py
|
https://github.com/9001/copyparty/blob/hovudstraum/bin/up2k.py
|
||||||
|
|
||||||
- dependencies: requests
|
- dependencies: requests
|
||||||
|
@ -24,6 +27,8 @@ import platform
|
||||||
import threading
|
import threading
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
EXE = sys.executable.endswith("exe")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import argparse
|
import argparse
|
||||||
except:
|
except:
|
||||||
|
@ -34,7 +39,9 @@ except:
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
except ImportError:
|
except ImportError:
|
||||||
if sys.version_info > (2, 7):
|
if EXE:
|
||||||
|
raise
|
||||||
|
elif sys.version_info > (2, 7):
|
||||||
m = "\nERROR: need 'requests'; please run this command:\n {0} -m pip install --user requests\n"
|
m = "\nERROR: need 'requests'; please run this command:\n {0} -m pip install --user requests\n"
|
||||||
else:
|
else:
|
||||||
m = "requests/2.18.4 urllib3/1.23 chardet/3.0.4 certifi/2020.4.5.1 idna/2.7"
|
m = "requests/2.18.4 urllib3/1.23 chardet/3.0.4 certifi/2020.4.5.1 idna/2.7"
|
||||||
|
@ -993,8 +1000,13 @@ def main():
|
||||||
cores = (os.cpu_count() if hasattr(os, "cpu_count") else 0) or 2
|
cores = (os.cpu_count() if hasattr(os, "cpu_count") else 0) or 2
|
||||||
hcores = min(cores, 3) # 4% faster than 4+ on py3.9 @ r5-4500U
|
hcores = min(cores, 3) # 4% faster than 4+ on py3.9 @ r5-4500U
|
||||||
|
|
||||||
|
ver = "{}, v{}".format(S_BUILD_DT, S_VERSION)
|
||||||
|
if "--version" in sys.argv:
|
||||||
|
print(ver)
|
||||||
|
return
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
ap = app = argparse.ArgumentParser(formatter_class=APF, epilog="""
|
ap = app = argparse.ArgumentParser(formatter_class=APF, description="up2k uploader / filesearch tool, " + ver, epilog="""
|
||||||
NOTE:
|
NOTE:
|
||||||
source file/folder selection uses rsync syntax, meaning that:
|
source file/folder selection uses rsync syntax, meaning that:
|
||||||
"foo" uploads the entire folder to URL/foo/
|
"foo" uploads the entire folder to URL/foo/
|
||||||
|
@ -1007,6 +1019,7 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
ap.add_argument("-a", metavar="PASSWORD", help="password or $filepath")
|
ap.add_argument("-a", metavar="PASSWORD", help="password or $filepath")
|
||||||
ap.add_argument("-s", action="store_true", help="file-search (disables upload)")
|
ap.add_argument("-s", action="store_true", help="file-search (disables upload)")
|
||||||
ap.add_argument("--ok", action="store_true", help="continue even if some local files are inaccessible")
|
ap.add_argument("--ok", action="store_true", help="continue even if some local files are inaccessible")
|
||||||
|
ap.add_argument("--version", action="store_true", help="show version and exit")
|
||||||
|
|
||||||
ap = app.add_argument_group("compatibility")
|
ap = app.add_argument_group("compatibility")
|
||||||
ap.add_argument("--cls", action="store_true", help="clear screen before start")
|
ap.add_argument("--cls", action="store_true", help="clear screen before start")
|
||||||
|
@ -1030,7 +1043,16 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
ap.add_argument("-td", action="store_true", help="disable certificate check")
|
ap.add_argument("-td", action="store_true", help="disable certificate check")
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
ar = app.parse_args()
|
try:
|
||||||
|
ar = app.parse_args()
|
||||||
|
finally:
|
||||||
|
if EXE and not sys.argv[1:]:
|
||||||
|
print("*** hit enter to exit ***")
|
||||||
|
try:
|
||||||
|
input()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if ar.drd:
|
if ar.drd:
|
||||||
ar.dr = True
|
ar.dr = True
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
builds a fully standalone copyparty.exe compatible with 32bit win7-sp1 and later
|
builds copyparty32.exe, fully standalone, compatible with 32bit win7-sp1 and later
|
||||||
|
|
||||||
requires a win7 vm which has never been connected to the internet and a host-only network with the linux host at 192.168.123.1
|
requires a win7 vm which has never been connected to the internet and a host-only network with the linux host at 192.168.123.1
|
||||||
|
|
||||||
|
copyparty.exe is built by a win10-ltsc-2021 vm with similar setup
|
||||||
|
|
||||||
first-time setup steps in notes.txt
|
first-time setup steps in notes.txt
|
||||||
|
|
||||||
run build.sh in the vm to fetch src + compile + push a new exe to the linux host for manual publishing
|
run build.sh in the vm to fetch src + compile + push a new exe to the linux host for manual publishing
|
||||||
|
|
|
@ -9,6 +9,8 @@ tee build2.sh | cmp build.sh && rm build2.sh || {
|
||||||
[[ $r =~ [yY] ]] && mv build{2,}.sh && exec ./build.sh
|
[[ $r =~ [yY] ]] && mv build{2,}.sh && exec ./build.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
./up2k.sh
|
||||||
|
|
||||||
uname -s | grep WOW64 && m= || m=32
|
uname -s | grep WOW64 && m= || m=32
|
||||||
uname -s | grep NT-10 && w10=1 || w7=1
|
uname -s | grep NT-10 && w10=1 || w7=1
|
||||||
[ $w7 ] && pyv=37 || pyv=311
|
[ $w7 ] && pyv=37 || pyv=311
|
||||||
|
|
|
@ -7,6 +7,12 @@ adf0d23a98da38056de25e07e68921739173efc70fb9bf3f68d8c7c3d0d092e09efa69d35c0c9ecc
|
||||||
132a5380f33a245f2e744413a0e1090bc42b7356376de5121397cec5976b04b79f7c9ebe28af222c9c7b01461f7d7920810d220e337694727e0d7cd9e91fa667 pywin32_ctypes-0.2.0-py2.py3-none-any.whl
|
132a5380f33a245f2e744413a0e1090bc42b7356376de5121397cec5976b04b79f7c9ebe28af222c9c7b01461f7d7920810d220e337694727e0d7cd9e91fa667 pywin32_ctypes-0.2.0-py2.py3-none-any.whl
|
||||||
3c5adf0a36516d284a2ede363051edc1bcc9df925c5a8a9fa2e03cab579dd8d847fdad42f7fd5ba35992e08234c97d2dbfec40a9d12eec61c8dc03758f2bd88e typing_extensions-4.4.0-py3-none-any.whl
|
3c5adf0a36516d284a2ede363051edc1bcc9df925c5a8a9fa2e03cab579dd8d847fdad42f7fd5ba35992e08234c97d2dbfec40a9d12eec61c8dc03758f2bd88e typing_extensions-4.4.0-py3-none-any.whl
|
||||||
4b6e9ae967a769fe32be8cf0bc0d5a213b138d1e0344e97656d08a3d15578d81c06c45b334c872009db2db8f39db0c77c94ff6c35168d5e13801917667c08678 upx-4.0.2-win32.zip
|
4b6e9ae967a769fe32be8cf0bc0d5a213b138d1e0344e97656d08a3d15578d81c06c45b334c872009db2db8f39db0c77c94ff6c35168d5e13801917667c08678 upx-4.0.2-win32.zip
|
||||||
|
# up2k (win7)
|
||||||
|
a7d259277af4948bf960682bc9fb45a44b9ae9a19763c8a7c313cef4aa9ec2d447d843e4a7c409e9312c8c8f863a24487a8ee4ffa6891e9b1c4e111bb4723861 certifi-2022.12.7-py3-none-any.whl
|
||||||
|
2822c0dae180b1c8cfb7a70c8c00bad62af9afdbb18b656236680def9d3f1fcdcb8ef5eb64fc3b4c934385cd175ad5992a2284bcba78a243130de75b2d1650db charset_normalizer-3.1.0-cp37-cp37m-win32.whl
|
||||||
|
ffdd45326f4e91c02714f7a944cbcc2fdd09299f709cfa8aec0892053eef0134fb80d9ba3790afd319538a86feb619037cbf533e2f5939cb56b35bb17f56c858 idna-3.4-py3-none-any.whl
|
||||||
|
220e0e122d5851aaccf633224dd7fbd3ba8c8d2720944d8019d6a276ed818d83e3426fe21807f22d673b5428f19fcf9a6b4e645f69bbecd967c568bb6aeb7c8d requests-2.28.2-py3-none-any.whl
|
||||||
|
8770011f4ad1fe40a3062e6cdf1fda431530c59ee7de3fc5f8c57db54bfdb71c3aa220ca0e0bb1874fc6700e9ebb57defbae54ac84938bc9ad8f074910106681 urllib3-1.26.14-py2.py3-none-any.whl
|
||||||
# win7
|
# win7
|
||||||
91c025f7d94bcdf93df838fab67053165a414fc84e8496f92ecbb910dd55f6b6af5e360bbd051444066880c5a6877e75157bd95e150ead46e5c605930dfc50f2 future-0.18.2.tar.gz
|
91c025f7d94bcdf93df838fab67053165a414fc84e8496f92ecbb910dd55f6b6af5e360bbd051444066880c5a6877e75157bd95e150ead46e5c605930dfc50f2 future-0.18.2.tar.gz
|
||||||
c06b3295d1d0b0f0a6f9a6cd0be861b9b643b4a5ea37857f0bd41c45deaf27bb927b71922dab74e633e43d75d04a9bd0d1c4ad875569740b0f2a98dd2bfa5113 importlib_metadata-5.0.0-py3-none-any.whl
|
c06b3295d1d0b0f0a6f9a6cd0be861b9b643b4a5ea37857f0bd41c45deaf27bb927b71922dab74e633e43d75d04a9bd0d1c4ad875569740b0f2a98dd2bfa5113 importlib_metadata-5.0.0-py3-none-any.whl
|
||||||
|
|
|
@ -13,6 +13,13 @@ https://pypi.org/project/MarkupSafe/#files
|
||||||
https://pypi.org/project/mutagen/#files
|
https://pypi.org/project/mutagen/#files
|
||||||
https://pypi.org/project/Pillow/#files
|
https://pypi.org/project/Pillow/#files
|
||||||
|
|
||||||
|
# up2k (win7) additionals
|
||||||
|
https://pypi.org/project/certifi/#files
|
||||||
|
https://pypi.org/project/charset-normalizer/#files # cp37-cp37m-win32.whl
|
||||||
|
https://pypi.org/project/idna/#files
|
||||||
|
https://pypi.org/project/requests/#files
|
||||||
|
https://pypi.org/project/urllib3/#files
|
||||||
|
|
||||||
# win7 additionals
|
# win7 additionals
|
||||||
https://pypi.org/project/future/#files
|
https://pypi.org/project/future/#files
|
||||||
https://pypi.org/project/importlib-metadata/#files
|
https://pypi.org/project/importlib-metadata/#files
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
genico() {
|
||||||
|
|
||||||
# imagemagick png compression is broken, use pillow instead
|
# imagemagick png compression is broken, use pillow instead
|
||||||
convert ~/AndroidStudioProjects/PartyUP/metadata/en-US/images/icon.png a.bmp
|
convert $1 a.bmp
|
||||||
|
|
||||||
#convert a.bmp -trim -resize '48x48!' -strip a.png
|
#convert a.bmp -trim -resize '48x48!' -strip a.png
|
||||||
python3 <<'EOF'
|
python3 <<'EOF'
|
||||||
|
@ -17,11 +19,15 @@ EOF
|
||||||
pngquant --strip --quality 30 a.png
|
pngquant --strip --quality 30 a.png
|
||||||
mv a-*.png a.png
|
mv a-*.png a.png
|
||||||
|
|
||||||
python3 <<'EOF'
|
python3 <<EOF
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
Image.open('a.png').save('loader.ico',sizes=[(48,48)])
|
Image.open('a.png').save('$2',sizes=[(48,48)])
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm a.{bmp,png}
|
rm a.{bmp,png}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
genico ~/AndroidStudioProjects/PartyUP/metadata/en-US/images/icon.png loader.ico
|
||||||
|
genico https://raw.githubusercontent.com/googlefonts/noto-emoji/main/png/512/emoji_u1f680.png up2k.ico
|
||||||
ls -al
|
ls -al
|
||||||
exit 0
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ VSVersionInfo(
|
||||||
StringTable(
|
StringTable(
|
||||||
'000004b0',
|
'000004b0',
|
||||||
[StringStruct('CompanyName', 'ocv.me'),
|
[StringStruct('CompanyName', 'ocv.me'),
|
||||||
StringStruct('FileDescription', 'copyparty'),
|
StringStruct('FileDescription', 'copyparty file server'),
|
||||||
StringStruct('FileVersion', '1.2.3'),
|
StringStruct('FileVersion', '1.2.3'),
|
||||||
StringStruct('InternalName', 'copyparty'),
|
StringStruct('InternalName', 'copyparty'),
|
||||||
StringStruct('LegalCopyright', '2019, ed'),
|
StringStruct('LegalCopyright', '2019, ed'),
|
||||||
|
|
|
@ -27,6 +27,13 @@ fns=(
|
||||||
Pillow-9.4.0-cp311-cp311-win_amd64.whl
|
Pillow-9.4.0-cp311-cp311-win_amd64.whl
|
||||||
python-3.11.2-amd64.exe
|
python-3.11.2-amd64.exe
|
||||||
}
|
}
|
||||||
|
[ $w7 ] && fns+=(
|
||||||
|
certifi-2022.12.7-py3-none-any.whl
|
||||||
|
chardet-5.1.0-py3-none-any.whl
|
||||||
|
idna-3.4-py3-none-any.whl
|
||||||
|
requests-2.28.2-py3-none-any.whl
|
||||||
|
urllib3-1.26.14-py2.py3-none-any.whl
|
||||||
|
)
|
||||||
[ $w7 ] && fns+=(
|
[ $w7 ] && fns+=(
|
||||||
future-0.18.2.tar.gz
|
future-0.18.2.tar.gz
|
||||||
importlib_metadata-5.0.0-py3-none-any.whl
|
importlib_metadata-5.0.0-py3-none-any.whl
|
||||||
|
@ -58,28 +65,32 @@ manually install:
|
||||||
|
|
||||||
===[ copy-paste into git-bash ]================================
|
===[ copy-paste into git-bash ]================================
|
||||||
uname -s | grep NT-10 && w10=1 || w7=1
|
uname -s | grep NT-10 && w10=1 || w7=1
|
||||||
|
[ $w7 ] && pyv=37 || pyv=311
|
||||||
|
appd=$(cygpath.exe "$APPDATA")
|
||||||
cd ~/Downloads &&
|
cd ~/Downloads &&
|
||||||
unzip upx-*-win32.zip &&
|
unzip upx-*-win32.zip &&
|
||||||
mv upx-*/upx.exe . &&
|
mv upx-*/upx.exe . &&
|
||||||
python -m ensurepip &&
|
python -m ensurepip &&
|
||||||
python -m pip install --user -U pip-*.whl &&
|
python -m pip install --user -U pip-*.whl &&
|
||||||
{ [ $w7 ] || python -m pip install --user -U mutagen-*.whl Pillow-*.whl; } &&
|
{ [ $w7 ] || python -m pip install --user -U mutagen-*.whl Pillow-*.whl; } &&
|
||||||
|
{ [ $w10 ] || python -m pip install --user -U {requests,urllib3,charset_normalizer,certifi,idna}-*.whl; } &&
|
||||||
{ [ $w10 ] || python -m pip install --user -U future-*.tar.gz importlib_metadata-*.whl typing_extensions-*.whl zipp-*.whl; } &&
|
{ [ $w10 ] || python -m pip install --user -U future-*.tar.gz importlib_metadata-*.whl typing_extensions-*.whl zipp-*.whl; } &&
|
||||||
python -m pip install --user -U pyinstaller-*.whl pefile-*.whl pywin32_ctypes-*.whl pyinstaller_hooks_contrib-*.whl altgraph-*.whl &&
|
python -m pip install --user -U pyinstaller-*.whl pefile-*.whl pywin32_ctypes-*.whl pyinstaller_hooks_contrib-*.whl altgraph-*.whl &&
|
||||||
|
sed -ri 's/--lzma/--best/' $appd/Python/Python$pyv/site-packages/pyinstaller/building/utils.py &&
|
||||||
|
curl -fkLO https://192.168.123.1:3923/cpp/scripts/uncomment.py &&
|
||||||
|
python uncomment.py $(for d in $appd/Python/Python$pyv/site-packages/{requests,urllib3,charset_normalizer,certifi,idna}; do find $d -name \*.py; done) &&
|
||||||
cd &&
|
cd &&
|
||||||
rm -f build.sh &&
|
rm -f build.sh &&
|
||||||
curl -fkLO https://192.168.123.1:3923/cpp/scripts/pyinstaller/build.sh &&
|
curl -fkLO https://192.168.123.1:3923/cpp/scripts/pyinstaller/build.sh &&
|
||||||
|
curl -fkLO https://192.168.123.1:3923/cpp/scripts/pyinstaller/up2k.sh &&
|
||||||
echo ok
|
echo ok
|
||||||
# python -m pip install --user -U Pillow-9.2.0-cp37-cp37m-win32.whl
|
# python -m pip install --user -U Pillow-9.2.0-cp37-cp37m-win32.whl
|
||||||
# sed -ri 's/, bestopt, /]+bestopt+[/' $APPDATA/Python/Python37/site-packages/pyinstaller/building/utils.py
|
# sed -ri 's/, bestopt, /]+bestopt+[/' $APPDATA/Python/Python37/site-packages/pyinstaller/building/utils.py
|
||||||
# sed -ri 's/(^\s+bestopt = ).*/\1["--best","--lzma","--ultra-brute"]/' $APPDATA/Python/Python37/site-packages/pyinstaller/building/utils.py
|
# sed -ri 's/(^\s+bestopt = ).*/\1["--best","--lzma","--ultra-brute"]/' $APPDATA/Python/Python37/site-packages/pyinstaller/building/utils.py
|
||||||
|
|
||||||
===[ win10: copy-paste into git-bash ]=========================
|
===[ win10: copy-paste into git-bash ]=========================
|
||||||
appd=$(cygpath.exe "$APPDATA")
|
|
||||||
curl -fkLO https://192.168.123.1:3923/cpp/scripts/uncomment.py &&
|
|
||||||
#for f in $appd/Python/Python311/site-packages/mutagen/*.py; do awk -i inplace '/^\s*def _?(save|write)/{sub(/d.*/," ");s=$0;ns=length(s)} ns&&/[^ ]/&&substr($0,0,ns)!=s{ns=0} !ns' "$f"; done &&
|
#for f in $appd/Python/Python311/site-packages/mutagen/*.py; do awk -i inplace '/^\s*def _?(save|write)/{sub(/d.*/," ");s=$0;ns=length(s)} ns&&/[^ ]/&&substr($0,0,ns)!=s{ns=0} !ns' "$f"; done &&
|
||||||
python uncomment.py $appd/Python/Python311/site-packages/{mutagen,PIL,jinja2,markupsafe}/*.py &&
|
python uncomment.py $appd/Python/Python311/site-packages/{mutagen,PIL,jinja2,markupsafe}/*.py &&
|
||||||
sed -ri 's/--lzma/--best/' $APPDATA/Python/Python311/site-packages/pyinstaller/building/utils.py &&
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
|
|
||||||
|
|
29
scripts/pyinstaller/up2k.rc
Normal file
29
scripts/pyinstaller/up2k.rc
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# UTF-8
|
||||||
|
VSVersionInfo(
|
||||||
|
ffi=FixedFileInfo(
|
||||||
|
filevers=(1,2,3,0),
|
||||||
|
prodvers=(1,2,3,0),
|
||||||
|
mask=0x3f,
|
||||||
|
flags=0x0,
|
||||||
|
OS=0x4,
|
||||||
|
fileType=0x1,
|
||||||
|
subtype=0x0,
|
||||||
|
date=(0, 0)
|
||||||
|
),
|
||||||
|
kids=[
|
||||||
|
StringFileInfo(
|
||||||
|
[
|
||||||
|
StringTable(
|
||||||
|
'000004b0',
|
||||||
|
[StringStruct('CompanyName', 'ocv.me'),
|
||||||
|
StringStruct('FileDescription', 'up2k uploader / filesearch command'),
|
||||||
|
StringStruct('FileVersion', '1.2.3'),
|
||||||
|
StringStruct('InternalName', 'up2k'),
|
||||||
|
StringStruct('LegalCopyright', '2019, ed'),
|
||||||
|
StringStruct('OriginalFilename', 'up2k.exe'),
|
||||||
|
StringStruct('ProductName', 'up2k client'),
|
||||||
|
StringStruct('ProductVersion', '1.2.3')])
|
||||||
|
]),
|
||||||
|
VarFileInfo([VarStruct('Translation', [0, 1200])])
|
||||||
|
]
|
||||||
|
)
|
48
scripts/pyinstaller/up2k.sh
Normal file
48
scripts/pyinstaller/up2k.sh
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
curl -k https://192.168.123.1:3923/cpp/scripts/pyinstaller/up2k.sh |
|
||||||
|
tee up2k2.sh | cmp up2k.sh && rm up2k2.sh || {
|
||||||
|
[ -s up2k2.sh ] || exit 1
|
||||||
|
echo "new up2k script; upgrade y/n:"
|
||||||
|
while true; do read -u1 -n1 -r r; [[ $r =~ [yYnN] ]] && break; done
|
||||||
|
[[ $r =~ [yY] ]] && mv up2k{2,}.sh && exec ./up2k.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
uname -s | grep -E 'WOW64|NT-10' && echo need win7-32 && exit 1
|
||||||
|
|
||||||
|
dl() { curl -fkLO "$1"; }
|
||||||
|
cd ~/Downloads
|
||||||
|
|
||||||
|
dl https://192.168.123.1:3923/cpp/bin/up2k.py
|
||||||
|
dl https://192.168.123.1:3923/cpp/scripts/pyinstaller/up2k.ico
|
||||||
|
dl https://192.168.123.1:3923/cpp/scripts/pyinstaller/up2k.rc
|
||||||
|
dl https://192.168.123.1:3923/cpp/scripts/pyinstaller/up2k.spec
|
||||||
|
|
||||||
|
# $LOCALAPPDATA/programs/python/python37-32/python -m pip install --user -U pyinstaller requests
|
||||||
|
|
||||||
|
grep -E '^from .ssl_ import' $APPDATA/python/python37/site-packages/urllib3/util/proxy.py && {
|
||||||
|
echo golfing
|
||||||
|
echo > $APPDATA/python/python37/site-packages/requests/certs.py
|
||||||
|
sed -ri 's/^(DEFAULT_CA_BUNDLE_PATH = ).*/\1""/' $APPDATA/python/python37/site-packages/requests/utils.py
|
||||||
|
sed -ri '/^import zipfile$/d' $APPDATA/python/python37/site-packages/requests/utils.py
|
||||||
|
sed -ri 's/"idna"//' $APPDATA/python/python37/site-packages/requests/packages.py
|
||||||
|
sed -ri 's/import charset_normalizer.*/pass/' $APPDATA/python/python37/site-packages/requests/compat.py
|
||||||
|
sed -ri 's/raise.*charset_normalizer.*/pass/' $APPDATA/python/python37/site-packages/requests/__init__.py
|
||||||
|
sed -ri 's/import charset_normalizer.*//' $APPDATA/python/python37/site-packages/requests/packages.py
|
||||||
|
sed -ri 's/chardet.__name__/"\\roll\\tide"/' $APPDATA/python/python37/site-packages/requests/packages.py
|
||||||
|
sed -ri 's/chardet,//' $APPDATA/python/python37/site-packages/requests/models.py
|
||||||
|
for n in util/__init__.py connection.py; do awk -i inplace '/^from (\.util)?\.ssl_ /{s=1} !s; /^\)/{s=0}' $APPDATA/python/python37/site-packages/urllib3/$n; done
|
||||||
|
sed -ri 's/^from .ssl_ import .*//' $APPDATA/python/python37/site-packages/urllib3/util/proxy.py
|
||||||
|
echo golfed
|
||||||
|
}
|
||||||
|
|
||||||
|
read a b _ < <(awk -F\" '/^S_VERSION =/{$0=$2;sub(/\./," ");print}' < up2k.py)
|
||||||
|
sed -r 's/1,2,3,0/'$a,$b,0,0'/;s/1\.2\.3/'$a.$b.0/ <up2k.rc >up2k.rc2
|
||||||
|
|
||||||
|
#python uncomment.py up2k.py
|
||||||
|
$APPDATA/python/python37/scripts/pyinstaller -y --clean --upx-dir=. up2k.spec
|
||||||
|
|
||||||
|
./dist/up2k.exe --version
|
||||||
|
|
||||||
|
curl -fkT dist/up2k.exe -HPW:wark https://192.168.123.1:3923/
|
78
scripts/pyinstaller/up2k.spec
Normal file
78
scripts/pyinstaller/up2k.spec
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['up2k.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[
|
||||||
|
'ftplib',
|
||||||
|
'lzma',
|
||||||
|
'pickle',
|
||||||
|
'ssl',
|
||||||
|
'tarfile',
|
||||||
|
'bz2',
|
||||||
|
'zipfile',
|
||||||
|
'tracemalloc',
|
||||||
|
'zlib',
|
||||||
|
'urllib3.util.ssl_',
|
||||||
|
'urllib3.contrib.pyopenssl',
|
||||||
|
'urllib3.contrib.socks',
|
||||||
|
'certifi',
|
||||||
|
'idna',
|
||||||
|
'chardet',
|
||||||
|
'charset_normalizer',
|
||||||
|
'email.contentmanager',
|
||||||
|
'email.policy',
|
||||||
|
'encodings.zlib_codec',
|
||||||
|
'encodings.base64_codec',
|
||||||
|
'encodings.bz2_codec',
|
||||||
|
'encodings.charmap',
|
||||||
|
'encodings.hex_codec',
|
||||||
|
'encodings.palmos',
|
||||||
|
'encodings.punycode',
|
||||||
|
'encodings.rot_13',
|
||||||
|
],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# this is the only change to the autogenerated specfile:
|
||||||
|
xdll = ["libcrypto-1_1.dll"]
|
||||||
|
a.binaries = TOC([x for x in a.binaries if x[0] not in xdll])
|
||||||
|
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='up2k',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
version='up2k.rc2',
|
||||||
|
icon=['up2k.ico'],
|
||||||
|
)
|
14
scripts/pyinstaller/up2k.spec.sh
Normal file
14
scripts/pyinstaller/up2k.spec.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# grep '">encodings.cp' C:/Users/ed/dev/copyparty/bin/dist/xref-up2k.html | sed -r 's/.*encodings.cp//;s/<.*//' | sort -n | uniq | tr '\n' ,
|
||||||
|
# grep -i encodings -A1 build/up2k/xref-up2k.html | sed -r 's/.*(Missing|Excluded)Module.*//' | grep moduletype -B1 | grep -v moduletype
|
||||||
|
|
||||||
|
ex=(
|
||||||
|
ftplib lzma pickle ssl tarfile bz2 zipfile tracemalloc zlib
|
||||||
|
urllib3.util.ssl_ urllib3.contrib.pyopenssl urllib3.contrib.socks certifi idna chardet charset_normalizer
|
||||||
|
email.contentmanager email.policy
|
||||||
|
encodings.{zlib_codec,base64_codec,bz2_codec,charmap,hex_codec,palmos,punycode,rot_13}
|
||||||
|
);
|
||||||
|
cex=(); for a in "${ex[@]}"; do cex+=(--exclude "$a"); done
|
||||||
|
$APPDATA/python/python37/scripts/pyi-makespec --version-file up2k.rc2 -i up2k.ico -n up2k -c -F up2k.py "${cex[@]}"
|
Loading…
Reference in a new issue