Skip to content

Commit

Permalink
Disable building AppImages on Apple Silicon
Browse files Browse the repository at this point in the history
- On Apple Silicon, Docker Desktop runs x86-64 containers in an
  emulation mode in an arm64 Linux VM; however, due to present issues
  in the implementation of QEMU used, AppImages cannot successfully
  run. Since linuxdeploy itself is an AppImage, it cannot run and
  AppImages cannot be created.
  • Loading branch information
rmartin16 committed Jul 31, 2023
1 parent 1e6184c commit 2ef9191
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 26 deletions.
12 changes: 5 additions & 7 deletions src/briefcase/integrations/linuxdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ def file_path(self) -> Path:
"""The folder on the local filesystem that contains the file_name."""

@classmethod
def arch(cls, host_os: str, host_arch: str) -> str:
# always use the x86-64 arch on macOS since the
# manylinux image will always be x86-64 for macOS
arch = "x86_64" if host_os == "Darwin" else host_arch
def arch(cls, host_arch: str) -> str:
"""The architecture defined (and supported) by linuxdeploy for AppImages."""
try:
return {
"x86_64": "x86_64",
"i686": "i386",
}[arch]
}[host_arch]
except KeyError as e:
raise UnsupportedHostError(
f"Linux AppImages cannot be built on {host_arch}."
Expand Down Expand Up @@ -224,7 +222,7 @@ class LinuxDeployQtPlugin(LinuxDeployPluginBase, ManagedTool):

@property
def file_name(self) -> str:
return f"linuxdeploy-plugin-qt-{self.arch(self.tools.host_os, self.tools.host_arch)}.AppImage"
return f"linuxdeploy-plugin-qt-{self.arch(self.tools.host_arch)}.AppImage"

@property
def download_url(self) -> str:
Expand Down Expand Up @@ -335,7 +333,7 @@ def file_path(self) -> Path:

@property
def file_name(self) -> str:
return f"linuxdeploy-{self.arch(self.tools.host_os, self.tools.host_arch)}.AppImage"
return f"linuxdeploy-{self.arch(self.tools.host_arch)}.AppImage"

@property
def download_url(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions src/briefcase/platforms/linux/appimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def project_path(self, app):

def binary_name(self, app):
safe_name = app.formal_name.replace(" ", "_")
arch = LinuxDeploy.arch(self.tools.host_os, self.tools.host_arch)
arch = LinuxDeploy.arch(self.tools.host_arch)
return f"{safe_name}-{app.version}-{arch}.AppImage"

def binary_path(self, app):
Expand Down Expand Up @@ -163,7 +163,7 @@ def output_format_template_context(self, app: AppConfig):
manylinux_arch = {
"x86_64": "x86_64",
"i386": "i686",
}[LinuxDeploy.arch(self.tools.host_os, self.tools.host_arch)]
}[LinuxDeploy.arch(self.tools.host_arch)]
context["manylinux_image"] = f"{app.manylinux}_{manylinux_arch}:{tag}"
if app.manylinux in {"manylinux1", "manylinux2010", "manylinux2014"}:
context["vendor_base"] = "centos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def test_file_path(mock_tools, linuxdeploy_qt_plugin):
("Linux", "x86_64", "x86_64"),
("Linux", "i686", "i386"),
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "x86_64"),
],
)
def test_file_name(mock_tools, host_os, host_arch, linuxdeploy_arch):
Expand All @@ -48,7 +47,6 @@ def test_plugin_id(linuxdeploy_qt_plugin):
("Linux", "x86_64", "x86_64"),
("Linux", "i686", "i386"),
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "x86_64"),
],
)
def test_download_url(mock_tools, host_os, host_arch, linuxdeploy_arch):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def test_file_path(linuxdeploy, mock_tools):
("Linux", "x86_64", "x86_64"),
("Linux", "i686", "i386"),
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "x86_64"),
],
)
def test_file_name(mock_tools, host_os, host_arch, linuxdeploy_arch):
Expand Down Expand Up @@ -54,7 +53,6 @@ def test_file_name_unsupported_arch(mock_tools):
("Linux", "x86_64", "x86_64"),
("Linux", "i686", "i386"),
("Darwin", "x86_64", "x86_64"),
("Darwin", "arm64", "x86_64"),
],
)
def test_download_url(mock_tools, host_os, host_arch, linuxdeploy_arch):
Expand Down
13 changes: 0 additions & 13 deletions tests/platforms/linux/appimage/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,6 @@ def test_finalize_nodocker(create_command, first_app_config, capsys):
"use_non_root_user": False,
},
),
# macOS on Apple Silicon
(
"manylinux2014",
None,
"Darwin",
"arm64",
True,
{
"manylinux_image": "manylinux2014_x86_64:latest",
"vendor_base": "centos",
"use_non_root_user": False,
},
),
],
)
def test_output_format_template_context(
Expand Down

0 comments on commit 2ef9191

Please sign in to comment.