Skip to content

Fix CPU selector.#2826

Merged
jayconrod merged 1 commit intobazel-contrib:masterfrom
phst:arm64-2
Feb 22, 2021
Merged

Fix CPU selector.#2826
jayconrod merged 1 commit intobazel-contrib:masterfrom
phst:arm64-2

Conversation

@phst
Copy link
Copy Markdown
Contributor

@phst phst commented Feb 20, 2021

Using the CPU “darwin” doesn’t work correctly on ARM-64. Use the normal CPU
and operating system constraints from the @platforms repository instead.

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

Slightly improve ARM64 support on macOS.

Which issues(s) does this PR fix?

#2795 (not a complete fix, but a start)

@phst phst requested a review from jayconrod as a code owner February 20, 2021 13:19
@google-cla google-cla bot added the cla: yes label Feb 20, 2021
@phst phst force-pushed the arm64-2 branch 3 times, most recently from fc86902 to 63a52d6 Compare February 21, 2021 21:26
Using the CPU “darwin” doesn’t work correctly on ARM-64.  Use the normal CPU
and operating system constraints from the @platforms repository instead.
Copy link
Copy Markdown
Collaborator

@jayconrod jayconrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@jayconrod jayconrod merged commit 059edcc into bazel-contrib:master Feb 22, 2021
@phst phst deleted the arm64-2 branch February 22, 2021 15:38
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
This is a flag to start leveraging of the new code paths. The Starlark
implementation has been added in 1.4 and has been reverted in the latest
release candidates. The `env` variable will be a good way to roll it out
more
gradually and get more testing.

For now we are switching only the `whl_library` internals as the
`requirements.txt` files from `uv` may use `*` in `python_full_version`
and
`platform_version` that are not yet fully supported (bazel-contrib#2826).

Main goals for this is to start using Starlark implementation so that we
don't
have any hidden variables. What is more, having this in Starlark is the
most
maintainable long-term solution for supporting cross-platform builds.

Work towards bazel-contrib#260

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
Fixes:
```
ERROR: /Users/fmeum/git/rules_python/tests/pypi/env_marker_setting/BUILD.bazel:3:30: Illegal ambiguous match on configurable attribute "platform_machine" in //tests/pypi/env_marker_setting:test_expr_python_full_version_lt_negative_subject:
@@platforms//cpu:aarch64
@@platforms//cpu:arm64
Multiple matches are not allowed unless one is unambiguously more specialized or they resolve to the same value. See https://bazel.build/reference/be/functions#select.
```

Work towards bazel-contrib#2850.
Work towards bazel-contrib#2826.
yushan26 pushed a commit to yushan26/rules_go that referenced this pull request Jun 16, 2025
…rib#2856)

This reuses the previous work by @vonschultz who implemented
a PEP440 version normalizer. We extend it and use it in the
PEP508 marker evaluation.

Summary:
- Extend the normalization parser to output individual parts
  of the versions to the parsing context.
- Re-implement all of the version comparison calls to use the
  parsed version.
- Add extra validation for `.*` usage in the environment markers
- Fallback to non-version matching in the environment markers
  if one of the sides is not a version.
- Rename the original normalizer file to `version.bzl` because
  as far as Python is concerned this is the only version that
  there can be. We could in theory probably reuse this in other
  code where we are parsing the Python interpreter version many
  times, but this is left for the future.

Fixes bazel-contrib#2826
Work towards bazel-contrib#2821

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Co-authored-by: Richard Levasseur <rlevasseur@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants