diff --git a/Changes.md b/Changes.md index ce5eb62..199b873 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,8 @@ +## $NEXT + +- Added support for release artifacts with a `.pyz` extension. These are zip files containing Python + code, and they can be directly executed. + ## 0.4.0 - 2025-01-03 - The `ubi` CLI tool now takes an optional `--extract-all` argument. If this is passed, it will only diff --git a/README.md b/README.md index fbb75a4..20c1458 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,7 @@ doesn't match one of the following: - `.bz2` - `.exe` - `.gz` +- `.pyz` - `.tar` - `.tar.bz` - `.tar.bz2` diff --git a/ubi/src/extension.rs b/ubi/src/extension.rs index a93daad..e055082 100644 --- a/ubi/src/extension.rs +++ b/ubi/src/extension.rs @@ -21,6 +21,7 @@ pub(crate) enum Extension { Bz2, Exe, Gz, + Pyz, Tar, TarBz, TarBz2, @@ -40,6 +41,7 @@ impl Extension { Extension::Bz2 => ".bz2", Extension::Exe => ".exe", Extension::Gz => ".gz", + Extension::Pyz => ".pyz", Extension::Tar => ".tar", Extension::TarBz => ".tar.bz", Extension::TarBz2 => ".tar.bz2", @@ -55,9 +57,12 @@ impl Extension { pub(crate) fn is_archive(&self) -> bool { match self { - Extension::Bz | Extension::Bz2 | Extension::Exe | Extension::Gz | Extension::Xz => { - false - } + Extension::Bz + | Extension::Bz2 + | Extension::Exe + | Extension::Gz + | Extension::Pyz + | Extension::Xz => false, Extension::Tar | Extension::TarBz | Extension::TarBz2 diff --git a/ubi/src/installer.rs b/ubi/src/installer.rs index 1b04ce8..0aa2c28 100644 --- a/ubi/src/installer.rs +++ b/ubi/src/installer.rs @@ -66,7 +66,7 @@ impl ExeInstaller { Some(Extension::Gz) => self.ungzip(downloaded_file), Some(Extension::Xz) => self.unxz(downloaded_file), Some(Extension::Zip) => self.extract_executable_from_zip(downloaded_file), - Some(Extension::Exe) | None => self.copy_executable(downloaded_file), + Some(Extension::Exe | Extension::Pyz) | None => self.copy_executable(downloaded_file), } } @@ -374,6 +374,7 @@ mod tests { #[test_case("test-data/project.bz2")] #[test_case("test-data/project.exe")] #[test_case("test-data/project.gz")] + #[test_case("test-data/project.pyz")] #[test_case("test-data/project.tar")] #[test_case("test-data/project.tar.bz")] #[test_case("test-data/project.tar.bz2")] diff --git a/ubi/test-data/project.pyz b/ubi/test-data/project.pyz new file mode 100644 index 0000000..0874936 Binary files /dev/null and b/ubi/test-data/project.pyz differ