Skip to content

Commit 34e63f4

Browse files
committed
Require a host Python to compile the support packages.
This removes a number of odd side effects where modifying the macOS Python build causes libFFI to rebuild.
1 parent a8d691d commit 34e63f4

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
echo "TAG=${TAG}" >> $GITHUB_ENV
6969
echo "PY_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
7070
echo "BUILD_NUMBER=${TAG_BUILD}" >> $GITHUB_ENV
71+
- name: Set up Python
72+
uses: actions/[email protected]
73+
with:
74+
python-version: ${{ env.TAG_VERSION }}
7175
- name: Build ${{ matrix.target }}
7276
env:
7377
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ clean-Python:
239239
build/*/Support/Python.xcframework \
240240
build/*/Support/Python
241241

242+
dev-clean-Python:
243+
@echo ">>> Partially clean Python build products to the point where local code modifications can be made"
244+
rm -rf \
245+
dist/Python-$(PYTHON_VER)-* \
246+
build/*/Python-$(PYTHON_VERSION)-*/python.exe \
247+
build/*/Python-$(PYTHON_VERSION)-*/_install \
248+
build/*/python \
249+
build/*/python-*.log \
250+
build/*/Support/Python.xcframework \
251+
build/*/Support/Python
252+
242253
# Download original Python source code archive.
243254
downloads/Python-$(PYTHON_VERSION).tgz:
244255
@echo ">>> Download Python sources"
@@ -455,7 +466,6 @@ $$(PYTHON_DIR-$(target))/Makefile: \
455466
$$(XZ_XCFRAMEWORK-$(os)) \
456467
$$(OPENSSL_XCFRAMEWORK-$(os)) \
457468
$$(LIBFFI_XCFRAMEWORK-$(os)) \
458-
$$(PYTHON_XCFRAMEWORK-macOS) \
459469
downloads/Python-$(PYTHON_VERSION).tgz
460470
@echo ">>> Unpack and configure Python for $(target)"
461471
mkdir -p $$(PYTHON_DIR-$(target))
@@ -731,16 +741,15 @@ ifneq ($(os),macOS)
731741
LIBFFI_XCFRAMEWORK-$(os)=build/$(os)/Support/libFFI.xcframework
732742
LIBFFI_DIR-$(os)=build/$(os)/libffi-$(LIBFFI_VERSION)
733743

734-
$$(LIBFFI_DIR-$(os))/darwin_common/include/ffi.h: downloads/libffi-$(LIBFFI_VERSION).tgz $$(PYTHON_XCFRAMEWORK-macOS)
744+
$$(LIBFFI_DIR-$(os))/darwin_common/include/ffi.h: downloads/libffi-$(LIBFFI_VERSION).tgz
735745
@echo ">>> Unpack and configure libFFI sources on $(os)"
736746
mkdir -p $$(LIBFFI_DIR-$(os))
737747
tar zxf downloads/libffi-$(LIBFFI_VERSION).tgz --strip-components 1 -C $$(LIBFFI_DIR-$(os))
738748
# Patch the build to add support for new platforms
739749
cd $$(LIBFFI_DIR-$(os)) && patch -p1 < $(PROJECT_DIR)/patch/libffi.patch
740750
# Configure the build
741751
cd $$(LIBFFI_DIR-$(os)) && \
742-
PATH=$(PROJECT_DIR)/$(PYTHON_DIR-macOS)/_install/bin:$(PATH) \
743-
python3 generate-darwin-source-and-headers.py --only-$(shell echo $(os) | tr '[:upper:]' '[:lower:]') \
752+
python$(PYTHON_VER) generate-darwin-source-and-headers.py --only-$(shell echo $(os) | tr '[:upper:]' '[:lower:]') \
744753
2>&1 | tee -a ../libffi-$(os).config.log
745754

746755
$$(LIBFFI_XCFRAMEWORK-$(os)): $$(foreach sdk,$$(SDKS-$(os)),$$(LIBFFI_FATLIB-$$(sdk)))

0 commit comments

Comments
 (0)