add support for tar.xz tarballs (#4974)

* tar.xz

* add magic bytes for `tar.xz`
This commit is contained in:
Jason2866
2024-12-12 18:47:23 +01:00
committed by GitHub
parent 014ac79c87
commit 1fd3a4061f
2 changed files with 2 additions and 1 deletions

View File

@ -396,7 +396,7 @@ class PackageSpec: # pylint: disable=too-many-instance-attributes
parts.path.endswith(".git"),
# Handle GitHub URL (https://github.com/user/package)
parts.netloc in ("github.com", "gitlab.com", "bitbucket.com")
and not parts.path.endswith((".zip", ".tar.gz")),
and not parts.path.endswith((".zip", ".tar.gz", ".tar.xz")),
]
hg_conditions = [
# Handle Developer Mbed URL

View File

@ -152,6 +152,7 @@ class FileUnpacker:
magic_map = {
b"\x1f\x8b\x08": TARArchiver,
b"\x42\x5a\x68": TARArchiver,
b"\xfd\x37\x7a\x58\x5a\x00": TARArchiver,
b"\x50\x4b\x03\x04": ZIPArchiver,
}
magic_len = max(len(k) for k in magic_map)