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

Use stripped versions of Standalone Python for Linux #1929

Merged
merged 1 commit into from
Jul 27, 2024
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
1 change: 1 addition & 0 deletions changes/1929.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Apps packaged for Flatpak and AppImage now use a stripped (and smaller) Python support package.
3 changes: 2 additions & 1 deletion src/briefcase/platforms/linux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def support_package_url(self, support_revision):
version, datestamp = support_revision.split("+")
return (
"https://github.com/indygreg/python-build-standalone/releases/download/"
f"{datestamp}/cpython-{support_revision}-{python_download_arch}-unknown-linux-gnu-install_only.tar.gz"
f"{datestamp}/"
f"cpython-{support_revision}-{python_download_arch}-unknown-linux-gnu-install_only_stripped.tar.gz"
)

def vendor_details(self, freedesktop_info):
Expand Down
1 change: 1 addition & 0 deletions src/briefcase/platforms/linux/appimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class LinuxAppImagePassiveMixin(LinuxMixin):
supported_host_os_reason = (
"Linux AppImages can only be built on Linux, or on macOS using Docker."
)
platform_target_version = "0.3.20"

def appdir_path(self, app):
return self.bundle_path(app) / f"{app.formal_name}.AppDir"
Expand Down
1 change: 1 addition & 0 deletions src/briefcase/platforms/linux/flatpak.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class LinuxFlatpakMixin(LinuxMixin):
output_format = "flatpak"
supported_host_os = {"Linux"}
supported_host_os_reason = "Flatpaks can only be built on Linux."
platform_target_version = "0.3.20"

def binary_path(self, app):
# Flatpak doesn't really produce an identifiable "binary" as part of its
Expand Down
9 changes: 2 additions & 7 deletions tests/platforms/linux/appimage/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ def build_command(tmp_path, first_app_config):
command.tools.host_arch = "x86_64"
command.use_docker = False
command.extra_docker_build_args = []
command._briefcase_toml[first_app_config] = {
"paths": {
"app_path": "First App.AppDir/usr/app",
"app_packages_path": "First App.AppDir/usr/app_packages",
}
}

# Reset `os` mock without `spec` so tests can run on Windows where os.getuid doesn't exist.
command.tools.os = mock.MagicMock()
Expand Down Expand Up @@ -558,11 +552,12 @@ def test_build_appimage_with_support_package_update(
# Populate a briefcase.toml that mirrors a real Windows app
with (build_command.bundle_path(first_app) / "briefcase.toml").open("wb") as f:
index = {
"briefcase": {"target_version": "0.3.20"},
"paths": {
"app_path": "First App.AppDir/usr/app",
"app_package_path": "First App.AppDir/usr/app_packages",
"support_path": "First App.AppDir/usr",
}
},
}
tomli_w.dump(index, f)

Expand Down
14 changes: 7 additions & 7 deletions tests/platforms/linux/test_LinuxMixin__support_package_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,43 @@
"3.10.9+20230116",
"x86_64",
False,
"20230116/cpython-3.10.9+20230116-x86_64-unknown-linux-gnu-install_only.tar.gz",
"20230116/cpython-3.10.9+20230116-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.11.1+20230116",
"aarch64",
False,
"20230116/cpython-3.11.1+20230116-aarch64-unknown-linux-gnu-install_only.tar.gz",
"20230116/cpython-3.11.1+20230116-aarch64-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.11.1+20230116",
"aarch64",
True,
"20230116/cpython-3.11.1+20230116-armv7-unknown-linux-gnu-install_only.tar.gz",
"20230116/cpython-3.11.1+20230116-armv7-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.11.1+20230116",
"armv7l",
True,
"20230116/cpython-3.11.1+20230116-armv7l-unknown-linux-gnu-install_only.tar.gz",
"20230116/cpython-3.11.1+20230116-armv7l-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.8.16+20221220",
"x86_64",
False,
"20221220/cpython-3.8.16+20221220-x86_64-unknown-linux-gnu-install_only.tar.gz",
"20221220/cpython-3.8.16+20221220-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.8.16+20221220",
"x86_64",
True,
"20221220/cpython-3.8.16+20221220-i686-unknown-linux-gnu-install_only.tar.gz",
"20221220/cpython-3.8.16+20221220-i686-unknown-linux-gnu-install_only_stripped.tar.gz",
),
(
"3.8.16+20221220",
"i686",
True,
"20221220/cpython-3.8.16+20221220-i686-unknown-linux-gnu-install_only.tar.gz",
"20221220/cpython-3.8.16+20221220-i686-unknown-linux-gnu-install_only_stripped.tar.gz",
),
],
)
Expand Down