From 7c0c6b94a3c75b81222d795b45e959717ba05e16 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 11 Nov 2023 17:20:00 +0000 Subject: [PATCH] drop asyncore; pyftpdlib has vendored it --- docs/lics.txt | 4 ---- scripts/make-sfx.sh | 28 +++++++++------------------- scripts/sfx.ls | 3 --- scripts/uncomment.py | 13 ++++++------- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/docs/lics.txt b/docs/lics.txt index ec7d6e28..bc155584 100644 --- a/docs/lics.txt +++ b/docs/lics.txt @@ -28,10 +28,6 @@ https://github.com/nayuki/QR-Code-generator/ C: Project Nayuki L: MIT -https://github.com/python/cpython/blob/3.10/Lib/asyncore.py -C: 1996 Sam Rushing -L: ISC - https://github.com/ahupp/python-magic/ C: 2001-2014 Adam Hupp L: MIT diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh index cc4606be..c05dfa24 100755 --- a/scripts/make-sfx.sh +++ b/scripts/make-sfx.sh @@ -205,26 +205,22 @@ necho() { mv {markupsafe,jinja2} j2/ necho collecting pyftpdlib - f="../build/pyftpdlib-1.5.8.tar.gz" + f="../build/pyftpdlib-1.5.9.tar.gz" [ -e "$f" ] || - (url=https://github.com/giampaolo/pyftpdlib/archive/refs/tags/release-1.5.8.tar.gz; + (url=https://github.com/giampaolo/pyftpdlib/archive/refs/tags/release-1.5.9.tar.gz; wget -O$f "$url" || curl -L "$url" >$f) tar -zxf $f mv pyftpdlib-release-*/pyftpdlib . rm -rf pyftpdlib-release-* pyftpdlib/test + for f in pyftpdlib/_async{hat,ore}.py; do + [ -e "$f" ] || continue; + iawk 'NR<4||NR>27||!/^#/;NR==4{print"# license: https://opensource.org/licenses/ISC\n"}' $f + done mkdir ftp/ mv pyftpdlib ftp/ - necho collecting asyncore, asynchat - for n in asyncore.py asynchat.py; do - f=../build/$n - [ -e "$f" ] || - (url=https://raw.githubusercontent.com/python/cpython/c4d45ee670c09d4f6da709df072ec80cb7dfad22/Lib/$n; - wget -O$f "$url" || curl -L "$url" >$f) - done - necho collecting python-magic v=0.4.27 f="../build/python-magic-$v.tar.gz" @@ -293,12 +289,6 @@ necho() { (cd "${x%/*}"; cp -p "../$(cat "${x##*/}")" ${x##*/}) done - # insert asynchat - mkdir copyparty/vend - for n in asyncore.py asynchat.py; do - awk 'NR<4||NR>27;NR==4{print"# license: https://opensource.org/licenses/ISC\n"}' ../build/$n >copyparty/vend/$n - done - rm -f copyparty/stolen/*/README.md # remove type hints before build instead @@ -419,7 +409,7 @@ iawk '/^ {0,4}[^ ]/{s=0}/^ {4}def (serve_forever|_loop)/{s=1}!s' ftp/pyftpdlib/s rm -f ftp/pyftpdlib/{__main__,prefork}.py [ $no_ftp ] && - rm -rf copyparty/ftpd.py ftp asyncore.py asynchat.py && + rm -rf copyparty/ftpd.py ftp && sed -ri '/\.ftp/d' copyparty/svchub.py [ $no_smb ] && @@ -576,8 +566,8 @@ nf=$(ls -1 "$zdir"/arc.* 2>/dev/null | wc -l) cat ../$bdir/COPYING.txt) >> copyparty/res/COPYING.txt || echo "copying.txt 404 pls rebuild" - mv ftp/* j2/* copyparty/vend/* . - rm -rf ftp j2 py2 py37 copyparty/vend + mv ftp/* j2/* . + rm -rf ftp j2 py2 py37 (cd copyparty; tar -cvf z.tar $t; rm -rf $t) cd .. pyoxidizer build --release --target-triple $tgt diff --git a/scripts/sfx.ls b/scripts/sfx.ls index 8f522a2e..e21fec23 100644 --- a/scripts/sfx.ls +++ b/scripts/sfx.ls @@ -59,9 +59,6 @@ copyparty/th_srv.py, copyparty/u2idx.py, copyparty/up2k.py, copyparty/util.py, -copyparty/vend, -copyparty/vend/asynchat.py, -copyparty/vend/asyncore.py, copyparty/web, copyparty/web/a, copyparty/web/a/__init__.py, diff --git a/scripts/uncomment.py b/scripts/uncomment.py index e0c07b1d..273db5ea 100644 --- a/scripts/uncomment.py +++ b/scripts/uncomment.py @@ -16,16 +16,11 @@ def uncomment(fpath): orig = f.read().decode("utf-8") out = "" - for ln in orig.split("\n"): - if not ln.startswith("#"): - break - - out += ln + "\n" - io_obj = io.StringIO(orig) prev_toktype = tokenize.INDENT last_lineno = -1 last_col = 0 + code = False for tok in tokenize.generate_tokens(io_obj.readline): # print(repr(tok)) token_type = tok[0] @@ -53,7 +48,11 @@ def uncomment(fpath): out += token_string else: out += '"a"' - elif token_type != tokenize.COMMENT or is_legalese: + elif token_type != tokenize.COMMENT: + out += token_string + if not code and token_string.strip(): + code = True + elif is_legalese or (not start_col and not code): out += token_string else: if out.rstrip(" ").endswith("\n"):