Skip to content

Commit d3f3083

Browse files
authored
Merge pull request #33 from beeware/ios-dylib-binaries
Updates to support iOS dynamic binary modules
2 parents f7ada0f + 288675b commit d3f3083

File tree

15 files changed

+118
-100
lines changed

15 files changed

+118
-100
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ jobs:
2727
backend:
2828
- "macOS-Xcode"
2929
- "macOS-app"
30-
- "linux-appimage"
30+
# AppImage builds (a) take over an hour, because the need to compile Numpy and
31+
# Pandas from source, and (b) are only here as a light validation that
32+
# Standalone Python is working. A Flatpak build also validates this, but
33+
# completes in minutes.
34+
# - "linux-appimage"
3135
- "linux-flatpak"
3236
- "windows-VisualStudio"
3337
- "windows-app"
@@ -48,10 +52,16 @@ jobs:
4852
runs-on: macos-latest
4953
briefcase-target: "macOS app"
5054

51-
- backend: linux-appimage
55+
- backend: linux-system
5256
runs-on: ubuntu-latest
53-
pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config libfuse2"
54-
briefcase-target: "linux appimage"
57+
python-version: "system"
58+
pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config"
59+
briefcase-target: "linux system"
60+
61+
# - backend: linux-appimage
62+
# runs-on: ubuntu-latest
63+
# pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config libfuse2"
64+
# briefcase-target: "linux appimage"
5565

5666
- backend: linux-flatpak
5767
runs-on: ubuntu-latest
@@ -91,6 +101,7 @@ jobs:
91101

92102
- name: Set up Python
93103
uses: actions/[email protected]
104+
if: matrix.python-version != 'system'
94105
with:
95106
python-version: ${{ matrix.python-version }}
96107

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
__pycache__/
22
.idea
33
*.dist-info/
4-
macOS
5-
iOS
6-
android
7-
windows
8-
linux
9-
briefcase.*.log
4+
build/
5+
logs/

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Python Support Testbed Release Notes
2+
3+
## 1.0.0
4+
5+
* Rolling release.

pyproject.toml

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ author_email = "[email protected]"
1010
[tool.briefcase.app.testbed]
1111
formal_name = "Testbed"
1212
description = "A testbed for the Apple Support packages."
13+
long_description = """A test of common use cases and known problems with bundled apps.
14+
15+
Validates 3rd party module loading, as well as basic app packaging.
16+
"""
1317
icon = "src/testbed/resources/testbed"
1418
sources = ["src/testbed"]
1519
test_sources = ["tests"]
@@ -44,24 +48,44 @@ requires=[
4448
'pygobject',
4549
]
4650

51+
[tool.briefcase.app.testbed.linux.system.debian]
52+
system_requires = [
53+
# Needed to compile pycairo wheel
54+
"libcairo2-dev",
55+
# Needed to compile PyGObject wheel
56+
"libgirepository1.0-dev",
57+
]
58+
59+
system_runtime_requires = [
60+
# Needed to provide GTK and its GI bindings
61+
"gir1.2-gtk-3.0",
62+
"libgirepository-1.0-1",
63+
# Dependencies that GTK looks for at runtime
64+
"libcanberra-gtk3-module",
65+
]
66+
4767
[tool.briefcase.app.testbed.linux.appimage]
48-
requires=[
49-
'--no-binary', ':all:'
68+
manylinux = "manylinux_2_28"
69+
requires = [
70+
'--no-binary', ':all:',
5071
]
5172

5273
system_requires = [
53-
# Required for GTK/PyGObject tests
54-
'gir1.2-gtk-3.0',
55-
'libgirepository1.0-dev',
56-
# Required for pycairo
57-
'libcairo2-dev',
58-
# Required for Pillow
59-
'libjpeg-dev',
60-
'libpng-dev',
61-
'libtiff-dev',
62-
# Required to install Rust
63-
'curl',
64-
'libssl-dev',
74+
# Needed to compile pycairo wheel
75+
"cairo-gobject-devel",
76+
# Needed to compile PyGObject wheel
77+
"gobject-introspection-devel",
78+
# Needed to provide GTK
79+
"gtk3-devel",
80+
# Dependencies that GTK looks for at runtime, that need to be
81+
# in the build environment to be picked up by linuxdeploy
82+
"libcanberra-gtk3",
83+
"PackageKit-gtk3-module",
84+
"gvfs-client",
85+
# Needed to compile Pillow
86+
"libjpeg-devel",
87+
# Needed to compile Cryptography
88+
"openssl-devel",
6589
]
6690

6791
linuxdeploy_plugins = [
@@ -71,13 +95,28 @@ linuxdeploy_plugins = [
7195
dockerfile_extra_content = """
7296
# Install Rust (required for cryptography)
7397
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
74-
ENV PATH="/home/brutus/.cargo/bin:${PATH}"
98+
# Set up compilers (required for numpy)
99+
ENV CXX="g++ -pthread"
100+
ENV AR=ar
101+
# Add a symlink for python->python3 (needed for pandas)
102+
# Pandas *requires* that the Python binary be called `python`, not `python3`.
103+
# However, Python-standalone *only* provides `python3`, and at runtime, we
104+
# only need `python3`. We can't (easily) reconfigure the Meson build for Pandas,
105+
# so we put a symlink in `brutus`'s bin path.
106+
RUN mkdir -p /home/brutus/bin
107+
RUN ln -si /app/Testbed.AppDir/usr/python/bin/python3 /home/brutus/bin/python
108+
# Set the path to include all the things we've installed.
109+
ENV PATH="/home/brutus/bin:/home/brutus/.cargo/bin:${PATH}"
75110
"""
76111

77112
# support_package = "../Python-linux-support/dist/Python-3.10-linux-x86_64-support.custom.tar.gz"
78113
# template = "../../templates/briefcase-linux-appimage-template"
79114

80115
[tool.briefcase.app.testbed.linux.flatpak]
116+
flatpak_runtime = "org.gnome.Platform"
117+
flatpak_runtime_version = "44"
118+
flatpak_sdk = "org.gnome.Sdk"
119+
81120
# template = "../../templates/briefcase-linux-flatpak-template"
82121

83122
[tool.briefcase.app.testbed.windows]

src/testbed/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
if __name__ == "__main__":
44
main()
5+
print("Did you forget to invoke with --test?")

src/testbed/android.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
######################################################################
2-
# Android App main loop
3-
#
4-
# The main loop itself is a no-op; however we need a PythonAppDelegate
5-
# to satisfy the app stub.
2+
# Android App configuration
63
#######################################################################
74
from rubicon.java import JavaClass, JavaInterface
85

@@ -22,7 +19,3 @@ def __init__(self, app):
2219
self._impl = app
2320
MainActivity.setPythonApp(self)
2421
print("Python app launched & stored in Android Activity class")
25-
26-
27-
def main_loop():
28-
pass

src/testbed/app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def main():
1414
module_path = ".android"
1515
else:
1616
module_path = f".{sys.platform}"
17-
platform_module = importlib.import_module(module_path, "testbed")
1817

19-
# Run the main_loop() for the platform
20-
platform_module.main_loop()
18+
# Import the platform module, so we get any import side effects.
19+
importlib.import_module(module_path, "testbed")

src/testbed/darwin.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
######################################################################
2-
# macOS App main loop
2+
# No macOS App configuration required
33
#######################################################################
4-
from rubicon.objc import ObjCClass
5-
from rubicon.objc.runtime import load_library
6-
7-
appkit = load_library("AppKit")
8-
9-
NSApplication = ObjCClass("NSApplication")
10-
NSApplication.declare_class_property("sharedApplication")
11-
12-
13-
def main_loop():
14-
app = NSApplication.sharedApplication
15-
app.setActivationPolicy(0)
16-
app.run()

src/testbed/ios.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
######################################################################
2-
# iOS App main loop
3-
#
4-
# The main loop itself is a no-op; however we need a PythonAppDelegate
5-
# to satisfy the app stub.
2+
# iOS App configuration
63
#######################################################################
74
from rubicon.objc import ObjCClass
85

@@ -11,7 +8,3 @@
118

129
class PythonAppDelegate(UIResponder):
1310
pass
14-
15-
16-
def main_loop():
17-
pass

src/testbed/linux.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
######################################################################
2-
# Linux App main loop
2+
# No Linux App configuration required
33
#######################################################################
4-
import gi
5-
6-
gi.require_version("Gtk", "3.0")
7-
from gi.repository import Gtk # noqa; E402
8-
9-
10-
def main_loop():
11-
win = Gtk.Window()
12-
win.connect("destroy", Gtk.main_quit)
13-
win.show_all()
14-
Gtk.main()

0 commit comments

Comments
 (0)