This commit is contained in:
ed 2021-07-24 22:20:02 +02:00
parent d020527c6f
commit 05a1a31cab
5 changed files with 12 additions and 14 deletions

View file

@ -381,7 +381,7 @@ def main(argv=None):
nstrs = []
anymod = False
for ostr in al.v:
for ostr in al.v or []:
mod = False
oa = ostr.split(":")
na = oa[:2]

View file

@ -10,8 +10,8 @@ from . import path
# printf 'os\.(%s)' "$(grep ^def bos/__init__.py | gsed -r 's/^def //;s/\(.*//' | tr '\n' '|' | gsed -r 's/.$//')"
def chmod(p, mode, follow_symlinks=True):
return os.chmod(fsenc(p), mode, follow_symlinks=follow_symlinks)
def chmod(p, mode):
return os.chmod(fsenc(p), mode)
def listdir(p="."):
@ -22,8 +22,8 @@ def lstat(p):
return os.lstat(fsenc(p))
def makedirs(name, mode=0o755, exist_ok=None):
return os.makedirs(fsenc(name), mode=mode, exist_ok=exist_ok)
def makedirs(name, mode=0o755):
return os.makedirs(fsenc(name), mode=mode)
def mkdir(p, mode=0o755):
@ -42,13 +42,13 @@ def rmdir(p):
return os.rmdir(fsenc(p))
def stat(p, follow_symlinks=True):
return os.stat(fsenc(p), follow_symlinks=follow_symlinks)
def stat(p):
return os.stat(fsenc(p))
def unlink(p):
return os.unlink(fsenc(p))
def utime(p, times=None, follow_symlinks=True):
return os.utime(fsenc(p), times, follow_symlinks=follow_symlinks)
def utime(p, times=None):
return os.utime(fsenc(p), times)

View file

@ -308,7 +308,7 @@ class HttpSrv(object):
try:
with os.scandir(os.path.join(E.mod, "web")) as dh:
for fh in dh:
inf = fh.stat(follow_symlinks=False)
inf = fh.stat()
v = max(v, inf.st_mtime)
except:
pass

View file

@ -1283,9 +1283,7 @@ class Up2k(object):
ptop = vn.realpath
atop = vn.canonical(rem)
adir, fn = os.path.split(atop)
fun = bos.lstat if os.supports_follow_symlinks else bos.stat
st = fun(atop)
st = bos.lstat(atop)
if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode):
g = [[os.path.dirname(vpath), adir, [[fn, 0]], [], []]]
else:

View file

@ -1034,11 +1034,11 @@ def sendfile_kern(lower, upper, f, s):
def statdir(logger, scandir, lstat, top):
lstat = lstat and os.supports_follow_symlinks
try:
btop = fsenc(top)
if scandir and hasattr(os, "scandir"):
src = "scandir"
lstat = lstat and os.supports_follow_symlinks
with os.scandir(btop) as dh:
for fh in dh:
try: