Skip to content
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
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## 2.85.3

This release upgrades vendored `packaginged for Python>=3.8 to the latest release; bringing some bug
fixes and performance improvements.

* Upgrade vendored `packaging` to 26.0 for Python>=3.8. (#3083)

## 2.85.2

This release makes running a PEX using venv-execution and sh-bootstrapping (that is, build with
Expand Down
2 changes: 1 addition & 1 deletion pex/vendor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def iter_vendor_specs(
yield VendorSpec.pinned("packaging", "24.0", import_path="packaging_24_0")
if not python_major_minor or python_major_minor >= (3, 8):
# Modern packaging for everyone else.
yield VendorSpec.pinned("packaging", "25.0", import_path="packaging_25_0")
yield VendorSpec.pinned("packaging", "26.0", import_path="packaging_26_0")

# N.B.: All vendored items below are optional and may not be present in Pex distributions
# targeting newer Pythons.
Expand Down
3 changes: 1 addition & 2 deletions pex/vendor/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
safe_open,
safe_rmtree,
)
from pex.pep_427 import ZipMetadata
from pex.typing import TYPE_CHECKING
from pex.vendor import VendorSpec, iter_vendor_specs

Expand Down Expand Up @@ -491,7 +490,7 @@ def vendorize(root_dir, vendor_specs, prefix, update):
# Import all code needed below now before we move any vendored bits it depends on temporarily
# back to the prefix site-packages dir.
from pex.dist_metadata import ProjectNameAndVersion, Requirement
from pex.pep_427 import InstallableWheel, InstallPaths, install_wheel_chroot
from pex.pep_427 import InstallableWheel, InstallPaths, ZipMetadata, install_wheel_chroot
from pex.wheel import Wheel

for vendor_spec in vendor_specs:
Expand Down
1 change: 0 additions & 1 deletion pex/vendor/_vendored/packaging_25_0/.layout.json

This file was deleted.

1 change: 0 additions & 1 deletion pex/vendor/_vendored/packaging_25_0/constraints.txt

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions pex/vendor/_vendored/packaging_26_0/.layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"fingerprint":"29da023f25cc72013236649eded0c5ed67f15be66f5cb903b3de1ce8e3d39a12","record_relpath":"packaging-26.0.dist-info/RECORD","root_is_purelib":true,"stash_dir":".prefix","sys_path_entries":["."]}
1 change: 1 addition & 0 deletions pex/vendor/_vendored/packaging_26_0/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packaging==26.0
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Metadata-Version: 2.4
Name: packaging
Version: 25.0
Version: 26.0
Summary: Core utilities for Python packages
Author-email: Donald Stufft <donald@stufft.io>
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-Expression: Apache-2.0 OR BSD-2-Clause
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Expand All @@ -18,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Typing :: Typed
Expand All @@ -42,7 +42,7 @@ or benefit greatly from having a single shared implementation (eg: :pep:`425`).
.. end-intro

The ``packaging`` project includes the following: version handling, specifiers,
markers, requirements, tags, utilities.
markers, requirements, tags, metadata, lockfiles, utilities.

Documentation
-------------
Expand All @@ -54,6 +54,8 @@ The `documentation`_ provides information and the API for the following:
- Markers
- Requirements
- Tags
- Metadata
- Lockfiles
- Utilities

Installation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
packaging/__init__.py,sha256=y4lVbpeBzCGk-IPDw5BGBZ_b0P3ukEEJZAbGYc6Ey8c,494
packaging/_elffile.py,sha256=-sKkptYqzYw2-x3QByJa5mB4rfPWu1pxkZHRx1WAFCY,3211
packaging/_manylinux.py,sha256=Hf6nB0cOrayEs96-p3oIXAgGnFquv20DO5l-o2_Xnv0,9559
packaging/_musllinux.py,sha256=Z6swjH3MA7XS3qXnmMN7QPhqP3fnoYI0eQ18e9-HgAE,2707
packaging/_parser.py,sha256=U_DajsEx2VoC_F46fSVV3hDKNCWoQYkPkasO3dld0ig,10518
packaging/_structures.py,sha256=Hn49Ta8zV9Wo8GiCL8Nl2ARZY983Un3pruZGVNldPwE,1514
packaging/_tokenizer.py,sha256=M8EwNIdXeL9NMFuFrQtiOKwjka_xFx8KjRQnfE8O_z8,5421
packaging/markers.py,sha256=ZX-cLvW1S3cZcEc0fHI4z7zSx5U2T19yMpDP_mE-CYw,12771
packaging/metadata.py,sha256=CWVZpN_HfoYMSSDuCP7igOvGgqA9AOmpW8f3qTisfnc,39360
packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
packaging/pylock.py,sha256=-R1uNfJ4PaLto7Mg62YsGOHgvskuiIEqPwxOywl42Jk,22537
packaging/requirements.py,sha256=PMCAWD8aNMnVD-6uZMedhBuAVX2573eZ4yPBLXmz04I,2870
packaging/specifiers.py,sha256=EPNPimY_zFivthv1vdjZYz5IqkKGsnKR2yKh-EVyvZw,40797
packaging/tags.py,sha256=cXLV1pJD3UtJlDg7Wz3zrfdQhRZqr8jumSAKKAAd2xE,22856
packaging/utils.py,sha256=N4c6oZzFJy6klTZ3AnkNz7sSkJesuFWPp68LA3B5dAo,5040
packaging/version.py,sha256=7XWlL2IDYLwDYC0ht6cFEhapLwLWbmyo4rb7sEFj0x8,23272
packaging/licenses/__init__.py,sha256=TwXLHZCXwSgdFwRLPxW602T6mSieunSFHM6fp8pgW78,5819
packaging/licenses/_spdx.py,sha256=WW7DXiyg68up_YND_wpRYlr1SHhiV4FfJLQffghhMxQ,51122
packaging-26.0.dist-info/licenses/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
packaging-26.0.dist-info/licenses/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
packaging-26.0.dist-info/licenses/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
packaging-26.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
packaging-26.0.dist-info/METADATA,sha256=M2K7fWom2iliuo2qpHhc0LrKwhq6kIoRlcyPWVgKJlo,3309
packaging-26.0.dist-info/RECORD,,
packaging-26.0.pex-info/original-whl-info.json,sha256=ApLI2GD9TLww5TprMfDDmOIx2ZQB9nQ6PFdy-BV9Vus,1534
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"entries":[["packaging/__init__.py",[2026,1,20,19,7,24],2175008768],["packaging/_elffile.py",[2026,1,20,19,7,24],2175008768],["packaging/_manylinux.py",[2026,1,20,19,7,24],2175008768],["packaging/_musllinux.py",[2026,1,20,19,7,24],2175008768],["packaging/_parser.py",[2026,1,20,19,7,24],2175008768],["packaging/_structures.py",[2026,1,20,19,7,24],2175008768],["packaging/_tokenizer.py",[2026,1,20,19,7,24],2175008768],["packaging/markers.py",[2026,1,20,19,7,24],2175008768],["packaging/metadata.py",[2026,1,20,19,7,24],2175008768],["packaging/py.typed",[2026,1,20,19,7,24],2175008768],["packaging/pylock.py",[2026,1,20,19,7,24],2175008768],["packaging/requirements.py",[2026,1,20,19,7,24],2175008768],["packaging/specifiers.py",[2026,1,20,19,7,24],2175008768],["packaging/tags.py",[2026,1,20,19,7,24],2175008768],["packaging/utils.py",[2026,1,20,19,7,24],2175008768],["packaging/version.py",[2026,1,20,19,7,24],2175008768],["packaging/licenses/__init__.py",[2026,1,20,19,7,24],2175008768],["packaging/licenses/_spdx.py",[2026,1,20,19,7,24],2175008768],["packaging-26.0.dist-info/licenses/LICENSE",[2026,1,20,19,7,24],2175008768],["packaging-26.0.dist-info/licenses/LICENSE.APACHE",[2026,1,20,19,7,24],2175008768],["packaging-26.0.dist-info/licenses/LICENSE.BSD",[2026,1,20,19,7,24],2175008768],["packaging-26.0.dist-info/WHEEL",[2016,1,1,0,0,0],2175008768],["packaging-26.0.dist-info/METADATA",[2016,1,1,0,0,0],2175008768],["packaging-26.0.dist-info/RECORD",[2016,1,1,0,0,0],2175008768]],"filename":"packaging-26.0-py3-none-any.whl"}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "25.0"
__version__ = "26.0"

__author__ = "Donald Stufft and individual contributors"
__email__ = "donald@stufft.io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This provides a class ``ELFFile`` that parses an ELF executable in a similar
interface to ``ZipFile``. Only the read interface is implemented.

Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca
ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
EF_ARM_ABI_VER5 = 0x05000000
EF_ARM_ABI_FLOAT_HARD = 0x00000400

_ALLOWED_ARCHS = {
"x86_64",
"aarch64",
"ppc64",
"ppc64le",
"s390x",
"loongarch64",
"riscv64",
}


# `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
# as the type for `path` until then.
Expand Down Expand Up @@ -57,16 +67,7 @@ def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:
return _is_linux_armhf(executable)
if "i686" in archs:
return _is_linux_i686(executable)
allowed_archs = {
"x86_64",
"aarch64",
"ppc64",
"ppc64le",
"s390x",
"loongarch64",
"riscv64",
}
return any(arch in allowed_archs for arch in archs)
return any(arch in _ALLOWED_ARCHS for arch in archs)


