Automated rollback of commit b818cbe0a53ed8470c0353f13f18141cf2c425a1
PiperOrigin-RevId: 294115842
Change-Id: I97442754c3b8a0ac6b88d211981da494c7a3b796
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index 6962408..36c7283 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -238,8 +238,8 @@
":pywrap_tfe",
":util",
"//tensorflow/core:protos_all_py",
+ "@absl_py//absl:app",
"@absl_py//absl/flags",
- "@rules_python//python/runfiles",
"@six_archive//:six",
],
)
diff --git a/tensorflow/python/framework/file_system_test.py b/tensorflow/python/framework/file_system_test.py
index 546621f..8687bc5 100644
--- a/tensorflow/python/framework/file_system_test.py
+++ b/tensorflow/python/framework/file_system_test.py
@@ -18,6 +18,8 @@
from __future__ import division
from __future__ import print_function
+import os
+
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import test_util
from tensorflow.python.framework import load_library
@@ -31,8 +33,8 @@
class FileSystemTest(test.TestCase):
def setUp(self):
- file_system_library = resource_loader.get_path_to_datafile(
- "test_file_system.so")
+ file_system_library = os.path.join(resource_loader.get_data_files_path(),
+ "test_file_system.so")
load_library.load_file_system_library(file_system_library)
@test_util.run_deprecated_v1
diff --git a/tensorflow/python/kernel_tests/decode_jpeg_op_test.py b/tensorflow/python/kernel_tests/decode_jpeg_op_test.py
index ebde47e..8f68261 100644
--- a/tensorflow/python/kernel_tests/decode_jpeg_op_test.py
+++ b/tensorflow/python/kernel_tests/decode_jpeg_op_test.py
@@ -33,6 +33,9 @@
from tensorflow.python.platform import resource_loader
from tensorflow.python.platform import test
+prefix_path = resource_loader.get_path_to_datafile(
+ '../../core/lib/jpeg/testdata')
+
class DecodeJpegBenchmark(test.Benchmark):
"""Evaluate tensorflow DecodeJpegOp performance."""
@@ -63,8 +66,7 @@
"""
ops.reset_default_graph()
- image_file_path = resource_loader.get_path_to_datafile(
- os.path.join('core', 'lib', 'jpeg', 'testdata', image_name))
+ image_file_path = os.path.join(prefix_path, image_name)
if tile is None:
image_content = variable_scope.get_variable(
diff --git a/tensorflow/python/lib/io/tf_record_test.py b/tensorflow/python/lib/io/tf_record_test.py
index 0c71c89..cefa5a4 100644
--- a/tensorflow/python/lib/io/tf_record_test.py
+++ b/tensorflow/python/lib/io/tf_record_test.py
@@ -28,9 +28,12 @@
from tensorflow.python.framework import errors_impl
from tensorflow.python.lib.io import tf_record
+from tensorflow.python.platform import resource_loader
from tensorflow.python.platform import test
from tensorflow.python.util import compat
+prefix_path = resource_loader.get_path_to_datafile("../../../core/lib")
+
TFRecordCompressionType = tf_record.TFRecordCompressionType
# Edgar Allan Poe's 'Eldorado'
diff --git a/tensorflow/python/platform/resource_loader.py b/tensorflow/python/platform/resource_loader.py
index 088fdf8..8f4c5c1 100644
--- a/tensorflow/python/platform/resource_loader.py
+++ b/tensorflow/python/platform/resource_loader.py
@@ -20,8 +20,6 @@
import os as _os
import sys as _sys
-from rules_python.python.runfiles import runfiles
-
from tensorflow.python.util import tf_inspect as _inspect
from tensorflow.python.util.tf_export import tf_export
@@ -39,7 +37,11 @@
Raises:
IOError: If the path is not found, or the resource can't be opened.
"""
- with open(get_path_to_datafile(path), 'rb') as f:
+ tensorflow_root = (_os.path.join(
+ _os.path.dirname(__file__), _os.pardir, _os.pardir))
+ path = _os.path.join(tensorflow_root, path)
+ path = _os.path.abspath(path)
+ with open(path, 'rb') as f:
return f.read()
@@ -111,17 +113,8 @@
Raises:
IOError: If the path is not found, or the resource can't be opened.
"""
- # First, try finding in the new path.
- r = runfiles.Create()
- new_fpath = r.Rlocation(
- _os.path.abspath(_os.path.join('tensorflow', path)))
- if new_fpath is not None and _os.path.exists(new_fpath):
- return new_fpath
-
- # Then, the old style path, as people became dependent on this buggy call.
- old_filepath = _os.path.join(
- _os.path.dirname(_inspect.getfile(_sys._getframe(1))), path)
- return old_filepath
+ data_files_path = _os.path.dirname(_inspect.getfile(_sys._getframe(1)))
+ return _os.path.join(data_files_path, path)
@tf_export(v1=['resource_loader.readahead_file_path'])
diff --git a/tensorflow/tools/api/tests/api_compatibility_test.py b/tensorflow/tools/api/tests/api_compatibility_test.py
index fe71887..2b1065e 100644
--- a/tensorflow/tools/api/tests/api_compatibility_test.py
+++ b/tensorflow/tools/api/tests/api_compatibility_test.py
@@ -79,10 +79,8 @@
false, only print which libraries have differences.
"""
-_API_GOLDEN_FOLDER_V1 = os.path.join(
- resource_loader.get_data_files_path(), '..', 'golden', 'v1')
-_API_GOLDEN_FOLDER_V2 = os.path.join(
- resource_loader.get_data_files_path(), '..', 'golden', 'v2')
+_API_GOLDEN_FOLDER_V1 = resource_loader.get_path_to_datafile('../golden/v1')
+_API_GOLDEN_FOLDER_V2 = resource_loader.get_path_to_datafile('../golden/v2')
_TEST_README_FILE = resource_loader.get_path_to_datafile('README.txt')
_UPDATE_WARNING_FILE = resource_loader.get_path_to_datafile(
'API_UPDATE_WARNING.txt')
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 950199d..5e6260c 100755
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -905,15 +905,6 @@
)
tf_http_archive(
- name = "rules_python",
- sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
- urls = [
- "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
- "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
- ],
- )
-
- tf_http_archive(
name = "build_bazel_rules_android",
sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
strip_prefix = "rules_android-0.1.1",