(zf, path, zippath)
| 2407 | files = args.create |
| 2408 | |
| 2409 | def addToZip(zf, path, zippath): |
| 2410 | if os.path.isfile(path): |
| 2411 | zf.write(path, zippath, ZIP_DEFLATED) |
| 2412 | elif os.path.isdir(path): |
| 2413 | if zippath: |
| 2414 | zf.write(path, zippath) |
| 2415 | for nm in sorted(os.listdir(path)): |
| 2416 | addToZip(zf, |
| 2417 | os.path.join(path, nm), os.path.join(zippath, nm)) |
| 2418 | # else: ignore |
| 2419 | |
| 2420 | with ZipFile(zip_name, 'w') as zf: |
| 2421 | for path in files: |