# If glibc ever changes its major version, we need to know what the last
Expand Down Expand Up @@ -106,7 +107,7 @@ def _glibc_version_string_ctypes() -> str | None:
Fallback implementation of glibc_version_string using ctypes.
"""
try:
import ctypes
import ctypes # noqa: PLC0415
except ImportError:
return None

Expand Down Expand Up @@ -150,7 +151,7 @@ def _glibc_version_string() -> str | None:
return _glibc_version_string_confstr() or _glibc_version_string_ctypes()


def _parse_glibc_version(version_str: str) -> tuple[int, int]:
def _parse_glibc_version(version_str: str) -> _GLibCVersion:
"""Parse glibc version.

We use a regexp instead of str.split because we want to discard any
Expand All @@ -165,15 +166,15 @@ def _parse_glibc_version(version_str: str) -> tuple[int, int]:
RuntimeWarning,
stacklevel=2,
)
return -1, -1
return int(m.group("major")), int(m.group("minor"))
return _GLibCVersion(-1, -1)
return _GLibCVersion(int(m.group("major")), int(m.group("minor")))


@functools.lru_cache
def _get_glibc_version() -> tuple[int, int]:
def _get_glibc_version() -> _GLibCVersion:
version_str = _glibc_version_string()
if version_str is None:
return (-1, -1)
return _GLibCVersion(-1, -1)
return _parse_glibc_version(version_str)


