Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1362544
refactor(tests): convert legacy py_extension in local_toolchains to o…
rickeylev Aug 1, 2026
eafa37b
fix(cc): use canonical target label for Windows current_py_cc_libs ex…
rickeylev Aug 1, 2026
a83b309
fix(local_toolchains): find Windows .lib import libraries across sear…
rickeylev Aug 1, 2026
c0abefe
fix(cc): inspect py_cc_toolchain.headers in current_py_cc_libs to cap…
rickeylev Aug 1, 2026
399c6bc
revert(cc): undo inspection of headers in current_py_cc_libs while ke…
rickeylev Aug 3, 2026
7c83aa0
merge: sync with upstream/main
rickeylev Aug 5, 2026
ed3a940
fix(cc): strip platform suffix from SOABI when populating PyCcToolcha…
rickeylev Aug 5, 2026
308d291
fix(cc): add Windows interface libraries to libpython and libpython_a…
rickeylev Aug 5, 2026
45d7ab8
fix(cc): format Windows extension filenames without platform tag in p…
rickeylev Aug 5, 2026
28ab4b1
fix(cc): format Windows extension output filenames as module_name.pyd…
rickeylev Aug 5, 2026
ff2e486
test(local_toolchains): add importlib fallback for loading echo_ext i…
rickeylev Aug 5, 2026
0dad6b6
Merge remote-tracking branch 'upstream/main' into convert_legacy_py_e…
rickeylev Aug 7, 2026
c0eba81
revert: simplify echo_test.py to use direct import echo_ext
rickeylev Aug 7, 2026
1fd27da
fix(cc): omit platform_tag from soabi on Windows in py_cc_toolchain_r…
rickeylev Aug 7, 2026
7b4c4ef
fix(cc): format Windows py_extension output filename as module_name.p…
rickeylev Aug 7, 2026
debd029
fix(cc): derive Windows soabi as cpXX without platform_tag
rickeylev Aug 7, 2026
c21b244
fix(cc): format Windows output extension as module_name.pyd in py_ext…
rickeylev Aug 7, 2026
b8303bf
Merge remote-tracking branch 'upstream/main' into convert_legacy_py_e…
rickeylev Aug 7, 2026
a6009c3
revert: restore py_extension_rule, py_cc_toolchain_rule, and py_exten…
rickeylev Aug 7, 2026
aef136d
fix(tests): add env_inherit to echo_test to inherit host PATH on Windows
rickeylev Aug 7, 2026
1089ce5
fix(toolchains): normalize platform_machine to lowercase in get_local…
rickeylev Aug 7, 2026
49eedcb
docs(toolchains): add comment explaining why lower() is called on pla…
rickeylev Aug 7, 2026
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 python/private/get_local_runtime_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def _get_base_executable() -> str:
"implementation_name": sys.implementation.name,
"base_executable": _get_base_executable(),
"sys_platform": sys.platform,
"platform_machine": platform.machine(),
# Normalize to lowercase: on Windows, platform.machine() returns uppercase
# "AMD64" / "ARM64", whereas PEP 508 and toolchains expect lowercase.
"platform_machine": platform.machine().lower(),
}
data.update(_get_python_library_info(_get_base_executable()))
print(json.dumps(data))
8 changes: 8 additions & 0 deletions python/private/local_runtime_repo_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,21 @@ def define_local_runtime_toolchain_impl(
hdrs = [":includes"],
defines = defines, # NOTE: Users should define Py_LIMITED_API=3
srcs = abi3_libraries + additional_dlls,
deps = select({
"@bazel_tools//src/conditions:windows": [":abi3_interface"],
"//conditions:default": [],
}),
)

cc_library(
name = "libpython",
hdrs = [":includes"],
defines = defines,
srcs = libraries + additional_dlls,
deps = select({
"@bazel_tools//src/conditions:windows": [":interface"],
"//conditions:default": [],
}),
)

# runtime configuration
Expand Down
21 changes: 8 additions & 13 deletions tests/integration/local_toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_python//python:py_test.bzl", "py_test")
load(":py_extension.bzl", "py_extension")
load("@rules_python//python/cc:py_extension.bzl", "py_extension")

py_test(
name = "local_runtime_test",
Expand Down Expand Up @@ -60,28 +59,24 @@ string_flag(
)

# Build rules to generate a python extension.
cc_library(
name = "echo_ext_cc",
testonly = True,
srcs = ["echo_ext.cc"],
deps = [
"@rules_python//python/cc:current_py_cc_headers",
],
alwayslink = True,
)

py_extension(
name = "echo_ext",
testonly = True,
srcs = ["echo_ext.cc"],
copts = select({
"@rules_cc//cc/compiler:msvc-cl": [],
"//conditions:default": ["-fvisibility=hidden"],
}),
deps = [":echo_ext_cc"],
imports = ["."],
)

py_test(
name = "echo_test",
srcs = ["echo_test.py"],
# Make this test better respect pyenv/local Python DLLs on Windows
env_inherit = [
"PYENV_VERSION",
"PATH",
],
deps = [":echo_ext"],
)
2 changes: 1 addition & 1 deletion tests/integration/local_toolchains/echo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

class ExtensionTest(unittest.TestCase):
def test_echo_extension(self):
self.assertEqual(echo_ext.echo(42, "str"), tuple(42, "str"))
self.assertEqual(echo_ext.echo(42, "str"), (42, "str"))
154 changes: 0 additions & 154 deletions tests/integration/local_toolchains/py_extension.bzl

This file was deleted.