Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add artifact support for pyz package #85

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ doesn't match one of the following:
- `.bz2`
- `.exe`
- `.gz`
- `.pyz`
- `.tar`
- `.tar.bz`
- `.tar.bz2`
Expand Down
11 changes: 8 additions & 3 deletions ubi/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub(crate) enum Extension {
Bz2,
Exe,
Gz,
Pyz,
Tar,
TarBz,
TarBz2,
Expand All @@ -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",
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ubi/src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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")]
Expand Down
Binary file added ubi/test-data/project.pyz
Binary file not shown.
Loading