| 67 | raise RuntimeError(msg) |
| 68 | |
| 69 | def extract(self, extraction_location: Path) -> None: |
| 70 | if not tc_build.utils.path_is_set(self.local_location): |
| 71 | msg = 'No local tarball location specified?' |
| 72 | raise RuntimeError(msg) |
| 73 | if not self.local_location.exists(): |
| 74 | msg = f"Local tarball ('{self.local_location}') could not be found, download it first?" |
| 75 | raise RuntimeError(msg) |
| 76 | |
| 77 | extraction_location.mkdir(exist_ok=True, parents=True) |
| 78 | tar_cmd = [ |
| 79 | 'tar', |
| 80 | '--auto-compress', |
| 81 | f"--directory={extraction_location}", |
| 82 | '--extract', |
| 83 | f"--file={self.local_location}", |
| 84 | '--strip-components=1', |
| 85 | ] |
| 86 | |
| 87 | tc_build.utils.print_info(f"Extracting {self.local_location} into {extraction_location}...") |
| 88 | subprocess.run(tar_cmd, check=True) |
| 89 | |
| 90 | |
| 91 | class SourceManager: |