Add internal macros and partially migrate Bazel for upcoming change
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
diff --git a/tools/python/BUILD b/tools/python/BUILD
index 3102845..3d168df 100644
--- a/tools/python/BUILD
+++ b/tools/python/BUILD
@@ -1,3 +1,4 @@
+load("//tools/python:private/defs.bzl", "py_test")
load(":utils.bzl", "expand_pyversion_template")
package(default_visibility = ["//visibility:public"])