Skip to content

Pex --scie {eager,lazy} doesn't currently honor multiplatform PEXes where a single OS is targeted for both CPython and PyPy. #2972

@jsirois

Description

@jsirois

Currently, when creating a ScieConfiguration from PlatformSpecs, each platform spec translates to a target system platform and a provider:

pex/pex/scie/model.py

Lines 405 to 440 in 1d8eb90

if platform_spec.impl in ("py", "cp"):
# Python Build Standalone does not support CPython<3.8.
if plat_python_version < (3, 8):
continue
provider = Provider.PythonBuildStandalone
elif "pp" == platform_spec.impl:
# PyPy distributions for Linux aarch64 start with 3.7 (and PyPy always releases for
# 2.7).
if (
SysPlatform.LINUX_AARCH64 is scie_platform
and plat_python_version[0] == 3
and plat_python_version < (3, 7)
):
continue
# PyPy distributions are not available for Linux armv7l
if SysPlatform.LINUX_ARMV7L is scie_platform:
continue
# PyPy distributions for Linux ppc64le are only available for 2.7 and 3.{5,6}.
if (
SysPlatform.LINUX_PPC64LE is scie_platform
and plat_python_version[0] == 3
and plat_python_version >= (3, 7)
):
continue
# PyPy distributions for Mac arm64 start with 3.8 (and PyPy always releases for
# 2.7).
if (
SysPlatform.MACOS_AARCH64 is scie_platform
and plat_python_version[0] == 3
and plat_python_version < (3, 8)
):
continue
provider = Provider.PyPy
else:
# Pex only supports platform independent Python, CPython and PyPy.
continue

However, when we generate InterpreterDistributions we use just 1 provider per target system platform even if two different ones might have been "chosen" via PlatformSpecs. The one used is currently last-wins:

pex/pex/scie/model.py

Lines 457 to 469 in 1d8eb90

scie_targets = tuple(
InterpreterDistribution(
provider=provider,
platform=scie_platform,
release=(
options.pbs_release
if Provider.PythonBuildStandalone is provider
else options.pypy_release
),
version=max(python_versions),
)
for scie_platform, python_versions in sorted(python_versions_by_platform.items())
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gedanken-bugA potential bug derived by reading code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions