Ensure all core Python rules are loaded from defs.bzl (#219)
This migrates rules_python itself for bazelbuild/bazel#9006. This entails
adding or updating load() statements to refer to //python:defs.bzl (not
//python:python.bzl), and updating whl.py so the generated repos refer to
@rules_python. Also updated the dependency on subpar for compatibility with
the flag. Par files are regenerated.
diff --git a/WORKSPACE b/WORKSPACE
index 5a32feb..3db5e66 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -63,7 +63,7 @@
git_repository(
name = "subpar",
remote = "https://github.com/google/subpar",
- tag = "2.0.0",
+ commit = "2917d275ee27d7935f7809413c74eddf71a46e5c", # 2019-08-02
)
###################################
diff --git a/examples/boto/BUILD b/examples/boto/BUILD
index 414f6df..0bac9f6 100644
--- a/examples/boto/BUILD
+++ b/examples/boto/BUILD
@@ -16,7 +16,7 @@
licenses(["notice"]) # Apache 2.0
load("@examples_boto//:requirements.bzl", "requirement")
-load("//python:python.bzl", "py_test")
+load("//python:defs.bzl", "py_test")
py_test(
name = "boto_test",
diff --git a/examples/extras/BUILD b/examples/extras/BUILD
index 04498ad..349b12a 100644
--- a/examples/extras/BUILD
+++ b/examples/extras/BUILD
@@ -16,7 +16,7 @@
licenses(["notice"]) # Apache 2.0
load("@examples_extras//:requirements.bzl", "requirement")
-load("//python:python.bzl", "py_test")
+load("//python:defs.bzl", "py_test")
py_test(
name = "extras_test",
diff --git a/examples/helloworld/BUILD b/examples/helloworld/BUILD
index 854f701..43ac6c1 100644
--- a/examples/helloworld/BUILD
+++ b/examples/helloworld/BUILD
@@ -16,7 +16,7 @@
licenses(["notice"]) # Apache 2.0
load("@examples_helloworld//:requirements.bzl", "requirement")
-load("//python:python.bzl", "py_library", "py_test")
+load("//python:defs.bzl", "py_library", "py_test")
py_library(
name = "helloworld",
diff --git a/examples/version/BUILD b/examples/version/BUILD
index 4a890d8..6c6d8e4 100644
--- a/examples/version/BUILD
+++ b/examples/version/BUILD
@@ -16,7 +16,7 @@
licenses(["notice"]) # Apache 2.0
load("@examples_version//:requirements.bzl", "requirement")
-load("//python:python.bzl", "py_test")
+load("//python:defs.bzl", "py_test")
py_test(
name = "version_test",
diff --git a/experimental/examples/wheel/BUILD b/experimental/examples/wheel/BUILD
index 5c3bff6..eedcd0c 100644
--- a/experimental/examples/wheel/BUILD
+++ b/experimental/examples/wheel/BUILD
@@ -15,7 +15,7 @@
licenses(["notice"]) # Apache 2.0
-load("//python:python.bzl", "py_library", "py_test")
+load("//python:defs.bzl", "py_library", "py_test")
load("//experimental/python:wheel.bzl", "py_package", "py_wheel")
py_library(
diff --git a/experimental/examples/wheel/lib/BUILD b/experimental/examples/wheel/lib/BUILD
index 6b01b1b..2dcc089 100644
--- a/experimental/examples/wheel/lib/BUILD
+++ b/experimental/examples/wheel/lib/BUILD
@@ -15,7 +15,7 @@
licenses(["notice"]) # Apache 2.0
-load("//python:python.bzl", "py_library")
+load("//python:defs.bzl", "py_library")
py_library(
name = "simple_module",
diff --git a/experimental/rules_python/BUILD b/experimental/rules_python/BUILD
index 5f770a1..cb0af7a 100644
--- a/experimental/rules_python/BUILD
+++ b/experimental/rules_python/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//python:python.bzl", "py_binary")
+load("//python:defs.bzl", "py_binary")
py_binary(
name = "wheelmaker",
diff --git a/rules_python/BUILD b/rules_python/BUILD
index 6c23e01..f0bb1d4 100644
--- a/rules_python/BUILD
+++ b/rules_python/BUILD
@@ -15,7 +15,8 @@
licenses(["notice"]) # Apache 2.0
-load("//python:python.bzl", "py_binary", "py_library", "py_test")
+load("//python:defs.bzl", "py_library", "py_test")
+load("@subpar//:subpar.bzl", "par_binary")
load("@piptool_deps//:requirements.bzl", "requirement")
py_library(
@@ -42,8 +43,6 @@
],
)
-load("@subpar//:subpar.bzl", "par_binary")
-
par_binary(
name = "piptool",
srcs = ["piptool.py"],
diff --git a/rules_python/whl.py b/rules_python/whl.py
index b397fe2..63a6d62 100644
--- a/rules_python/whl.py
+++ b/rules_python/whl.py
@@ -142,6 +142,7 @@
f.write("""
package(default_visibility = ["//visibility:public"])
+load("@rules_python//python:defs.bzl", "py_library")
load("{requirements}", "requirement")
py_library(
diff --git a/tools/piptool.par b/tools/piptool.par
index 49d1dad..4b7d744 100755
--- a/tools/piptool.par
+++ b/tools/piptool.par
Binary files differ
diff --git a/tools/whltool.par b/tools/whltool.par
index 07b40b3..46dd1e5 100755
--- a/tools/whltool.par
+++ b/tools/whltool.par
Binary files differ