Skip to content
  • brandjon's avatar
    Add internal macros and partially migrate Bazel for upcoming change · db063a85
    brandjon authored
    This adds `@bazel_tools//tools/python:private/defs.bzl`, which defines macro wrappers around the four native Python rules (`py_library`, `py_binary`, `py_test`, `py_runtime`). These wrappers simulate the behavior of `@rules_python//python:defs.bzl`, so that they are compatible with the upcoming `--incompatible_load_python_rules_from_bzl` flag.
    
    This change also updates many direct uses of the native Python rules to use the wrappers instead. However, changes to the third_party/ directory have to be in a separate commit.
    
    The new macros should only be used by Bazel itself. All external users should use @rules_python instead.
    
    I'm omitting updating src/test/py/bazel/testdata/runfiles_test/*/BUILD.mock files because they appear to be tests that shouldn't complain until the flag is flipped, and I'm not sure that adding a load won't break them. Also not updating the examples/ dir for similar reasons.
    
    Work toward #9006.
    
    RELNOTES: None
    PiperOrigin-RevId: 260858287
    db063a85