refactor(tests): convert legacy py_extension in local_toolchains to official rule - #3988
Open
rickeylev wants to merge 4 commits into
Open
refactor(tests): convert legacy py_extension in local_toolchains to official rule#3988rickeylev wants to merge 4 commits into
rickeylev wants to merge 4 commits into
Conversation
…fficial rule The local_toolchains integration test workspace previously relied on a custom, partial implementation of py_extension that predated the official rule. Replace this legacy test implementation with the official @rules_python//python/cc:py_extension.bzl rule, simplifying the target definition to use sources directly.
rickeylev
enabled auto-merge
August 1, 2026 22:16
…pansion When py_extension is invoked from an external module/workspace, expanding in user_link_flags failed on Windows because the label was not canonicalized to @rules_python//python/cc:current_py_cc_libs. Use _PY_CC_LIBS_ACTUAL_CANONICAL_TARGET in user_link_flags on Windows.
…ch directories and handle empty link_files On Windows, when get_local_runtime_info.py finds python3xx.dll in exec_dir, the import library python3xx.lib is typically located in exec_dir/libs. Search across all search_directories for the interface library. Also ensure current_py_cc_libs never outputs an empty DefaultInfo.files so expansion in py_extension user_link_flags does not crash.
rickeylev
marked this pull request as draft
August 1, 2026 22:30
auto-merge was automatically disabled
August 1, 2026 22:30
Pull request was converted to draft
Collaborator
Author
|
Oh windows...making this difficult again. Lets see how many commits it takes to figure it out this time |
…ture Windows local toolchain import libraries For local Python runtimes on Windows, the CPython interface library (python3xx.lib) is attached to py_cc_toolchain.headers rather than py_cc_toolchain.libs. By checking the linking_context of both headers and libs in _current_py_cc_libs_impl, current_py_cc_libs properly collects the .lib import library on Windows so MSVC link.exe receives valid import libraries.
rickeylev
marked this pull request as ready for review
August 2, 2026 00:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The local_toolchains integration test workspace previously relied on a
custom, partial implementation of py_extension that predated the
official rule.
Replace this legacy test implementation with the official
@rules_python//python/cc:py_extension.bzl rule, simplifying the target
definition to use sources directly.