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

[build] Remove two constants from python's version.bzl #22357

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Dec 28, 2024

Towards #22346 and #20731.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added priority: medium status: single reviewer ok https://drake.mit.edu/reviewable.html release notes: none This pull request should not be mentioned in the release notes labels Dec 28, 2024
These constants unnecessarily couple our BUILD files to our repository
rule, without the py_toolchain as an intermediary. Our goal is to use
the toolchain to fully encapsulate the selected python interpreter.

(1) PYTHON_EXTENSION_SUFFIX

Simplify how pydrake module shared libraries are named in our binary
packages. The importlib.machinery package defines many possible values
for valid EXTENSION_SUFFIXES (i.e., the filename extension used for
native code), e.g., on Ubuntu 22.04 the possible values are
['.cpython-310-x86_64-linux-gnu.so', '.abi3.so', '.so']. Previously we
used the first choice (with the python version baked in) but this is
awkward, so now we use the last option (plain '.so'). The distinction
would only matter if we packaged builds for multiple python versions
into the same release artifact at once, which we never do. The first
choice would also have become moot after we switch to using ABI 3 in
the future (in which case we'll use the middle choice).

Ditto for lcm-python's shared library.

(2) PYTHON_SITE_PACKAGES

This is no longer provided as an opaque constant; its correct value is
trivially derivable from the Python version number so we'll just use
the longhand anywhere we need such a path.

While we're anyway cleaning up the repository.bzl, we also inline the
"interpreter_attrs" dictionary because its name was a lie and keeping
it out-of-line doesn't gain us anything anyway.
@jwnimmer-tri jwnimmer-tri force-pushed the repo-python-no-site-no-ext branch from 1d493b2 to fd852bd Compare January 2, 2025 16:59
@jwnimmer-tri
Copy link
Collaborator Author

+@rpoyner-tri for both reviews, please.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee rpoyner-tri(platform)

@rpoyner-tri rpoyner-tri merged commit f19d31c into RobotLocomotion:master Jan 2, 2025
10 checks passed
@jwnimmer-tri jwnimmer-tri deleted the repo-python-no-site-no-ext branch January 2, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: none This pull request should not be mentioned in the release notes status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants