refactor(cc): simplify _current_py_cc_libs_impl - #3993
Merged
Conversation
…filtering Commit 0d6016f accidentally added complex filtering logic for static libraries, DLLs, and runfiles to _current_py_cc_libs_impl. Simplify the rule implementation to return py_cc_toolchain.libs.providers_map.values() directly.
…oolchain rule Windows toolchain libraries use system_provided=True in cc_import, which leaves DefaultInfo empty and causes $(locations //python/cc:current_py_cc_libs) to expand to no files. Introduce a private py_extension_libs rule in py_extension_rule.bzl that uses toolchain resolution to extract linkable .lib files from CcInfo.linking_context and returns them in DefaultInfo for MSVC link.exe.
…target Add tags = ["manual"] to the internal py_extension_libs helper target in py_extension_macro.bzl to prevent it from being implicitly built when wildcard target patterns are built.
rickeylev
force-pushed
the
simplify_py_cc_libs
branch
from
August 3, 2026 23:30
d2acb97 to
efe13fe
Compare
rickeylev
marked this pull request as ready for review
August 4, 2026 02:50
Collaborator
Author
|
Ok, this is ready now. I think there's a more proper fix that needs to go into the toolchain, but i couldn't figure out how windows .lib files are supposed to make their way into downstream consumers. So this works for now. |
rickeylev
enabled auto-merge
August 4, 2026 02:51
aignas
approved these changes
Aug 4, 2026
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.
Commit 0d6016f accidentally added complex filtering logic for static libraries and DLLs to
_current_py_cc_libs_implinpython/private/current_py_cc_libs.bzl. That extra filtering logic was actually a hack to support another hack inpy_extension, and shouldn't have been added.To simplify, update
_current_py_cc_libs_implto returnpy_cc_toolchain.libs.providers_map.values()directly.Since Windows was relying on that hack, move it into a helper rule in the
py_extension implementation.