Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ios_ver and _multiarch shims for pip 24.3 support. #237

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
ifneq ($(os),macOS)
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))
IS_SIMULATOR-$(target)="False"
else
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))-simulator
IS_SIMULATOR-$(target)="True"
endif
endif

Expand Down Expand Up @@ -324,6 +326,9 @@ $$(PYTHON_SITECUSTOMIZE-$(target)):
cat $(PROJECT_DIR)/patch/Python/sitecustomize.$(os).py \
| sed -e "s/{{os}}/$(os)/g" \
| sed -e "s/{{arch}}/$$(ARCH-$(target))/g" \
| sed -e "s/{{version_min}}/$$(VERSION_MIN-$(os))/g" \
| sed -e "s/{{is_simulator}}/$$(IS_SIMULATOR-$(target))/g" \
| sed -e "s/{{multiarch}}/$$(ARCH-$(target))-$$(SDK-$(target))/g" \
| sed -e "s/{{tag}}/$$(OS_LOWER-$(target))-$$(VERSION_MIN-$(os))-$$(ARCH-$(target))-$$(SDK-$(target))/g" \
> $$(PYTHON_SITECUSTOMIZE-$(target))

Expand Down
17 changes: 16 additions & 1 deletion patch/Python/sitecustomize.iOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# packages cross-platform. If the folder containing this file is on
# your PYTHONPATH when you invoke pip, pip will behave as if it were
# running on {{os}}.
import collections
import distutils.ccompiler
import distutils.unixccompiler
import os
Expand All @@ -16,7 +17,21 @@ def custom_system():

platform.system = custom_system

# Make sysconfig.get_platform() return "{{tag}}"
# Make platform.ios_ver() return an appropriate namedtuple
IOSVersionInfo = collections.namedtuple(
"IOSVersionInfo",
["system", "release", "model", "is_simulator"]
)

def custom_ios_ver(system="", release="", model="", is_simulator=False):
return IOSVersionInfo("{{os}}", "{{version_min}}", "iPhone", {{is_simulator}})

platform.ios_ver = custom_ios_ver

# Make sys.implementation._multiarch return the multiarch description
sys.implementation._multiarch = "{{multiarch}}"

# Make sysconfig.get_platform() return the platform tag
def custom_get_platform():
return "{{tag}}"

Expand Down