Skip to content

fix: support debian multiarch with local toolchains #3100

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

Merged
merged 4 commits into from
Jul 16, 2025
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ END_UNRELEASED_TEMPLATE
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
* (toolchains) `local_runtime_repo` now checks if the include directory exists
before attempting to watch it, fixing issues on macOS with system Python
({gh-issue}`3043`).
([#3043](https://github.com/bazel-contrib/rules_python/issues/3043)).
* (pypi) The pipstar `defaults` configuration now supports any custom platform
name.
* Multi-line python imports (e.g. with escaped newlines) are now correctly processed by Gazelle.
* (toolchains) `local_runtime_repo` works with multiarch Debian with Python 3.8
([#3099](https://github.com/bazel-contrib/rules_python/issues/3099)).

{#v0-0-0-added}
### Added
Expand Down
8 changes: 8 additions & 0 deletions python/private/get_local_runtime_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@
# of settings.
# https://stackoverflow.com/questions/47423246/get-pythons-lib-path
# For now, it seems LIBDIR has what is needed, so just use that.
# See also: MULTIARCH
"LIBDIR",
# On Debian, with multiarch enabled, prior to Python 3.10, `LIBDIR` didn't
# tell the location of the libs, just the base directory. The `MULTIARCH`
# sysconfig variable tells the subdirectory within it with the libs.
# See:
# https://wiki.debian.org/Python/MultiArch
# https://git.launchpad.net/ubuntu/+source/python3.12/tree/debian/changelog#n842
"MULTIARCH",
# The versioned libpythonX.Y.so.N file. Usually?
# It might be a static archive (.a) file instead.
"INSTSONAME",
Expand Down
6 changes: 6 additions & 0 deletions python/private/local_runtime_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def _local_runtime_repo_impl(rctx):
# In some cases, the same value is returned for multiple keys. Not clear why.
shared_lib_names = {v: None for v in shared_lib_names}.keys()
shared_lib_dir = info["LIBDIR"]
multiarch = info["MULTIARCH"]

# The specific files are symlinked instead of the whole directory
# because it can point to a directory that has more than just
Expand All @@ -135,6 +136,11 @@ def _local_runtime_repo_impl(rctx):
for name in shared_lib_names:
origin = rctx.path("{}/{}".format(shared_lib_dir, name))

# If the origin doesn't exist, try the multiarch location, in case
# it's an older Python / Debian release.
if not origin.exists and multiarch:
origin = rctx.path("{}/{}/{}".format(shared_lib_dir, multiarch, name))

# The reported names don't always exist; it depends on the particulars
# of the runtime installation.
if origin.exists:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy