Skip to content

Commit 7de0c76

Browse files
committed
Merge branch 'dev' into 3.8
2 parents 773533e + e09a9c6 commit 7de0c76

File tree

6 files changed

+86
-4
lines changed

6 files changed

+86
-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))
@@ -733,16 +743,15 @@ ifneq ($(os),macOS)
733743
LIBFFI_XCFRAMEWORK-$(os)=build/$(os)/Support/libFFI.xcframework
734744
LIBFFI_DIR-$(os)=build/$(os)/libffi-$(LIBFFI_VERSION)
735745

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

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

patch/Python/Setup.iOS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ _decimal _decimal/_decimal.c \
3737
_decimal/libmpdec/transpose.c \
3838
-I$(srcdir)/Modules/_decimal/libmpdec \
3939
-DCONFIG_64 -DANSI -DHAVE_UINT128_T
40+
41+
#####################################################################
42+
# DISABLED Modules that require additional frameworks
43+
#####################################################################
44+
45+
*disabled*
46+
47+
_curses
48+
_curses_panel
49+
_posixshmem

patch/Python/Setup.tvOS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ _decimal _decimal/_decimal.c \
3737
_decimal/libmpdec/transpose.c \
3838
-I$(srcdir)/Modules/_decimal/libmpdec \
3939
-DCONFIG_64 -DANSI -DHAVE_UINT128_T
40+
41+
#####################################################################
42+
# DISABLED Modules that require additional frameworks
43+
#####################################################################
44+
45+
*disabled*
46+
47+
_curses
48+
_curses_panel
49+
_posixshmem

patch/Python/Setup.watchOS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ _ctypes _ctypes/_ctypes.c \
1919
-DUSING_MALLOC_CLOSURE_DOT_C \
2020
-L$(srcdir)/../Support/libFFI.xcframework/{{slice}} \
2121
-lFFI
22+
23+
#####################################################################
24+
# DISABLED Modules that require additional frameworks
25+
#####################################################################
26+
27+
*disabled*
28+
29+
_curses
30+
_curses_panel
31+
_posixshmem

patch/libffi.patch

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,42 @@ index 9921b0d..5b60ccc 100755
279279

280280
mkdir_p('darwin_common/include')
281281
for header_name, tag_tuples in platform_headers.items():
282+
diff --git a/src/closures.c b/src/closures.c
283+
index f7bead6..db7ec94 100644
284+
--- a/src/closures.c
285+
+++ b/src/closures.c
286+
@@ -134,7 +134,7 @@ ffi_tramp_is_present (__attribute__((unused)) void *ptr)
287+
# define HAVE_MNTENT 1
288+
# endif
289+
# if defined(_WIN32) || defined(__OS2__)
290+
-/* Windows systems may have Data Execution Protection (DEP) enabled,
291+
+/* Windows systems may have Data Execution Protection (DEP) enabled,
292+
which requires the use of VirtualMalloc/VirtualFree to alloc/free
293+
executable memory. */
294+
# define FFI_MMAP_EXEC_WRIT 1
295+
@@ -230,12 +230,24 @@ ffi_trampoline_table_alloc (void)
296+
kt = vm_remap (mach_task_self (), &trampoline_page, PAGE_MAX_SIZE, 0x0,
297+
VM_FLAGS_OVERWRITE, mach_task_self (), trampoline_page_template,
298+
FALSE, &cur_prot, &max_prot, VM_INHERIT_SHARE);
299+
- if (kt != KERN_SUCCESS || !(cur_prot & VM_PROT_EXECUTE))
300+
+ if (kt != KERN_SUCCESS)
301+
{
302+
vm_deallocate (mach_task_self (), config_page, PAGE_MAX_SIZE * 2);
303+
return NULL;
304+
}
305+
306+
+ if (!(cur_prot & VM_PROT_EXECUTE))
307+
+ {
308+
+ /* If VM_PROT_EXECUTE isn't set on the remapped trampoline page, set it */
309+
+ kt = vm_protect (mach_task_self (), trampoline_page, PAGE_MAX_SIZE,
310+
+ FALSE, cur_prot | VM_PROT_EXECUTE);
311+
+ if (kt != KERN_SUCCESS)
312+
+ {
313+
+ vm_deallocate (mach_task_self (), config_page, PAGE_MAX_SIZE * 2);
314+
+ return NULL;
315+
+ }
316+
+ }
317+
+
318+
/* We have valid trampoline and config pages */
319+
table = calloc (1, sizeof (ffi_trampoline_table));
320+
table->free_count = FFI_TRAMPOLINE_COUNT;

0 commit comments

Comments
 (0)