Skip to content

Commit

Permalink
Use new iree_py_binary macro so that legacy_create_init gets set prop…
Browse files Browse the repository at this point in the history
…erly. (iree-org#2406)
  • Loading branch information
stellaraccident authored Jul 3, 2020
1 parent a445d51 commit 8a25757
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ common --experimental_repo_remote_exec
# 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
Expand Down
12 changes: 7 additions & 5 deletions bindings/python/build_defs.oss.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -69,12 +69,14 @@ def iree_py_library(**kwargs):
# 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):
Expand Down
3 changes: 2 additions & 1 deletion integrations/tensorflow/e2e/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ load(
"//bindings/python:build_defs.oss.bzl",
"INTREE_TENSORFLOW_PY_DEPS",
"NUMPY_DEPS",
"iree_py_binary",
"iree_py_test",
)
load(
Expand All @@ -36,7 +37,7 @@ package(

# 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,
Expand Down

0 comments on commit 8a25757

Please sign in to comment.