ICM PY3 Migration - //tensorflow/tools [1]
PiperOrigin-RevId: 274268400
This commit is contained in:
parent
11650f3161
commit
bbf73b1825
@ -25,7 +25,7 @@ py_test(
|
||||
"//tensorflow/tools/api/tests:API_UPDATE_WARNING.txt",
|
||||
"//tensorflow/tools/api/tests:README.txt",
|
||||
],
|
||||
python_version = "PY2",
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY2AND3",
|
||||
tags = [
|
||||
"no_pip",
|
||||
@ -46,7 +46,7 @@ py_test(
|
||||
py_test(
|
||||
name = "deprecation_test",
|
||||
srcs = ["deprecation_test.py"],
|
||||
python_version = "PY2",
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY2AND3",
|
||||
tags = ["v1only"],
|
||||
deps = [
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Lint as: python2, python3
|
||||
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -33,6 +34,7 @@ import re
|
||||
import sys
|
||||
|
||||
import six
|
||||
from six.moves import range
|
||||
import tensorflow as tf
|
||||
|
||||
from google.protobuf import message
|
||||
@ -109,7 +111,8 @@ def _KeyToFilePath(key, api_version):
|
||||
match = matchobj.group(0)
|
||||
return '-%s' % (match.lower())
|
||||
|
||||
case_insensitive_key = re.sub('([A-Z]{1})', _ReplaceCapsWithDash, key)
|
||||
case_insensitive_key = re.sub('([A-Z]{1})', _ReplaceCapsWithDash,
|
||||
six.ensure_str(key))
|
||||
api_folder = (
|
||||
_API_GOLDEN_FOLDER_V2 if api_version == 2 else _API_GOLDEN_FOLDER_V1)
|
||||
return os.path.join(api_folder, '%s.pbtxt' % case_insensitive_key)
|
||||
@ -125,7 +128,7 @@ def _FileNameToKey(filename):
|
||||
base_filename = os.path.basename(filename)
|
||||
base_filename_without_ext = os.path.splitext(base_filename)[0]
|
||||
api_object_key = re.sub('((-[a-z]){1})', _ReplaceDashWithCaps,
|
||||
base_filename_without_ext)
|
||||
six.ensure_str(base_filename_without_ext))
|
||||
return api_object_key
|
||||
|
||||
|
||||
@ -149,8 +152,8 @@ def _FilterNonCoreGoldenFiles(golden_file_list):
|
||||
filtered_package_prefixes = ['tensorflow.%s.' % p for p in _NON_CORE_PACKAGES]
|
||||
for f in golden_file_list:
|
||||
if any(
|
||||
f.rsplit('/')[-1].startswith(pre) for pre in filtered_package_prefixes
|
||||
):
|
||||
six.ensure_str(f).rsplit('/')[-1].startswith(pre)
|
||||
for pre in filtered_package_prefixes):
|
||||
continue
|
||||
filtered_file_list.append(f)
|
||||
return filtered_file_list
|
||||
|
@ -9,6 +9,9 @@ package(
|
||||
py_binary(
|
||||
name = "gen_build_info",
|
||||
srcs = ["gen_build_info.py"],
|
||||
python_version = "PY2",
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY2AND3",
|
||||
deps = [
|
||||
"@six_archive//:six",
|
||||
],
|
||||
)
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Lint as: python2, python3
|
||||
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -16,7 +17,9 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import six
|
||||
|
||||
|
||||
def write_build_info(filename, is_config_cuda, is_config_rocm, key_value_list):
|
||||
@ -47,7 +50,7 @@ def write_build_info(filename, is_config_cuda, is_config_rocm, key_value_list):
|
||||
key_value_pair_stmts = []
|
||||
if key_value_list:
|
||||
for arg in key_value_list:
|
||||
key, value = arg.split("=")
|
||||
key, value = six.ensure_str(arg).split("=")
|
||||
if key == "is_cuda_build":
|
||||
raise ValueError("The key \"is_cuda_build\" cannot be passed as one of "
|
||||
"the --key_value arguments.")
|
||||
|
Loading…
Reference in New Issue
Block a user