Skip to content

Commit 6d6abb0

Browse files
committed
Add a non-executable stub binary for crossenv detection purposes.
1 parent fd7051e commit 6d6abb0

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Eo "\d+\.\d+\.\d+")
2020
PYTHON_VER=$(basename $(PYTHON_VERSION))
2121

2222
# The binary releases of dependencies, published at:
23-
# macOS:
24-
# https://github.com/beeware/cpython-macOS-source-deps/releases
25-
# iOS, tvOS, watchOS:
26-
# https://github.com/beeware/cpython-apple-source-deps/releases
23+
# https://github.com/beeware/cpython-apple-source-deps/releases
2724
BZIP2_VERSION=1.0.8-1
2825
XZ_VERSION=5.4.4-1
2926
OPENSSL_VERSION=3.0.12-1
@@ -417,13 +414,21 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
417414
@echo ">>> Build Python fat headers for the $(sdk) SDK"
418415
# Copy binary helpers from the first target in the $(sdk) SDK
419416
cp -r $$(PYTHON_BIN-$$(firstword $$(SDK_TARGETS-$(sdk)))) $$(PYTHON_BIN-$(sdk))
417+
418+
# Create a non-executable stub binary python3
419+
echo "#!/bin/bash\necho Can\\'t run $(sdk) binary\nexit 1" > $$(PYTHON_BIN-$(sdk))/python$(PYTHON_VER)
420+
chmod 755 $$(PYTHON_BIN-$(sdk))/python$(PYTHON_VER)
421+
420422
# Copy headers as-is from the first target in the $(sdk) SDK
421423
cp -r $$(PYTHON_INCLUDE-$$(firstword $$(SDK_TARGETS-$(sdk)))) $$(PYTHON_INCLUDE-$(sdk))
424+
422425
# Link the PYTHONHOME version of the headers
423426
mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
424427
ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
428+
425429
# Add the individual headers from each target in an arch-specific name
426430
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
431+
427432
# Copy the cross-target header from the patch folder
428433
cp $(PROJECT_DIR)/patch/Python/pyconfig-$(os).h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
429434

patch/Python/Python.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ index d74fb6deac..09ebc4287c 100755
18421842
# Blank kernel with real OS is always fine.
18431843
;;
18441844
diff --git a/configure b/configure
1845-
index c87f518382..45f021d1b1 100755
1845+
index c87f518382..ad0cd39350 100755
18461846
--- a/configure
18471847
+++ b/configure
18481848
@@ -963,10 +963,13 @@
@@ -2121,7 +2121,7 @@ index c87f518382..45f021d1b1 100755
21212121
+ esac
21222122
+
21232123
+ prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
2124-
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX=$(prefix)
2124+
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX=${prefix}
21252125
+ RESSRCDIR=Mac/Resources/framework
21262126
+
21272127
+ # Add files for Mac specific code to the list of output
@@ -2606,7 +2606,7 @@ index c87f518382..45f021d1b1 100755
26062606
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
26072607
"Misc/python-embed.pc") CONFIG_FILES="$CONFIG_FILES Misc/python-embed.pc" ;;
26082608
diff --git a/configure.ac b/configure.ac
2609-
index cd69f0ede5..a96ca3a3c7 100644
2609+
index cd69f0ede5..9306e1270b 100644
26102610
--- a/configure.ac
26112611
+++ b/configure.ac
26122612
@@ -310,6 +310,83 @@
@@ -2847,7 +2847,7 @@ index cd69f0ede5..a96ca3a3c7 100644
28472847
+ esac
28482848
+
28492849
+ prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
2850-
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX=$(prefix)
2850+
+ PYTHONFRAMEWORKINSTALLNAMEPREFIX=${prefix}
28512851
+ RESSRCDIR=Mac/Resources/framework
28522852
+
28532853
+ # Add files for Mac specific code to the list of output

0 commit comments

Comments
 (0)