| 70 | |
| 71 | |
| 72 | def compress(tgt_pkg_name: Path, src_dir: Path) -> None: |
| 73 | logging.info(f"Creating compressed package {tgt_pkg_name} from {src_dir}") |
| 74 | # Create the tar package |
| 75 | if tgt_pkg_name.suffix == ".zip": |
| 76 | if platform.system() == "Windows": |
| 77 | raise NotImplementedError("Windows zip path not implemented.") |
| 78 | else: |
| 79 | command = ("(cd", str(src_dir.parent), "&&", "zip", "-r", "-", |
| 80 | src_dir.name, ")") |
| 81 | command = command + (">", str(tgt_pkg_name)) |
| 82 | # command = ('zip', '-r', str(tgt_pkg_name), str(src_dir)) |
| 83 | else: |
| 84 | command = ('tar', '-C', str(src_dir.parent), '-czvf', str(tgt_pkg_name), |
| 85 | src_dir.name) |
| 86 | command = " ".join(command) |
| 87 | logging.debug(f"Executing {command}") |
| 88 | subprocess.run(command, check=True, shell=True) |
| 89 | |
| 90 | |
| 91 | LibInfo = namedtuple( |