From b47a10d0a2adb1fe6c9563269f6ecb4f765aea4d Mon Sep 17 00:00:00 2001 From: Gunhan Gulsoy Date: Sat, 13 Oct 2018 23:58:31 -0700 Subject: [PATCH] Make gen_build_info genrule to use a py_binary. This makes the script more platform independent. PiperOrigin-RevId: 217028598 --- tensorflow/python/BUILD | 5 ++++- tensorflow/tensorflow.bzl | 4 ++-- tensorflow/tools/build_info/BUILD | 8 ++++---- tensorflow/tools/build_info/gen_build_info.py | 1 - 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 1a890a7938c..00577426a06 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -1113,7 +1113,10 @@ py_test( ], main = "platform/build_info_test.py", srcs_version = "PY2AND3", - tags = ["notap"], + tags = [ + "no_pip", + "notap", + ], deps = [ ":client_testlib", ":platform", diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 53a382bd498..34d6fe825f8 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -1980,9 +1980,9 @@ def tf_py_build_info_genrule(): name = "py_build_info_gen", outs = ["platform/build_info.py"], cmd = - "$(location //tensorflow/tools/build_info:gen_build_info.py) --raw_generate \"$@\" --build_config " + if_cuda("cuda", "cpu"), + "$(location //tensorflow/tools/build_info:gen_build_info) --raw_generate \"$@\" --build_config " + if_cuda("cuda", "cpu"), local = 1, - tools = [clean_dep("//tensorflow/tools/build_info:gen_build_info.py")], + tools = [clean_dep("//tensorflow/tools/build_info:gen_build_info")], ) def cc_library_with_android_deps( diff --git a/tensorflow/tools/build_info/BUILD b/tensorflow/tools/build_info/BUILD index 73074178055..680e68b0b9b 100644 --- a/tensorflow/tools/build_info/BUILD +++ b/tensorflow/tools/build_info/BUILD @@ -4,8 +4,8 @@ package(default_visibility = ["//tensorflow:internal"]) licenses(["notice"]) # Apache 2.0 -exports_files( - glob(["gen/*"]) + [ - "gen_build_info.py", - ], +py_binary( + name = "gen_build_info", + srcs = ["gen_build_info.py"], + srcs_version = "PY2AND3", ) diff --git a/tensorflow/tools/build_info/gen_build_info.py b/tensorflow/tools/build_info/gen_build_info.py index 690214abfb1..9ebd168d781 100755 --- a/tensorflow/tools/build_info/gen_build_info.py +++ b/tensorflow/tools/build_info/gen_build_info.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License");