aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/py
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-05-01 09:06:26 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-01 10:31:07 -0700
commita642a6ecf6685a73e7923c94ff69db47d67aa079 (patch)
treee5f8719679f7566d405dd9208f195a1fee324dc6 /third_party/py
parent00544564b9438a220c79fb554d39cb0e212bfd27 (diff)
Enabling python configuration to use a remotely generated configuration. This will prepare TF for use of Bazel's new remote execution api.
Change: 154726835
Diffstat (limited to 'third_party/py')
-rw-r--r--third_party/py/python_configure.bzl17
-rw-r--r--third_party/py/remote.BUILD.tpl13
2 files changed, 28 insertions, 2 deletions
diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl
index 460a9b5d05..928bd333c6 100644
--- a/third_party/py/python_configure.bzl
+++ b/third_party/py/python_configure.bzl
@@ -112,6 +112,7 @@ def _genrule(src_dir, genrule_name, command, outs):
' cmd = """\n' +
command +
' """,\n' +
+ ' visibility = ["//visibility:private"],' +
')\n'
)
@@ -157,7 +158,7 @@ def _get_numpy_include(repository_ctx, python_bin):
return result.stdout.splitlines()[0]
-def _create_python_repository(repository_ctx):
+def _create_local_python_repository(repository_ctx):
"""Creates the repository containing files set up to build with Python."""
python_include = None
numpy_include = None
@@ -208,9 +209,20 @@ def _create_python_repository(repository_ctx):
})
+def _create_remote_python_repository(repository_ctx):
+ """Creates pointers to a remotely configured repo set up to build with Python.
+ """
+ _tpl(repository_ctx, "remote.BUILD", {
+ "%{REMOTE_PYTHON_REPO}": repository_ctx.attr.remote_config_repo,
+ }, "BUILD")
+
+
def _python_autoconf_impl(repository_ctx):
"""Implementation of the python_autoconf repository rule."""
- _create_python_repository(repository_ctx)
+ if repository_ctx.attr.remote_config_repo != "":
+ _create_remote_python_repository(repository_ctx)
+ else:
+ _create_local_python_repository(repository_ctx)
python_configure = repository_rule(
@@ -219,6 +231,7 @@ python_configure = repository_rule(
"local_checks": attr.bool(mandatory = False, default = True),
"python_include": attr.string(mandatory = False),
"numpy_include": attr.string(mandatory = False),
+ "remote_config_repo": attr.string(mandatory = False, default =""),
},
environ = [
_PYTHON_BIN_PATH,
diff --git a/third_party/py/remote.BUILD.tpl b/third_party/py/remote.BUILD.tpl
new file mode 100644
index 0000000000..332508ec84
--- /dev/null
+++ b/third_party/py/remote.BUILD.tpl
@@ -0,0 +1,13 @@
+licenses(["restricted"])
+
+package(default_visibility = ["//visibility:public"])
+
+alias(
+ name = "python_headers",
+ actual = "@%{REMOTE_PYTHON_REPO}//:python_headers",
+)
+
+alias(
+ name = "numpy_headers",
+ actual = "@%{REMOTE_PYTHON_REPO}//:numpy_headers",
+)