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

Always include interpreter constraints in PEXes. #11733

Merged
merged 2 commits into from
Mar 19, 2021
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
1 change: 1 addition & 0 deletions .github/workflows/test-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ jobs:
- 3.8.3
test_python_macos:
env:
ARCHFLAGS: -arch x86_64
PANTS_CONFIG_FILES: +['pants.ci.toml', 'pants.remote-cache.toml']
name: Test Python (MacOS)
needs: bootstrap_pants_macos
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ jobs:
- 3.7.10
test_python_macos:
env:
ARCHFLAGS: -arch x86_64
PANTS_CONFIG_FILES: +['pants.ci.toml', 'pants.remote-cache.toml']
name: Test Python (MacOS)
needs: bootstrap_pants_macos
Expand Down
7 changes: 6 additions & 1 deletion build-support/bin/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ def test_workflow_jobs(python_versions: Sequence[str]) -> Jobs:
"runs-on": "macos-10.15",
"needs": "bootstrap_pants_macos",
"strategy": {"matrix": {"python-version": python_versions}},
"env": {**pants_config_files()},
"env": {
# Works around bad `-arch arm64` flag embedded in Xcode 12.x Python interpreters on
# intel machines. See: https://github.com/giampaolo/psutil/issues/1832
"ARCHFLAGS": "-arch x86_64",
**pants_config_files(),
},
"steps": [
{"name": "Check out code", "uses": "actions/checkout@v2"},
*setup_primary_python(),
Expand Down
7 changes: 7 additions & 0 deletions pants.ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ ci_env_variables = [

[buildsense]
enable = true

[subprocess-environment]
env_vars.add = [
# Works around bad `-arch arm64` flag embedded in Xcode 12.x Python interpreters on intel
# machines. See: https://github.com/giampaolo/psutil/issues/1832
"ARCHFLAGS",
jsirois marked this conversation as resolved.
Show resolved Hide resolved
]
4 changes: 1 addition & 3 deletions src/python/pants/backend/python/util_rules/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,16 +583,14 @@ async def build_pex(
# constraints.
argv.extend(request.platforms.generate_pex_arg_list())
else:
argv.extend(request.interpreter_constraints.generate_pex_arg_list())
# NB: If it's an internal_only PEX, we do our own lookup of the interpreter based on the
# interpreter constraints, and then will run the PEX with that specific interpreter. We
# will have already validated that there were no platforms.
# Otherwise, we let Pex resolve the constraints.
if request.internal_only:
python = await Get(
PythonExecutable, PexInterpreterConstraints, request.interpreter_constraints
)
else:
argv.extend(request.interpreter_constraints.generate_pex_arg_list())

argv.append("--no-emit-warnings")

Expand Down