Skip to content

Commit

Permalink
Correctly enforce min macOS version, and use dotted path for frameworks.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Oct 19, 2023
2 parents 52c4396 + dd3e00c commit 8306661
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
Includes:
* Python ${{ env.PY_VERSION }}.?
* OpenSSL 3.0.5
* OpenSSL 3.1.2
* BZip2 1.0.8
* XZ 5.2.6
* LibFFI 3.4.2
* XZ 5.4.4
* LibFFI 3.4.4
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

build:
runs-on: macOS-12
runs-on: macOS-latest
needs: make-release
strategy:
max-parallel: 4
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar

# macOS targets
TARGETS-macOS=macosx.x86_64 macosx.arm64
VERSION_MIN-macOS=10.15
VERSION_MIN-macOS=11.0
CFLAGS-macOS=-mmacosx-version-min=$(VERSION_MIN-macOS)

# iOS targets
Expand Down Expand Up @@ -847,6 +847,7 @@ $$(PYTHON_SRCDIR-$(sdk))/Makefile: \
LIBLZMA_LIBS="-L$$(XZ_MERGE-$(sdk))/lib -llzma" \
BZIP2_CFLAGS="-I$$(BZIP2_MERGE-$(sdk))/include" \
BZIP2_LIBS="-L$$(BZIP2_MERGE-$(sdk))/lib -lbz2" \
MACOSX_DEPLOYMENT_TARGET="$$(VERSION_MIN-$(os))" \
--prefix="$$(PYTHON_INSTALL-$(sdk))" \
--enable-ipv6 \
--enable-universalsdk \
Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ Python Apple Support
This is a meta-package for building a version of Python that can be embedded
into a macOS, iOS, tvOS or watchOS project.

**This branch builds a packaged version of Python 3.11.5**.
**This branch builds a packaged version of Python 3.11.6**.
Other Python versions are available by cloning other branches of the main
repository:

* `Python 3.8 <https://github.com/beeware/Python-Apple-support/tree/3.8>`__
* `Python 3.9 <https://github.com/beeware/Python-Apple-support/tree/3.9>`__
* `Python 3.10 <https://github.com/beeware/Python-Apple-support/tree/3.10>`__
* `Python 3.12 <https://github.com/beeware/Python-Apple-support/tree/3.12>`__
* `Python 3.13 <https://github.com/beeware/Python-Apple-support/tree/3.13>`__

It works by downloading, patching, and building a fat binary of Python and selected
pre-requisites, and packaging them as static libraries that can be incorporated into an
Expand Down Expand Up @@ -41,10 +42,10 @@ The binaries support x86_64 and arm64 for macOS; arm64 for iOS and appleTV
devices; and arm64_32 for watchOS. It also supports device simulators on both
x86_64 and M1 hardware. This should enable the code to run on:

* macOS 10.15 (Catalina) or later, on:
* macOS 11 (Big Sur) or later, on:
* MacBook (including MacBooks using Apple Silicon)
* iMac (including iMacs using Apple Silicon)
* Mac Mini (including M1 Apple Silicon Mac minis)
* Mac Mini (including Apple Silicon Mac minis)
* Mac Studio (all models)
* Mac Pro (all models)
* iOS 12.0 or later, on:
Expand Down
9 changes: 4 additions & 5 deletions patch/Python/Python.patch
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ index 2ce5c5b64d..6e10a0c4a5 100644
import pwd
os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index f603a89f7f..48463efcfc 100644
index f603a89f7f..92af10f21a 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -52,7 +52,7 @@
Expand All @@ -143,7 +143,7 @@ index f603a89f7f..48463efcfc 100644
_CASE_INSENSITIVE_PLATFORMS = (_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY
+ _CASE_INSENSITIVE_PLATFORMS_STR_KEY)

@@ -1705,6 +1705,60 @@
@@ -1705,6 +1705,59 @@
return 'FileFinder({!r})'.format(self.path)


Expand Down Expand Up @@ -190,10 +190,9 @@ index f603a89f7f..48463efcfc 100644
+
+ def find_spec(self, fullname, path, target=None):
+ name = fullname.split(".")[-1]
+ framework_name = "_".join(fullname.split("."))
+
+ for extension in EXTENSION_SUFFIXES:
+ dylib_file = _path_join(self.frameworks_path, f"{framework_name}.framework", f"{name}{extension}")
+ dylib_file = _path_join(self.frameworks_path, f"{fullname}.framework", f"{name}{extension}")
+ _bootstrap._verbose_message('Looking for Apple Framework dylib {}', dylib_file)
+ if _path_isfile(dylib_file):
+ loader = AppleFrameworkLoader(fullname, dylib_file, path)
Expand All @@ -204,7 +203,7 @@ index f603a89f7f..48463efcfc 100644
# Import setup ###############################################################

def _fix_up_module(ns, name, pathname, cpathname=None):
@@ -1752,3 +1806,7 @@
@@ -1752,3 +1805,7 @@
supported_loaders = _get_supported_file_loaders()
sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
sys.meta_path.append(PathFinder)
Expand Down

0 comments on commit 8306661

Please sign in to comment.