sfx: prefer system pyftpdlib if available

This commit is contained in:
ed 2022-02-13 21:00:13 +01:00
parent 6e14cd2c39
commit 39e7a7a231

View file

@ -368,8 +368,9 @@ def confirm(rv):
sys.exit(rv or 1) sys.exit(rv or 1)
def run(tmp, j2): def run(tmp, j2, ftp):
msg("jinja2:", j2 or "bundled") msg("jinja2:", j2 or "bundled")
msg("pyftpd:", ftp or "bundled")
msg("sfxdir:", tmp) msg("sfxdir:", tmp)
msg() msg()
@ -387,9 +388,8 @@ def run(tmp, j2):
t.daemon = True t.daemon = True
t.start() t.start()
ld = [os.path.join(tmp, x) for x in ["", "dep-ftp", "dep-j2"]] ld = (("", ""), (j2, "dep-j2"), (ftp, "dep-ftp"))
if j2: ld = [os.path.join(tmp, b) for a, b in ld if not a]
del ld[-1]
if any([re.match(r"^-.*j[0-9]", x) for x in sys.argv]): if any([re.match(r"^-.*j[0-9]", x) for x in sys.argv]):
run_s(ld) run_s(ld)
@ -462,7 +462,12 @@ def main():
j2 = None j2 = None
try: try:
run(tmp, j2) from pyftpdlib.__init__ import __ver__ as ftp
except:
ftp = None
try:
run(tmp, j2, ftp)
except SystemExit as ex: except SystemExit as ex:
c = ex.code c = ex.code
if c not in [0, -15]: if c not in [0, -15]: