dist: strip some pointless code

This commit is contained in:
ed 2024-10-01 18:35:36 +00:00
parent 44f2b63e43
commit f1646b96ca
5 changed files with 26 additions and 3 deletions

View file

@ -363,8 +363,10 @@ class Gateway(object):
ctype = r.getheader("Content-Type", "") ctype = r.getheader("Content-Type", "")
if ctype == "application/json": if ctype == "application/json":
parser = self.parse_jls parser = self.parse_jls
# !rm.yes>
elif ctype.startswith("text/html"): elif ctype.startswith("text/html"):
parser = self.parse_html parser = self.parse_html
# !rm.no>
else: else:
info("listdir on file (%s): %r", ctype, path) info("listdir on file (%s): %r", ctype, path)
raise FuseOSError(errno.ENOENT) raise FuseOSError(errno.ENOENT)
@ -418,6 +420,7 @@ class Gateway(object):
return ret return ret
# !rm.yes>
def parse_html(self, sck): def parse_html(self, sck):
ret = {} ret = {}
rem = b"" rem = b""
@ -465,6 +468,7 @@ class Gateway(object):
ret[fname] = self.stat_dir(ts, sz) ret[fname] = self.stat_dir(ts, sz)
return ret return ret
# !rm.no>
def stat_dir(self, ts, sz=4096): def stat_dir(self, ts, sz=4096):
return { return {
@ -548,6 +552,7 @@ class CPPF(Operations):
break break
return None return None
# !rm.yes>
""" """
,-------------------------------, g1>=c1, g2<=c2 ,-------------------------------, g1>=c1, g2<=c2
|cache1 cache2| buf[g1-c1:(g1-c1)+(g2-g1)] |cache1 cache2| buf[g1-c1:(g1-c1)+(g2-g1)]
@ -572,6 +577,7 @@ class CPPF(Operations):
|get1 get2| |get1 get2|
`---------------' `---------------'
""" """
# !rm.no>
def get_cached_file(self, path, get1, get2, file_sz): def get_cached_file(self, path, get1, get2, file_sz):
car = None car = None
@ -802,6 +808,7 @@ class CPPF(Operations):
return ret return ret
# !rm.yes>
fn = "cppf-{}-{}-{}".format(time.time(), offset, length) fn = "cppf-{}-{}-{}".format(time.time(), offset, length)
if False: if False:
with open(fn, "wb", len(ret)) as f: with open(fn, "wb", len(ret)) as f:
@ -824,6 +831,7 @@ class CPPF(Operations):
raise Exception("cache bork") raise Exception("cache bork")
return ret return ret
# !rm.no>
def getattr(self, path, fh=None): def getattr(self, path, fh=None):
dbg("getattr %r", path) dbg("getattr %r", path)
@ -871,6 +879,7 @@ class CPPF(Operations):
releasedir = None releasedir = None
statfs = None statfs = None
# !rm.yes>
if False: if False:
# incorrect semantics but good for debugging stuff like samba and msys2 # incorrect semantics but good for debugging stuff like samba and msys2
def access(self, path, mode): def access(self, path, mode):
@ -908,6 +917,7 @@ class CPPF(Operations):
def statfs(self, path): def statfs(self, path):
dbg("@@ statfs [{}]".format(path)) dbg("@@ statfs [{}]".format(path))
return {} return {}
# !rm.no>
if sys.platform == "win32": if sys.platform == "win32":
# quick compat for /mingw64/bin/python3 (msys2) # quick compat for /mingw64/bin/python3 (msys2)

View file

@ -73,6 +73,7 @@ web/deps/busy.mp3
web/deps/easymde.css web/deps/easymde.css
web/deps/easymde.js web/deps/easymde.js
web/deps/marked.js web/deps/marked.js
web/deps/fuse.py
web/deps/mini-fa.css web/deps/mini-fa.css
web/deps/mini-fa.woff web/deps/mini-fa.woff
web/deps/prism.css web/deps/prism.css

View file

@ -761,6 +761,7 @@ class _Unrecv(object):
self.buf = buf + self.buf self.buf = buf + self.buf
# !rm.yes>
class _LUnrecv(object): class _LUnrecv(object):
""" """
with expensive debug logging with expensive debug logging
@ -815,6 +816,7 @@ class _LUnrecv(object):
self.buf = buf + self.buf self.buf = buf + self.buf
t = "\033[0;7mur:push\033[0;1;31m {}\n\033[0;7mur:rem:\033[0;1;35m {}\033[0m" t = "\033[0;7mur:push\033[0;1;31m {}\n\033[0;7mur:rem:\033[0;1;35m {}\033[0m"
print(t.format(buf, self.buf)) print(t.format(buf, self.buf))
# !rm.no>
Unrecv = _Unrecv Unrecv = _Unrecv

View file

@ -27,14 +27,14 @@ help() { exec cat <<'EOF'
# #
# `no-ftp` saves ~30k by removing the ftp server, disabling --ftp # `no-ftp` saves ~30k by removing the ftp server, disabling --ftp
# #
# `no-pf` saves ~12k by removing the option to download partyfuse
#
# `no-tfp` saves ~10k by removing the tftp server, disabling --tftp # `no-tfp` saves ~10k by removing the tftp server, disabling --tftp
# #
# `no-zm` saves ~7k by removing the zeroconf mDNS server # `no-zm` saves ~7k by removing the zeroconf mDNS server
# #
# `no-smb` saves ~3.5k by removing the smb / cifs server # `no-smb` saves ~3.5k by removing the smb / cifs server
# #
# `no-pf` saves ~2.8k by removing the option to download partyfuse
#
# _____________________________________________________________________ # _____________________________________________________________________
# web features: # web features:
# #
@ -109,7 +109,7 @@ pybin=$(command -v python3 || command -v python) || {
langs= langs=
use_gz= use_gz=
zopf=2560 zopf=2000
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
case $1 in case $1 in
clean) clean=1 ; ;; clean) clean=1 ; ;;

View file

@ -61,11 +61,21 @@ def uh2(fp):
# remove expensive imports too # remove expensive imports too
lns = [] lns = []
on = True on = True
on2 = True
for ln in cs.split("\n"): for ln in cs.split("\n"):
if ln.startswith("if True:"): if ln.startswith("if True:"):
on = False on = False
continue continue
if ln.endswith("# !rm.yes>"):
on2 = False
continue
if not on2:
if ln.endswith("# !rm.no>"):
on2 = True
continue
if not on and (not ln.strip() or ln.startswith(" ")): if not on and (not ln.strip() or ln.startswith(" ")):
continue continue