(zf, path, zippath)
| 2565 | files = args.create |
| 2566 | |
| 2567 | def addToZip(zf, path, zippath): |
| 2568 | if os.path.isfile(path): |
| 2569 | zf.write(path, zippath, ZIP_DEFLATED) |
| 2570 | elif os.path.isdir(path): |
| 2571 | if zippath: |
| 2572 | zf.write(path, zippath) |
| 2573 | for nm in sorted(os.listdir(path)): |
| 2574 | addToZip(zf, |
| 2575 | os.path.join(path, nm), os.path.join(zippath, nm)) |
| 2576 | # else: ignore |
| 2577 | |
| 2578 | with ZipFile(zip_name, 'w') as zf: |
| 2579 | for path in files: |