mirror of
https://github.com/9001/copyparty.git
synced 2025-10-10 02:22:21 -06:00
unvendorable surrogateescape (#887);
stolen/surrogateescape.py can be deleted; this file is only necessary for python2 compatibility
This commit is contained in:
parent
39bd4e5b58
commit
aace711eb9
|
@ -55,7 +55,6 @@ from .__init__ import (
|
|||
unicode,
|
||||
)
|
||||
from .__version__ import S_BUILD_DT, S_VERSION
|
||||
from .stolen import surrogateescape
|
||||
|
||||
try:
|
||||
from datetime import datetime, timezone
|
||||
|
@ -81,6 +80,9 @@ except:
|
|||
|
||||
if PY2:
|
||||
range = xrange # type: ignore
|
||||
from .stolen import surrogateescape
|
||||
|
||||
surrogateescape.register_surrogateescape()
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7) or (
|
||||
|
@ -293,7 +295,6 @@ RE_MEMAVAIL = re.compile("^MemAvailable:.* kB")
|
|||
BOS_SEP = ("%s" % (os.sep,)).encode("ascii")
|
||||
|
||||
|
||||
surrogateescape.register_surrogateescape()
|
||||
if WINDOWS and PY2:
|
||||
FS_ENCODING = "utf-8"
|
||||
else:
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
#!/bin/ash
|
||||
set -ex
|
||||
|
||||
tmv() {
|
||||
touch -r "$1" t
|
||||
mv t "$1"
|
||||
}
|
||||
iawk() {
|
||||
awk "$1" <"$2" >t
|
||||
tmv "$2"
|
||||
}
|
||||
ised() {
|
||||
sed -r "$1" <"$2" >t
|
||||
tmv "$2"
|
||||
}
|
||||
|
||||
# use zlib-ng if available
|
||||
f=/z/base/zlib_ng-0.5.1-cp312-cp312-linux_$(cat /etc/apk/arch).whl
|
||||
[ "$1" != min ] && [ -e $f ] && {
|
||||
|
@ -38,8 +51,13 @@ rm -rf \
|
|||
/tmp/pe-* /z/copyparty-sfx.py \
|
||||
ensurepip pydoc_data turtle.py turtledemo lib2to3
|
||||
|
||||
cd /usr/lib/python3.*/site-packages/copyparty/
|
||||
rm stolen/surrogateescape.py
|
||||
iawk '/^[^ ]/{s=0}/^if not VENDORED:/{s=1}!s' qrkode.py
|
||||
iawk '/^[^ ]/{s=0}/^ DNS_VND = False/{s=1;print" raise"}!s' mdns.py
|
||||
|
||||
# speedhack
|
||||
sed -ri 's/os.environ.get\("PRTY_NO_IMPRESO"\)/"1"/' /usr/lib/python3.*/site-packages/copyparty/util.py
|
||||
ised 's/os.environ.get\("PRTY_NO_IMPRESO"\)/"1"/' util.py
|
||||
|
||||
# drop bytecode
|
||||
find / -xdev -name __pycache__ -print0 | xargs -0 rm -rf
|
||||
|
|
Loading…
Reference in a new issue