Expand All @@ -184,33 +185,34 @@ def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
return False
# Check for presence of _manylinux module.
try:
import _manylinux
import _manylinux # noqa: PLC0415
except ImportError:
return True
if hasattr(_manylinux, "manylinux_compatible"):
result = _manylinux.manylinux_compatible(version[0], version[1], arch)
if result is not None:
return bool(result)
return True
if version == _GLibCVersion(2, 5):
if hasattr(_manylinux, "manylinux1_compatible"):
return bool(_manylinux.manylinux1_compatible)
if version == _GLibCVersion(2, 12):
if hasattr(_manylinux, "manylinux2010_compatible"):
return bool(_manylinux.manylinux2010_compatible)
if version == _GLibCVersion(2, 17):
if hasattr(_manylinux, "manylinux2014_compatible"):
return bool(_manylinux.manylinux2014_compatible)
if version == _GLibCVersion(2, 5) and hasattr(_manylinux, "manylinux1_compatible"):
return bool(_manylinux.manylinux1_compatible)
if version == _GLibCVersion(2, 12) and hasattr(
_manylinux, "manylinux2010_compatible"
):
return bool(_manylinux.manylinux2010_compatible)
if version == _GLibCVersion(2, 17) and hasattr(
_manylinux, "manylinux2014_compatible"
):
return bool(_manylinux.manylinux2014_compatible)
return True


_LEGACY_MANYLINUX_MAP = {
_LEGACY_MANYLINUX_MAP: dict[_GLibCVersion, str] = {
# CentOS 7 w/ glibc 2.17 (PEP 599)
(2, 17): "manylinux2014",
_GLibCVersion(2, 17): "manylinux2014",
# CentOS 6 w/ glibc 2.12 (PEP 571)
(2, 12): "manylinux2010",
_GLibCVersion(2, 12): "manylinux2010",
# CentOS 5 w/ glibc 2.5 (PEP 513)
(2, 5): "manylinux1",
_GLibCVersion(2, 5): "manylinux1",
}


Expand Down Expand Up @@ -252,11 +254,9 @@ def platform_tags(archs: Sequence[str]) -> Iterator[str]:
min_minor = -1
for glibc_minor in range(glibc_max.minor, min_minor, -1):
glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)
tag = "manylinux_{}_{}".format(*glibc_version)
if _is_compatible(arch, glibc_version):
yield f"{tag}_{arch}"
# Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
if glibc_version in _LEGACY_MANYLINUX_MAP:
legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
if _is_compatible(arch, glibc_version):
yield "manylinux_{}_{}_{}".format(*glibc_version, arch)

# Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
if legacy_tag := _LEGACY_MANYLINUX_MAP.get(glibc_version):
yield f"{legacy_tag}_{arch}"
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_musl_version(executable: str) -> _MuslVersion | None:
return None
if ld is None or "musl" not in ld:
return None
proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True)
proc = subprocess.run([ld], check=False, stderr=subprocess.PIPE, text=True)
return _parse_musl_version(proc.stderr)


Expand Down
Loading
Loading