-
Notifications
You must be signed in to change notification settings - Fork 3k
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 support for PEP 730 iOS packaging #12962
Merged
+255
−9
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
87efd2f
Add compatibility tag handling for iOS.
freakboy3742 dd087aa
Add patch from pypa/packaging#832.
freakboy3742 1448fd1
Add changenote.
freakboy3742 09cce69
Correct linting issue.
freakboy3742 9d6e25d
Add patch file for packaging.
freakboy3742 13dab6c
Correct usage of invalid File URL in test.
freakboy3742 a9cb9c5
Merge branch 'main' into ios-support
freakboy3742 5d567de
Ensure iOS platform tags are correctly normalized.
freakboy3742 c28faca
Add patch to distlib to disable simple shebangs on cross compiles.
freakboy3742 753742b
Correct pre-commit issue.
freakboy3742 ec137f3
Update packaging patch to reflect changes from code review.
freakboy3742 a3859c1
Minor tweak to packaging patch.
freakboy3742 ac5c8df
Merge branch 'main' into ios-support
freakboy3742 9a8e6a7
Merge branch 'main' into ios-support
jezdez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Support for PEP 730 iOS wheels was added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
diff --git a/src/pip/_vendor/packaging/tags.py b/src/pip/_vendor/packaging/tags.py | ||
index 6667d2990..bcc6ea041 100644 | ||
--- a/src/pip/_vendor/packaging/tags.py | ||
+++ b/src/pip/_vendor/packaging/tags.py | ||
@@ -25,7 +25,7 @@ from . import _manylinux, _musllinux | ||
logger = logging.getLogger(__name__) | ||
|
||
PythonVersion = Sequence[int] | ||
-MacVersion = Tuple[int, int] | ||
+AppleVersion = Tuple[int, int] | ||
|
||
INTERPRETER_SHORT_NAMES: dict[str, str] = { | ||
"python": "py", # Generic. | ||
@@ -363,7 +363,7 @@ def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: | ||
return "i386" | ||
|
||
|
||
-def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> list[str]: | ||
+def _mac_binary_formats(version: AppleVersion, cpu_arch: str) -> list[str]: | ||
formats = [cpu_arch] | ||
if cpu_arch == "x86_64": | ||
if version < (10, 4): | ||
@@ -396,7 +396,7 @@ def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> list[str]: | ||
|
||
|
||
def mac_platforms( | ||
- version: MacVersion | None = None, arch: str | None = None | ||
+ version: AppleVersion | None = None, arch: str | None = None | ||
) -> Iterator[str]: | ||
""" | ||
Yields the platform tags for a macOS system. | ||
@@ -408,7 +408,7 @@ def mac_platforms( | ||
""" | ||
version_str, _, cpu_arch = platform.mac_ver() | ||
if version is None: | ||
- version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) | ||
+ version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2]))) | ||
if version == (10, 16): | ||
# When built against an older macOS SDK, Python will report macOS 10.16 | ||
# instead of the real version. | ||
@@ -424,7 +424,7 @@ def mac_platforms( | ||
stdout=subprocess.PIPE, | ||
text=True, | ||
).stdout | ||
- version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) | ||
+ version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2]))) | ||
else: | ||
version = version | ||
if arch is None: | ||
@@ -483,6 +483,57 @@ def mac_platforms( | ||
) | ||
|
||
|
||
+def ios_platforms( | ||
+ version: AppleVersion | None = None, multiarch: str | None = None | ||
+) -> Iterator[str]: | ||
+ """ | ||
+ Yields the platform tags for an iOS system. | ||
+ | ||
+ :param version: A two-item tuple specifying the iOS version to generate | ||
+ platform tags for. Defaults to the current iOS version. | ||
+ :param multiarch: The CPU architecture+ABI to generate platform tags for - | ||
+ (the value used by `sys.implementation._multiarch` e.g., | ||
+ `arm64_iphoneos` or `x84_64_iphonesimulator`). Defaults to the current | ||
+ multiarch value. | ||
+ """ | ||
+ if version is None: | ||
+ # if iOS is the current platform, ios_ver *must* be defined. However, | ||
+ # it won't exist for CPython versions before 3.13, which causes a mypy | ||
+ # error. | ||
+ _, release, _, _ = platform.ios_ver() # type: ignore[attr-defined] | ||
+ version = cast("AppleVersion", tuple(map(int, release.split(".")[:2]))) | ||
+ | ||
+ if multiarch is None: | ||
+ multiarch = sys.implementation._multiarch | ||
+ | ||
+ ios_platform_template = "ios_{major}_{minor}_{multiarch}" | ||
+ | ||
+ # Consider any major.minor version from iOS 12.0 to the version prior to the | ||
+ # version requested by platform. 12.0 is the first iOS version that is known | ||
+ # to have enough features to support CPython. Consider every possible minor | ||
+ # release up to X.9. There highest the minor has ever gone is 8 (14.8 and | ||
+ # 15.8) but having some extra candidates that won't ever match doesn't | ||
+ # really hurt, and it saves us from having to keep an explicit list of known | ||
+ # iOS versions in the code. | ||
+ for major in range(12, version[0]): | ||
+ for minor in range(0, 10): | ||
+ yield ios_platform_template.format( | ||
+ major=major, minor=minor, multiarch=multiarch | ||
+ ) | ||
+ | ||
+ # Consider every minor version from X.0 to the minor version prior to the | ||
+ # version requested by the platform. | ||
+ for minor in range(0, version[1]): | ||
+ yield ios_platform_template.format( | ||
+ major=version[0], minor=minor, multiarch=multiarch | ||
+ ) | ||
+ | ||
+ # Consider the actual X.Y version that was requested. | ||
+ yield ios_platform_template.format( | ||
+ major=version[0], minor=version[1], multiarch=multiarch | ||
+ ) | ||
+ | ||
+ | ||
def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: | ||
linux = _normalize_string(sysconfig.get_platform()) | ||
if not linux.startswith("linux_"): | ||
@@ -512,6 +563,8 @@ def platform_tags() -> Iterator[str]: | ||
""" | ||
if platform.system() == "Darwin": | ||
return mac_platforms() | ||
+ elif platform.system() == "iOS": | ||
+ return ios_platforms() | ||
elif platform.system() == "Linux": | ||
return _linux_platforms() | ||
else: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change has been submitted separately as #12964; it's included here to prove CI isn't failing because of this patch.