Skip to content

Commit c8da2e9

Browse files
authored
Merge pull request #237 from beeware/ios-ver-sitecustom
Add ios_ver and _multiarch shims for pip 24.3 support.
2 parents 0717ddb + 75dd5e3 commit c8da2e9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
129129
ifneq ($(os),macOS)
130130
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
131131
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))
132+
IS_SIMULATOR-$(target)="False"
132133
else
133134
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))-simulator
135+
IS_SIMULATOR-$(target)="True"
134136
endif
135137
endif
136138

@@ -324,6 +326,9 @@ $$(PYTHON_SITECUSTOMIZE-$(target)):
324326
cat $(PROJECT_DIR)/patch/Python/sitecustomize.$(os).py \
325327
| sed -e "s/{{os}}/$(os)/g" \
326328
| sed -e "s/{{arch}}/$$(ARCH-$(target))/g" \
329+
| sed -e "s/{{version_min}}/$$(VERSION_MIN-$(os))/g" \
330+
| sed -e "s/{{is_simulator}}/$$(IS_SIMULATOR-$(target))/g" \
331+
| sed -e "s/{{multiarch}}/$$(ARCH-$(target))-$$(SDK-$(target))/g" \
327332
| sed -e "s/{{tag}}/$$(OS_LOWER-$(target))-$$(VERSION_MIN-$(os))-$$(ARCH-$(target))-$$(SDK-$(target))/g" \
328333
> $$(PYTHON_SITECUSTOMIZE-$(target))
329334

patch/Python/sitecustomize.iOS.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# packages cross-platform. If the folder containing this file is on
33
# your PYTHONPATH when you invoke pip, pip will behave as if it were
44
# running on {{os}}.
5+
import collections
56
import distutils.ccompiler
67
import distutils.unixccompiler
78
import os
@@ -16,7 +17,21 @@ def custom_system():
1617

1718
platform.system = custom_system
1819

19-
# Make sysconfig.get_platform() return "{{tag}}"
20+
# Make platform.ios_ver() return an appropriate namedtuple
21+
IOSVersionInfo = collections.namedtuple(
22+
"IOSVersionInfo",
23+
["system", "release", "model", "is_simulator"]
24+
)
25+
26+
def custom_ios_ver(system="", release="", model="", is_simulator=False):
27+
return IOSVersionInfo("{{os}}", "{{version_min}}", "iPhone", {{is_simulator}})
28+
29+
platform.ios_ver = custom_ios_ver
30+
31+
# Make sys.implementation._multiarch return the multiarch description
32+
sys.implementation._multiarch = "{{multiarch}}"
33+
34+
# Make sysconfig.get_platform() return the platform tag
2035
def custom_get_platform():
2136
return "{{tag}}"
2237

0 commit comments

Comments
 (0)