Here a we go

This commit is contained in:
firestar5683
2026-08-17 06:36:55 -05:00
parent b567d9fc90
commit 161ecbc1ab
16 changed files with 311 additions and 29 deletions
+5 -1
View File
@@ -21,6 +21,10 @@ def copy(src, dest):
shutil.copy2(src, dest, follow_symlinks=True)
def ignore_broken_symlinks(src, names):
return [name for name in names if Path(src, name).is_symlink() and not Path(src, name).exists()]
if __name__ == '__main__':
parser = ArgumentParser(prog='pack.py', description="package script into a portable executable", epilog='comma.ai')
parser.add_argument('-e', '--entrypoint', help="function to call in module, default is 'main'", default='main')
@@ -43,7 +47,7 @@ if __name__ == '__main__':
with tempfile.TemporaryDirectory() as tmp:
for directory in DIRS:
shutil.copytree(BASEDIR + '/' + directory, tmp + '/' + directory, symlinks=False, ignore_dangling_symlinks=True,
shutil.copytree(BASEDIR + '/' + directory, tmp + '/' + directory, symlinks=False, ignore=ignore_broken_symlinks,
dirs_exist_ok=True, copy_function=copy)
entry = f'{args.module}:{args.entrypoint}'
zipapp.create_archive(tmp, target=args.output, interpreter=INTERPRETER, main=entry)