(path, base_path)
| 435 | |
| 436 | |
| 437 | def pack_directory(path, base_path): |
| 438 | if path.endswith(os.path.sep): |
| 439 | path = path[:-1] |
| 440 | # ext = ".zip" if WINDOWS or MAC else ".tar.gz" |
| 441 | ext = ".zip" |
| 442 | archive = path + ext |
| 443 | if os.path.exists(archive): |
| 444 | os.remove(archive) |
| 445 | if WINDOWS or MAC: |
| 446 | zip_directory(path, base_path=base_path, archive=archive) |
| 447 | else: |
| 448 | zip_directory(path, base_path=base_path, archive=archive) |
| 449 | # with tarfile.open(archive, "w:gz") as tar: |
| 450 | # tar.add(path, arcname=os.path.basename(path)) |
| 451 | assert os.path.isfile(archive), archive |
| 452 | return archive |
| 453 | |
| 454 | |
| 455 | def zip_directory(path, base_path, archive): |
no test coverage detected