Skip to content

Commit ce86558

Browse files
committed
Merge branch 'main' into exp/pypi-simplify
2 parents db8fa24 + f02c9c7 commit ce86558

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ END_UNRELEASED_TEMPLATE
8989
([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)).
9090
* (toolchains) `local_runtime_repo` now checks if the include directory exists
9191
before attempting to watch it, fixing issues on macOS with system Python
92-
({gh-issue}`3043`).
92+
([#3043](https://github.com/bazel-contrib/rules_python/issues/3043)).
9393
* (pypi) The pipstar `defaults` configuration now supports any custom platform
9494
name.
9595
* (pypi) The selection of the whls has been changed and should no longer result
9696
in ambiguous select matches ({gh-issue}`2759`) and should be much more efficient
9797
when running `bazel query` due to fewer repositories being included
9898
({gh-issue}`2849`).
9999
* Multi-line python imports (e.g. with escaped newlines) are now correctly processed by Gazelle.
100+
* (toolchains) `local_runtime_repo` works with multiarch Debian with Python 3.8
101+
([#3099](https://github.com/bazel-contrib/rules_python/issues/3099)).
100102

101103
{#v0-0-0-added}
102104
### Added

gazelle/manifest/manifest.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ func (f *File) VerifyIntegrity(manifestGeneratorHashFile, requirements io.Reader
7070
return false, fmt.Errorf("failed to verify integrity: %w", err)
7171
}
7272
valid := (f.Integrity == fmt.Sprintf("%x", integrityBytes))
73+
if (!valid) {
74+
fmt.Printf("WARN: Integrity hash was %v but expected %x\n", f.Integrity, integrityBytes)
75+
}
7376
return valid, nil
7477
}
7578

python/private/get_local_runtime_info.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@
3535
# of settings.
3636
# https://stackoverflow.com/questions/47423246/get-pythons-lib-path
3737
# For now, it seems LIBDIR has what is needed, so just use that.
38+
# See also: MULTIARCH
3839
"LIBDIR",
40+
# On Debian, with multiarch enabled, prior to Python 3.10, `LIBDIR` didn't
41+
# tell the location of the libs, just the base directory. The `MULTIARCH`
42+
# sysconfig variable tells the subdirectory within it with the libs.
43+
# See:
44+
# https://wiki.debian.org/Python/MultiArch
45+
# https://git.launchpad.net/ubuntu/+source/python3.12/tree/debian/changelog#n842
46+
"MULTIARCH",
3947
# The versioned libpythonX.Y.so.N file. Usually?
4048
# It might be a static archive (.a) file instead.
4149
"INSTSONAME",

python/private/local_runtime_repo.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def _local_runtime_repo_impl(rctx):
126126
# In some cases, the same value is returned for multiple keys. Not clear why.
127127
shared_lib_names = {v: None for v in shared_lib_names}.keys()
128128
shared_lib_dir = info["LIBDIR"]
129+
multiarch = info["MULTIARCH"]
129130

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

139+
# If the origin doesn't exist, try the multiarch location, in case
140+
# it's an older Python / Debian release.
141+
if not origin.exists and multiarch:
142+
origin = rctx.path("{}/{}/{}".format(shared_lib_dir, multiarch, name))
143+
138144
# The reported names don't always exist; it depends on the particulars
139145
# of the runtime installation.
140146
if origin.exists:

0 commit comments

Comments
 (0)