Skip to content

Commit b8d0720

Browse files
ragusaaval-ms
authored andcommitted
Added .gz.xz support
1 parent 4f20b03 commit b8d0720

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mussels/recipe.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ def _extract_archive(self, rebuild: bool) -> bool:
213213
self.builds[self.target] = os.path.join(
214214
self.work_dir, self.target, f"{self.archive[:-len('.zip')]}"
215215
)
216+
elif self.archive.endswith(".tar.xz"):
217+
self.builds[self.target] = os.path.join(
218+
self.work_dir, self.target, f"{self.archive[:-len('.tar.xz')]}"
219+
)
216220
else:
217221
self.logger.error(
218222
f"Unexpected archive extension. Currently only supports .tar.gz and .zip!"
@@ -258,6 +262,15 @@ def _extract_archive(self, rebuild: bool) -> bool:
258262
zip_ref = zipfile.ZipFile(self.download_path, "r")
259263
zip_ref.extractall(os.path.join(self.work_dir, self.target))
260264
zip_ref.close()
265+
elif self.archive.endswith(".tar.xz"):
266+
# Un-tar
267+
self.logger.info(
268+
f"Extracting tarball archive {self.archive} to {self.builds[self.target]} ..."
269+
)
270+
271+
tar = tarfile.open(self.download_path, "r:xz")
272+
tar.extractall(os.path.join(self.work_dir, self.target))
273+
tar.close()
261274

262275
return True
263276

0 commit comments

Comments
 (0)