Use new iree_py_binary macro so that legacy_create_init gets set properly. (#2406)
diff --git a/.bazelrc b/.bazelrc
index eac63f0..dfafd82 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -28,6 +28,11 @@
# Actually printing output on errors is... a useful default
test --test_output=errors
+# TODO: Transition to the explicit init_py mechanism. See #2405
+# This is commented out while considering transition path but left as a
+# breadcrumb.
+# build --incompatible_default_to_explicit_init_py
+
# TensorFlow always sets these in OSS which makes it impossible to build TF
# without them...
build --define open_source_build=true
diff --git a/bindings/python/build_defs.oss.bzl b/bindings/python/build_defs.oss.bzl
index 7e51827..173d2f1 100644
--- a/bindings/python/build_defs.oss.bzl
+++ b/bindings/python/build_defs.oss.bzl
@@ -16,7 +16,7 @@
load("@iree_native_python//:build_defs.bzl", "py_extension")
load("@rules_cc//cc:defs.bzl", "cc_library")
-load("@rules_python//python:defs.bzl", "py_library", "py_test")
+load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
load("//iree:build_defs.oss.bzl", _PLATFORM_VULKAN_DEPS = "PLATFORM_VULKAN_DEPS")
NUMPY_DEPS = []
@@ -69,12 +69,14 @@
# imports
py_library(**kwargs)
+def iree_py_binary(**kwargs):
+ """Compatibility py_binary which has bazel specific args."""
+ # See: https://github.com/google/iree/issues/2405
+ py_binary(legacy_create_init = False, **kwargs)
+
def iree_py_test(**kwargs):
"""Compatibility py_test which has bazel compatible args."""
-
- # This is used when args are needed that are incompatible with upstream.
- # Presently, this includes:
- # imports
+ # See: https://github.com/google/iree/issues/2405
py_test(legacy_create_init = False, **kwargs)
def iree_py_extension(**kwargs):
diff --git a/integrations/tensorflow/e2e/BUILD b/integrations/tensorflow/e2e/BUILD
index 31fb578..823f9dc 100644
--- a/integrations/tensorflow/e2e/BUILD
+++ b/integrations/tensorflow/e2e/BUILD
@@ -22,6 +22,7 @@
"//bindings/python:build_defs.oss.bzl",
"INTREE_TENSORFLOW_PY_DEPS",
"NUMPY_DEPS",
+ "iree_py_binary",
"iree_py_test",
)
load(
@@ -36,7 +37,7 @@
# Create binaries for all test srcs to allow them to be run manually.
[
- py_binary(
+ iree_py_binary(
name = src.replace(".py", "_manual"),
srcs = [src],
main = src,