summaryrefslogtreecommitdiff
path: root/sci-libs/tensorflow-estimator
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-02-03 23:44:18 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-02-03 23:44:18 +0000
commit9becec60cd1423a327b86686a981699c0522cd79 (patch)
tree45888e8316556b1667e06ec2555a87601353747e /sci-libs/tensorflow-estimator
parentc44123f79f40edf5fe3d4b0d211d6aa68542abd2 (diff)
gentoo auto-resync : 03:02:2024 - 23:44:17
Diffstat (limited to 'sci-libs/tensorflow-estimator')
-rw-r--r--sci-libs/tensorflow-estimator/Manifest9
-rw-r--r--sci-libs/tensorflow-estimator/files/0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch29
-rw-r--r--sci-libs/tensorflow-estimator/files/0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch703
-rw-r--r--sci-libs/tensorflow-estimator/tensorflow-estimator-2.13.0.ebuild75
-rw-r--r--sci-libs/tensorflow-estimator/tensorflow-estimator-2.14.0.ebuild75
-rw-r--r--sci-libs/tensorflow-estimator/tensorflow-estimator-2.15.0.ebuild80
6 files changed, 971 insertions, 0 deletions
diff --git a/sci-libs/tensorflow-estimator/Manifest b/sci-libs/tensorflow-estimator/Manifest
index a1485c9e1d08..387d090afc85 100644
--- a/sci-libs/tensorflow-estimator/Manifest
+++ b/sci-libs/tensorflow-estimator/Manifest
@@ -1,8 +1,17 @@
+AUX 0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch 1449 BLAKE2B a7ead50569e8dd70c98e11abe7203520fa6c55195b75576c2efbe68c43435d429b60173f3c05b2e8885f7931a770c7de042da70a7df1b075f02def366c08af5b SHA512 ae8961d088954a2ad4db3996f67b578ddf11a6bda43ae596b22b156fea05a9bcda0d048aa4eee45fd8ea2e5739ca753eef7afe04020370fe6093e4cd95aa3d64
AUX 0001-Update-setup.py-for-2.11.0-final-release.patch 946 BLAKE2B ac6417e5bc0953ce69a148cfc1d56cbfe46fc2752287dc595457406def376f8cbe5379c0d2e2eb6092a15729c05c8acafa0435c6c82cea8771292953283d1eda SHA512 87cbf6c462c7209cd766c298f7ae869dc89e1b0de56da42ec4ce7e7da2d131683e15abce6be96482c8501116e3a21a4a34b1324d43c6a382956dce8ad705b579
+AUX 0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch 28494 BLAKE2B e1cb1cef771a81fd28375a8af02bfce9bf0109ff38666688a117cf6a095799c82e2b9a88dd2d42a811713778904165323a9b27950dbc0a29dca9597a4dcdb382 SHA512 63f74cb59a00f91e083bc0fc53c7646cf1f3943beaa7636a414c793a793a4bd156ce891941709706b69d91dff9532f2e72e1edd9457f69e6d2dad8380fab4772
+DIST bazelbuild-rules_cc-0.0.2.tar.gz 127138 BLAKE2B 2a4cb12096bd8e6efebb13861b259ea12266372d37ef0d6c6005c4b9a6f919c26e1caa2ac78578aefd80a4f5bf08c1a14e15df5218f5d6b949beacba116b7b33 SHA512 688b5e6ea0e4cc8e5e11fc7aaac70f88c54d2d70221df0772eea1f0ff3ec16e2e92305f76da09c3c497f29e9132870ceaec7ecad034cca678ff4303899b67c14
DIST bazelbuild-rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d.zip 201360 BLAKE2B 0173a8edb17f344b18e42026e2f8a62a1909d4694ab0be83562b6437a3f1ef38889f069269ddd2308b41062e5f375f791be0d2631a8e52ede668203779813b56 SHA512 2ba1dc316d88947c1d17ec67154c052700e3571b8d03370a9f204cf9fe94a1bd58f93a2c4a3c0b02233ee3250053a4c30a4133b5b38745858c1d04be8c9d973f
DIST bazelbuild-rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip 9422 BLAKE2B bbc45c97551ee8126335b611ffca6574dac843d4db9b3221b10d26487f8eecfe38ba0cd67a4039a3ad921c25fea6294c43e4f4e7a57a060a30791acd6c4f9d39 SHA512 ba06242feb711e7fb6e821fd9ac029248b4f3e466fb1acf971d0db8196f3efe4d114ef137acbe4913073f8cbe8ccab4d47d8bafa21b867b2d6a6d57f5a647f0c
DIST tensorflow-estimator-2.11.0-rc0.tar.gz 655514 BLAKE2B cc73f282a32f657bf507d948210aa981f0867c4898574c61fb5654204fa573ac7bdef16635d202ed3d202ccc9c8915f5613e4149ce6839d59281a38cfd6953f7 SHA512 c473a6db62a0a55f25f8fd5fd7ffb2f2a473261c5a7b3217bd1d8a21a02ab4871793ea57917c6eb9dc9012bd030faf8030702caf3f764983ce526d201866204f
DIST tensorflow-estimator-2.12.0.tar.gz 656763 BLAKE2B a67c81487b7765f3195f7567b66455a4be390bff8d6dec751d054a26b654b1aac96982f6fa55d0488a8e6414e7d4b58d1ae59680a1c694615f82718c77478872 SHA512 d86bfde67c97988beeb5abc8042c1847c6d0081d54e21e35424d463895e95a5d0adc74d7d2bb006a617748da3b9a8bbb8979d6a842f024ab3a4d08a2e806147b
+DIST tensorflow-estimator-2.13.0.tar.gz 656953 BLAKE2B 2aeae25089990914018cd713aba1289195595e67b85cc5d66b1a348b9d65c29854768118989aa0d5540eb5d70bb32ac1699584f0191460f5f23f6f8b3f9d7204 SHA512 c445a43d497c575fb6e2f7a26d5346b2db8712540f807e0bc64759db056468ada909371b29b828470c7763156570c25917157dbe0d61e9f148c3027c29ebd181
+DIST tensorflow-estimator-2.14.0.tar.gz 656933 BLAKE2B 4506b4149824f505b7f42c5c6a73daaa1d5b46201141e11e0775baa7524e0a7886cee5079bdb97af6a880d2f6dbfa276b9e484d06406f84f254b2541b2f80c5b SHA512 a2ac534acba806177400c18968a3d5384a30e4fd431eb3b9f4e1542220b1e382e9272be9909f14d6984d50591b155be5eef7051620a9133ffd199bd1e6fe4582
+DIST tensorflow-estimator-2.15.0.tar.gz 658541 BLAKE2B 519ccab7f77a3074009b3b9d24f18267abece981dc33a7716cd916b388a4306183221ec12ddb3e32ac41cbe30d936dc504d931a612b71d35093d27def5d391e8 SHA512 129fe36ee63932b324d8ee77f917d4ded99be2e645e0884bd920bebf703b63889ed72b76b14fcc3aa8f9cfd0b465428d67067fcfc43f2c761a101ea56d574d04
EBUILD tensorflow-estimator-2.11.0.ebuild 1998 BLAKE2B 4bb8eef78da79925c66c0be30a237a8e9a78a46a4113a750c886545e9bd501f3ac69a6b5cd23b7342ccad5cfc9caff75ff0633a36d247877d4883e760dfee4f5 SHA512 bd87ed367d860c73ec30e91e8ab4834a331670e83ef07e2e5fec5d1db020a55edcb1371139c730efae59ce40b19c6a77ff1de96cc510cb0eb4e77b6458984037
EBUILD tensorflow-estimator-2.12.0.ebuild 1865 BLAKE2B 9696193b35bc0164f5507f76867cfb0e1c565db6e10c6b5110ccc819a9543ff8bfbfbf816a58525c9cf01c51263115271caccdf5884b1dcdf4b296be8932f744 SHA512 d4294df14ea176a9fd727fb047c554fb11c5e57f9d174395333f7b92a8ed9a4ee2e161fe324bf2339eb997af2ac6b97cad712844dec848a3541e88b958035162
+EBUILD tensorflow-estimator-2.13.0.ebuild 1859 BLAKE2B 6fca75791dd7fbf12cd09eb528d3fe8f4901fe4ae0472e5cd4aa1e2f7995b2d4ae8f603be7ff8319a180798987df2ca072f7c9b55e21b96eff6d96f5611ae9d1 SHA512 5dca6d03c6a1f82b103519b4407e51162d422be1089749cc9013c3131b31bba23791452ff5d6c882568565c1502ab75fcd4b4c5c0eb46ca9edb2e98d1fe3db0a
+EBUILD tensorflow-estimator-2.14.0.ebuild 1820 BLAKE2B 115a47dc7ba8b347edf7b82c02759c1184417eacae2414dcec10810fcb0efc4bb84cb922538ab92ffd6d092a46ab2b278e016506f2c10e94e8930052a186109d SHA512 ab852d156cc5d1a947bd96bc98b1cf2f56530037943625f8da5decab535fee4ae1d6b034c15d5fee45c4c6e9c4a16c1a193774f6a2356c8e0294646c7936dcb3
+EBUILD tensorflow-estimator-2.15.0.ebuild 1991 BLAKE2B f94c45271ea2b13529d2daf2f81722a0cd69326c6005039f5eb080812982fe74523704863e191377780069f4b3c9d267337b9343d911d14ae05d2676b97961b7 SHA512 3ef8ea27ffb9bacf6a56ea0a2adf76c7ecd7474f4a89eac85fb0aa4ef06dee5a9f5b2ac579255f2c0ebb452fcc3fc84d81bfaea474d3593d2c3493782173a55a
MISC metadata.xml 581 BLAKE2B f3c4be0d25d3337871d9fc5f0d2e1e420fd68f45c2a7fbabaab0557f2f323661d4dd1ab847778ccc5a06bfe86a6fcf77bc4f65a04baa8ed569fd868ca8a03009 SHA512 41e7c5f2bce2166ed98259fa86fcf92cb3e2e186e7387a1cc75d630313791fc83e297288ce52ad25655292eb14b28a651dec3cb6b3101c75c327f447b15d6293
diff --git a/sci-libs/tensorflow-estimator/files/0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch b/sci-libs/tensorflow-estimator/files/0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch
new file mode 100644
index 000000000000..cc44a9592d96
--- /dev/null
+++ b/sci-libs/tensorflow-estimator/files/0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch
@@ -0,0 +1,29 @@
+From f6d965a9f81b3062ca2f9194bcfa52ee4eeec928 Mon Sep 17 00:00:00 2001
+From: wangjiezhe <wangjiezhe@gmail.com>
+Date: Sat, 23 Dec 2023 10:06:57 +0800
+Subject: [PATCH 1/2] Revert "Exclude `extractor_wrapper` and
+ `generator_wrapper` from the pip package, and remove the exclusion for the
+ deleted `create_python_api_wrapper`."
+
+This reverts commit bd50049c3905fd8c9ad058d2e09682b45b9b9b02.
+---
+ tensorflow_estimator/tools/pip_package/create_pip_helper.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/tensorflow_estimator/tools/pip_package/create_pip_helper.py b/tensorflow_estimator/tools/pip_package/create_pip_helper.py
+index 4810594..e1b1f27 100644
+--- a/tensorflow_estimator/tools/pip_package/create_pip_helper.py
++++ b/tensorflow_estimator/tools/pip_package/create_pip_helper.py
+@@ -35,8 +35,7 @@ PIP_EXCLUDED_FILES = frozenset([
+ 'tensorflow_estimator/python/estimator/canned/v1/baseline_test_v1.py',
+ 'tensorflow_estimator/python/estimator/canned/v1/dnn_test_fc_v1_v1.py',
+ 'tensorflow_estimator/python/estimator/canned/v1/dnn_test_fc_v2_v1.py',
+- 'tensorflow_estimator/python/estimator/api/extractor_wrapper.py',
+- 'tensorflow_estimator/python/estimator/api/generator_wrapper.py',
++ 'tensorflow_estimator/python/estimator/api/create_python_api_wrapper.py',
+ 'tensorflow_estimator/tools/pip_package/setup.py',
+ 'tensorflow_estimator/tools/pip_package/create_pip_helper.py',
+ ])
+--
+2.41.0
+
diff --git a/sci-libs/tensorflow-estimator/files/0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch b/sci-libs/tensorflow-estimator/files/0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch
new file mode 100644
index 000000000000..d7167adb8488
--- /dev/null
+++ b/sci-libs/tensorflow-estimator/files/0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch
@@ -0,0 +1,703 @@
+From 38076a1b48096ef7b4f1e5005fdf9e14425d56a8 Mon Sep 17 00:00:00 2001
+From: wangjiezhe <wangjiezhe@gmail.com>
+Date: Sat, 23 Dec 2023 10:07:02 +0800
+Subject: [PATCH 2/2] Revert "Update TF Estimator to use new TF API Generator"
+
+This reverts commit f7653f9adf978acb3bd459e6ec779a659f1f9a2a.
+---
+ tensorflow_estimator/BUILD | 14 +-
+ .../python/estimator/api/BUILD | 48 +-
+ .../python/estimator/api/api_gen.bzl | 422 ++++--------------
+ .../api/create_python_api_wrapper.py | 30 ++
+ .../python/estimator/api/extractor_wrapper.py | 21 -
+ .../python/estimator/api/generator_wrapper.py | 20 -
+ 6 files changed, 155 insertions(+), 400 deletions(-)
+ create mode 100644 tensorflow_estimator/python/estimator/api/create_python_api_wrapper.py
+ delete mode 100644 tensorflow_estimator/python/estimator/api/extractor_wrapper.py
+ delete mode 100644 tensorflow_estimator/python/estimator/api/generator_wrapper.py
+
+diff --git a/tensorflow_estimator/BUILD b/tensorflow_estimator/BUILD
+index 680cc4e..037c7a9 100644
+--- a/tensorflow_estimator/BUILD
++++ b/tensorflow_estimator/BUILD
+@@ -5,7 +5,7 @@ load(
+ "//tensorflow_estimator/python/estimator/api:api_gen.bzl",
+ "ESTIMATOR_API_INIT_FILES_V1",
+ "ESTIMATOR_API_INIT_FILES_V2",
+- "generate_apis",
++ "gen_api_init_files",
+ )
+
+ licenses(["notice"])
+@@ -67,17 +67,17 @@ py_library(
+ genrule(
+ name = "root_init_gen",
+ srcs = select({
+- "api_version_2": ["_api/v2/v2.py"],
+- "//conditions:default": ["_api/v1/v1.py"],
++ "api_version_2": [":estimator_python_api_gen_compat_v2"],
++ "//conditions:default": [":estimator_python_api_gen_compat_v1"],
+ }),
+ outs = ["__init__.py"],
+ cmd = select({
+- "api_version_2": "cp $(location :_api/v2/v2.py) $(OUTS)",
+- "//conditions:default": "cp $(location :_api/v1/v1.py) $(OUTS)",
++ "api_version_2": "cp $(@D)/_api/v2/v2.py $(OUTS)",
++ "//conditions:default": "cp $(@D)/_api/v1/v1.py $(OUTS)",
+ }),
+ )
+
+-generate_apis(
++gen_api_init_files(
+ name = "estimator_python_api_gen_compat_v1",
+ api_version = 1,
+ output_dir = "_api/v1/",
+@@ -86,7 +86,7 @@ generate_apis(
+ root_file_name = "v1.py",
+ )
+
+-generate_apis(
++gen_api_init_files(
+ name = "estimator_python_api_gen_compat_v2",
+ api_version = 2,
+ output_dir = "_api/v2/",
+diff --git a/tensorflow_estimator/python/estimator/api/BUILD b/tensorflow_estimator/python/estimator/api/BUILD
+index 01dce90..96ac567 100644
+--- a/tensorflow_estimator/python/estimator/api/BUILD
++++ b/tensorflow_estimator/python/estimator/api/BUILD
+@@ -1,10 +1,17 @@
+-# Placeholder: load aliased py_binary
+-load("//tensorflow_estimator/python/estimator/api:api_gen.bzl", "ESTIMATOR_API_INIT_FILES_V1", "ESTIMATOR_API_INIT_FILES_V2", "generate_apis")
+-
+ package(default_visibility = ["//tensorflow_estimator:internal"])
+
+ licenses(["notice"])
+
++load("//tensorflow_estimator/python/estimator/api:api_gen.bzl", "gen_api_init_files")
++load("//tensorflow_estimator/python/estimator/api:api_gen.bzl", "ESTIMATOR_API_INIT_FILES_V1")
++load("//tensorflow_estimator/python/estimator/api:api_gen.bzl", "ESTIMATOR_API_INIT_FILES_V2")
++
++exports_files(
++ [
++ "create_python_api_wrapper.py",
++ ],
++)
++
+ # This flag specifies whether Estimator 2.0 API should be built instead
+ # of 1.* API. Note that Estimator 2.0 API is currently under development.
+ config_setting(
+@@ -12,53 +19,36 @@ config_setting(
+ define_values = {"estimator_api_version": "2"},
+ )
+
+-py_binary(
+- name = "extractor_wrapper",
+- srcs = ["extractor_wrapper.py"],
+- visibility = ["//visibility:public"],
+- deps = [
+- "//tensorflow_estimator/python/estimator:expect_absl_installed", # absl:app
+- ],
+-)
+-
+-py_binary(
+- name = "generator_wrapper",
+- srcs = ["generator_wrapper.py"],
+- visibility = ["//visibility:public"],
+- deps = [
+- "//tensorflow_estimator/python/estimator:expect_absl_installed", # absl:app
+- ],
+-)
+-
+ genrule(
+ name = "estimator_python_api_gen",
+ srcs = select({
+- "api_version_2": ["_v2/v2.py"],
+- "//conditions:default": ["_v1/v1.py"],
++ "api_version_2": [":estimator_python_api_gen_compat_v2"],
++ "//conditions:default": [":estimator_python_api_gen_compat_v1"],
+ }),
+ outs = ["__init__.py"],
+ cmd = select({
+- "api_version_2": "cp $(location :_v2/v2.py) $(OUTS)",
+- "//conditions:default": "cp $(location :_v1/v1.py) $(OUTS)",
++ # Copy the right init file and replace 'from . import'
++ # with 'from ._vN import'.
++ "api_version_2": "cp $(@D)/_v2/v2.py $(OUTS) && sed -i'.original' 's/from . import/from ._v2 import/g' $(OUTS)",
++ "//conditions:default": "cp $(@D)/_v1/v1.py $(OUTS) && sed -i'.original' 's/from . import/from ._v1 import/g' $(OUTS)",
+ }),
++ visibility = ["//visibility:public"],
+ )
+
+-generate_apis(
++gen_api_init_files(
+ name = "estimator_python_api_gen_compat_v1",
+ api_version = 1,
+ output_dir = "_v1/",
+ output_files = ESTIMATOR_API_INIT_FILES_V1,
+ output_package = "tensorflow_estimator.python.estimator.api._v1",
+ root_file_name = "v1.py",
+- visibility = ["//visibility:public"],
+ )
+
+-generate_apis(
++gen_api_init_files(
+ name = "estimator_python_api_gen_compat_v2",
+ api_version = 2,
+ output_dir = "_v2/",
+ output_files = ESTIMATOR_API_INIT_FILES_V2,
+ output_package = "tensorflow_estimator.python.estimator.api._v2",
+ root_file_name = "v2.py",
+- visibility = ["//visibility:public"],
+ )
+diff --git a/tensorflow_estimator/python/estimator/api/api_gen.bzl b/tensorflow_estimator/python/estimator/api/api_gen.bzl
+index b8eaf84..87dd65b 100644
+--- a/tensorflow_estimator/python/estimator/api/api_gen.bzl
++++ b/tensorflow_estimator/python/estimator/api/api_gen.bzl
+@@ -1,7 +1,7 @@
+-"""Targets for generating TensorFlow Estimator Python API __init__.py files.
++"""Targets for generating TensorFlow Python API __init__.py files.
+
+ This bzl file is copied with slight modifications from
+-tensorflow/python/tools/api/generator2/generate_api.bzl
++tensorflow/python/estimator/api/api_gen.bzl
+ so that we can avoid needing to depend on TF source code in Bazel build.
+
+ It should be noted that because this file is executed during the build,
+@@ -10,15 +10,7 @@ is required to Bazel build Estimator.
+ """
+
+ load("//tensorflow_estimator:estimator.bzl", "if_indexing_source_code")
+-
+-_TARGET_PATTERNS = [
+- "//tensorflow_estimator:",
+- "//tensorflow_estimator/",
+-]
+-
+-_DECORATOR = "tensorflow_estimator.python.estimator.estimator_export.estimator_export"
+-
+-_MODULE_PREFIX = ""
++# Placeholder: load aliased py_binary
+
+ ESTIMATOR_API_INIT_FILES_V1 = [
+ "__init__.py",
+@@ -38,332 +30,116 @@ ESTIMATOR_API_INIT_FILES_V2 = [
+ "estimator/inputs/__init__.py",
+ ]
+
+-def _any_match(label):
+- full_target = "//" + label.package + ":" + label.name
+- for pattern in _TARGET_PATTERNS:
+- if pattern in full_target:
+- return True
+- return False
+-
+-def _join(path, *others):
+- result = path
+-
+- for p in others:
+- if not result or result.endswith("/"):
+- result += p
+- else:
+- result += "/" + p
+-
+- return result
+-
+-def _api_info_init(*, transitive_api):
+- if type(transitive_api) != type(depset()):
+- fail("ApiInfo.transitive_api must be a depset")
+- return {"transitive_api": transitive_api}
+-
+-ApiInfo, _new_api_info = provider(
+- doc = "Provider for API symbols and docstrings extracted from Python files.",
+- fields = {
+- "transitive_api": "depset of files with extracted API.",
+- },
+- init = _api_info_init,
+-)
+-
+-def _py_files(f):
+- if f.basename.endswith(".py") or f.basename.endswith(".py3"):
+- return f.path
+- return None
+-
+-def _merge_py_info(
+- deps,
+- direct_sources = None,
+- direct_imports = None,
+- has_py2_only_sources = False,
+- has_py3_only_sources = False,
+- uses_shared_libraries = False):
+- transitive_sources = []
+- transitive_imports = []
+- for dep in deps:
+- if PyInfo in dep:
+- transitive_sources.append(dep[PyInfo].transitive_sources)
+- transitive_imports.append(dep[PyInfo].imports)
+- has_py2_only_sources = has_py2_only_sources or dep[PyInfo].has_py2_only_sources
+- has_py3_only_sources = has_py3_only_sources or dep[PyInfo].has_py3_only_sources
+- uses_shared_libraries = uses_shared_libraries or dep[PyInfo].uses_shared_libraries
+-
+- return PyInfo(
+- transitive_sources = depset(direct = direct_sources, transitive = transitive_sources),
+- imports = depset(direct = direct_imports, transitive = transitive_imports),
+- has_py2_only_sources = has_py2_only_sources,
+- has_py3_only_sources = has_py3_only_sources,
+- uses_shared_libraries = uses_shared_libraries,
+- )
+-
+-def _merge_api_info(
+- deps,
+- direct_api = None):
+- transitive_api = []
+- for dep in deps:
+- if ApiInfo in dep:
+- transitive_api.append(dep[ApiInfo].transitive_api)
+- return ApiInfo(transitive_api = depset(direct = direct_api, transitive = transitive_api))
+-
+-def _api_extractor_impl(target, ctx):
+- direct_api = []
+-
+- # Make sure the rule has a non-empty srcs attribute.
+- if (
+- _any_match(target.label) and
+- hasattr(ctx.rule.attr, "srcs") and
+- ctx.rule.attr.srcs
+- ):
+- output = ctx.actions.declare_file("_".join([
+- target.label.name,
+- "extracted_tensorflow_estimator_api.json",
+- ]))
+-
+- args = ctx.actions.args()
+- args.set_param_file_format("multiline")
+- args.use_param_file("--flagfile=%s")
+-
+- args.add("--output", output)
+- args.add("--decorator", _DECORATOR)
+- args.add("--api_name", "tensorflow_estimator")
+- args.add_all(ctx.rule.files.srcs, expand_directories = True, map_each = _py_files)
+-
+- ctx.actions.run(
+- mnemonic = "ExtractAPI",
+- executable = ctx.executable._extractor_bin,
+- inputs = ctx.rule.files.srcs,
+- outputs = [output],
+- arguments = [args],
+- progress_message = "Extracting tensorflow_estimator APIs for %{label} to %{output}.",
+- )
+-
+- direct_api.append(output)
+-
+- return [
+- _merge_api_info(ctx.rule.attr.deps if hasattr(ctx.rule.attr, "deps") else [], direct_api = direct_api),
+- ]
+-
+-api_extractor = aspect(
+- doc = "Extracts the exported API for the given target and its dependencies.",
+- implementation = _api_extractor_impl,
+- attr_aspects = ["deps"],
+- provides = [ApiInfo],
+- # Currently the Python rules do not correctly advertise their providers.
+- # required_providers = [PyInfo],
+- attrs = {
+- "_extractor_bin": attr.label(
+- default = Label("//tensorflow_estimator/python/estimator/api:extractor_wrapper"),
+- executable = True,
+- cfg = "exec",
+- ),
+- },
+-)
+-
+-def _extract_api_impl(ctx):
+- return [
+- _merge_api_info(ctx.attr.deps),
+- _merge_py_info(ctx.attr.deps),
+- ]
+-
+-extract_api = rule(
+- doc = "Extract Python API for all targets in transitive dependencies.",
+- implementation = _extract_api_impl,
+- attrs = {
+- "deps": attr.label_list(
+- doc = "Targets to extract API from.",
+- allow_empty = False,
+- aspects = [api_extractor],
+- providers = [PyInfo],
+- mandatory = True,
+- ),
+- },
+- provides = [ApiInfo, PyInfo],
+-)
+-
+-def _generate_api_impl(ctx):
+- args = ctx.actions.args()
+- args.set_param_file_format("multiline")
+- args.use_param_file("--flagfile=%s")
+-
+- args.add_joined("--output_files", ctx.outputs.output_files, join_with = ",")
+- args.add("--output_dir", _join(ctx.bin_dir.path, ctx.label.package, ctx.attr.output_dir))
+- if ctx.file.root_init_template:
+- args.add("--root_init_template", ctx.file.root_init_template)
+- args.add("--apiversion", ctx.attr.api_version)
+- args.add_joined("--compat_api_versions", ctx.attr.compat_api_versions, join_with = ",")
+- args.add_joined("--compat_init_templates", ctx.files.compat_init_templates, join_with = ",")
+- args.add("--output_package", ctx.attr.output_package)
+- args.add_joined("--packages_to_ignore", ctx.attr.packages_to_ignore, join_with = ",")
+- if _MODULE_PREFIX:
+- args.add("--module_prefix", _MODULE_PREFIX)
+- if ctx.attr.use_lazy_loading:
+- args.add("--use_lazy_loading")
+- else:
+- args.add("--nouse_lazy_loading")
+- if ctx.attr.proxy_module_root:
+- args.add("--proxy_module_root", ctx.attr.proxy_module_root)
+- args.add_joined("--file_prefixes_to_strip", [ctx.bin_dir.path, ctx.genfiles_dir.path], join_with = ",")
+- if ctx.attr.root_file_name:
+- args.add("--root_file_name", ctx.attr.root_file_name)
+-
+- inputs = depset(transitive = [
+- dep[ApiInfo].transitive_api
+- for dep in ctx.attr.deps
+- ])
+- args.add_all(
+- inputs,
+- expand_directories = True,
+- )
+-
+- transitive_inputs = [inputs]
+- if ctx.attr.root_init_template:
+- transitive_inputs.append(ctx.attr.root_init_template.files)
+-
+- ctx.actions.run(
+- mnemonic = "GenerateAPI",
+- executable = ctx.executable._generator_bin,
+- inputs = depset(
+- direct = ctx.files.compat_init_templates,
+- transitive = transitive_inputs,
+- ),
+- outputs = ctx.outputs.output_files,
+- arguments = [args],
+- progress_message = "Generating APIs for %{label} to %{output}.",
+- )
+-
+-generate_api = rule(
+- doc = "Generate Python API for all targets in transitive dependencies.",
+- implementation = _generate_api_impl,
+- attrs = {
+- "deps": attr.label_list(
+- doc = "extract_api targets to generate API from.",
+- allow_empty = True,
+- providers = [ApiInfo, PyInfo],
+- mandatory = True,
+- ),
+- "root_init_template": attr.label(
+- doc = "Template for the top level __init__.py file",
+- allow_single_file = True,
+- ),
+- "api_version": attr.int(
+- doc = "The API version to generate (1 or 2)",
+- values = [1, 2],
+- ),
+- "compat_api_versions": attr.int_list(
+- doc = "Additional versions to generate in compat/ subdirectory.",
+- ),
+- "compat_init_templates": attr.label_list(
+- doc = "Template for top-level __init__files under compat modules. This list must be " +
+- "in the same order as the list of versions in compat_apiversions",
+- allow_files = True,
+- ),
+- "output_package": attr.string(
+- doc = "Root output package.",
+- ),
+- "output_dir": attr.string(
+- doc = "Subdirectory to output API to. If non-empty, must end with '/'.",
+- ),
+- "proxy_module_root": attr.string(
+- doc = "Module root for proxy-import format. If specified, proxy files with " +
+- "`from proxy_module_root.proxy_module import *` will be created to enable " +
+- "import resolution under TensorFlow.",
+- ),
+- "output_files": attr.output_list(
+- doc = "List of __init__.py files that should be generated. This list should include " +
+- "file name for every module exported using tf_export. For e.g. if an op is " +
+- "decorated with @tf_export('module1.module2', 'module3'). Then, output_files " +
+- "should include module1/module2/__init__.py and module3/__init__.py.",
+- ),
+- "use_lazy_loading": attr.bool(
+- doc = "If true, lazy load imports in the generated API rather then imporing them all statically.",
+- ),
+- "packages_to_ignore": attr.string_list(
+- doc = "List of packages to ignore tf_exports from.",
+- ),
+- "root_file_name": attr.string(
+- doc = "The file name that should be generated for the top level API.",
+- ),
+- "_generator_bin": attr.label(
+- default = Label("//tensorflow_estimator/python/estimator/api:generator_wrapper"),
+- executable = True,
+- cfg = "exec",
+- ),
+- },
+-)
+-
+-def generate_apis(
++def gen_api_init_files(
+ name,
+- deps = [
++ output_files,
++ root_init_template = None,
++ srcs = [],
++ api_name = "estimator",
++ api_version = 2,
++ compat_api_versions = [],
++ compat_init_templates = [],
++ packages = ["tensorflow_estimator.python.estimator"],
++ package_deps = [
+ "//tensorflow_estimator/python/estimator:estimator_py",
+ # "//third_party/tensorflow/lite/python:analyzer",
+ # "//third_party/tensorflow/lite/python:lite",
+ # "//third_party/tensorflow/lite/python/authoring",
+ ],
+- output_files = ESTIMATOR_API_INIT_FILES_V2,
+- root_init_template = None,
+- api_version = 2,
+- compat_api_versions = [],
+- compat_init_templates = [],
+ output_package = "tensorflow_estimator.python.estimator.api",
+ output_dir = "",
+- proxy_module_root = None,
+- packages_to_ignore = [],
+- root_file_name = "__init__.py",
+- visibility = ["//visibility:private"]):
+- """Generate TensorFlow APIs for a set of libraries.
++ root_file_name = "__init__.py"):
++ """Creates API directory structure and __init__.py files.
++
++ Creates a genrule that generates a directory structure with __init__.py
++ files that import all exported modules (i.e. modules with tf_export
++ decorators).
+
+ Args:
+- name: name of generate_api target.
+- deps: python_library targets to serve as roots for extracting APIs.
+- output_files: The list of files that the API generator is exected to create.
+- root_init_template: The template for the top level __init__.py file generated.
+- "#API IMPORTS PLACEHOLDER" comment will be replaced with imports.
+- api_version: THhe API version to generate. (1 or 2)
+- compat_api_versions: Additional versions to generate in compat/ subdirectory.
+- compat_init_templates: Template for top level __init__.py files under the compat modules.
+- The list must be in the same order as the list of versions in 'compat_api_versions'
+- output_package: Root output package.
+- output_dir: Directory where the generated output files are placed. This should be a prefix
+- of every directory in 'output_files'
+- proxy_module_root: Module root for proxy-import format. If specified, proxy files with
+- `from proxy_module_root.proxy_module import *` will be created to enable import
+- resolution under TensorFlow.
+- packages_to_ignore: List of packages to ignore tf_exports from.
+- root_file_name: The file name that should be generated for the top level API.
+- visibility: Visibility of the target containing the generated files.
++ name: name of genrule to create.
++ output_files: List of __init__.py files that should be generated.
++ This list should include file name for every module exported using
++ tf_export. For e.g. if an op is decorated with
++ @tf_export('module1.module2', 'module3'). Then, output_files should
++ include module1/module2/__init__.py and module3/__init__.py.
++ root_init_template: Python init file that should be used as template for
++ root __init__.py file. "# API IMPORTS PLACEHOLDER" comment inside this
++ template will be replaced with root imports collected by this genrule.
++ srcs: genrule sources. If passing root_init_template, the template file
++ must be included in sources.
++ api_name: Name of the project that you want to generate API files for
++ (e.g. "tensorflow" or "estimator").
++ api_version: TensorFlow API version to generate. Must be either 1 or 2.
++ compat_api_versions: Older TensorFlow API versions to generate under
++ compat/ directory.
++ compat_init_templates: Python init file that should be used as template
++ for top level __init__.py files under compat/vN directories.
++ "# API IMPORTS PLACEHOLDER" comment inside this
++ template will be replaced with root imports collected by this genrule.
++ packages: Python packages containing the @tf_export decorators you want to
++ process
++ package_deps: Python library target containing your packages.
++ output_package: Package where generated API will be added to.
++ output_dir: Subdirectory to output API to.
++ If non-empty, must end with '/'.
++ root_file_name: Name of the root file with all the root imports.
+ """
+- extract_name = name + ".extract-tensorflow-estimator"
+- extract_api(
+- name = extract_name,
+- deps = deps,
+- visibility = ["//visibility:private"],
++ root_init_template_flag = ""
++ if root_init_template:
++ root_init_template_flag = "--root_init_template=$(location " + root_init_template + ")"
++
++ primary_package = packages[0]
++ api_gen_binary_target = ("create_" + primary_package + "_api_%d_%s") % (api_version, name)
++ native.py_binary(
++ name = api_gen_binary_target,
++ srcs = ["//tensorflow_estimator/python/estimator/api:create_python_api_wrapper.py"],
++ main = "//tensorflow_estimator/python/estimator/api:create_python_api_wrapper.py",
++ python_version = "PY3",
++ srcs_version = "PY3",
++ visibility = ["//visibility:public"],
++ deps = package_deps,
+ )
+
+- if proxy_module_root != None:
+- # Avoid conflicts between the __init__.py file of TensorFlow and proxy module.
+- output_files = [f for f in output_files if f != "__init__.py"]
+-
+- if root_file_name != None:
+- output_files = [f if f != "__init__.py" else root_file_name for f in output_files]
++ # Replace name of root file with root_file_name.
++ output_files = [
++ root_file_name if f == "__init__.py" else f
++ for f in output_files
++ ]
++ all_output_files = ["%s%s" % (output_dir, f) for f in output_files]
++ compat_api_version_flags = ""
++ for compat_api_version in compat_api_versions:
++ compat_api_version_flags += " --compat_apiversion=%d" % compat_api_version
++
++ compat_init_template_flags = ""
++ for compat_init_template in compat_init_templates:
++ compat_init_template_flags += (
++ " --compat_init_template=$(location %s)" % compat_init_template
++ )
+
+- all_output_files = [_join(output_dir, f) for f in output_files]
++ flags = [
++ root_init_template_flag,
++ "--apidir=$(@D)" + output_dir,
++ "--apiname=" + api_name,
++ "--apiversion=" + str(api_version),
++ compat_api_version_flags,
++ compat_init_template_flags,
++ "--packages=" + ",".join(packages),
++ "--output_package=" + output_package,
++ ]
+
+- generate_api(
++ native.genrule(
+ name = name,
+- deps = [":" + extract_name],
+- output_files = all_output_files,
+- output_dir = output_dir,
+- root_init_template = root_init_template,
+- compat_api_versions = compat_api_versions,
+- compat_init_templates = compat_init_templates,
+- api_version = api_version,
+- proxy_module_root = proxy_module_root,
+- visibility = visibility,
+- packages_to_ignore = packages_to_ignore,
+- use_lazy_loading = False,
+- output_package = output_package,
+- root_file_name = root_file_name,
++ outs = all_output_files,
++ cmd = if_indexing_source_code(
++ _make_cmd(api_gen_binary_target, flags, loading = "static"),
++ _make_cmd(api_gen_binary_target, flags, loading = "default"),
++ ),
++ srcs = srcs,
++ tools = [":" + api_gen_binary_target],
++ visibility = ["//visibility:public"],
+ )
++
++def _make_cmd(api_gen_binary_target, flags, loading = "default"):
++ binary = "$(location :" + api_gen_binary_target + ")"
++ flags.append("--loading=" + loading)
++ return " ".join([binary] + flags + ["$(OUTS)"])
+diff --git a/tensorflow_estimator/python/estimator/api/create_python_api_wrapper.py b/tensorflow_estimator/python/estimator/api/create_python_api_wrapper.py
+new file mode 100644
+index 0000000..9d52a02
+--- /dev/null
++++ b/tensorflow_estimator/python/estimator/api/create_python_api_wrapper.py
+@@ -0,0 +1,30 @@
++# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++# ==============================================================================
++"""Thin wrapper to call TensorFlow's API generation script.
++
++This file exists to provide a main function for the py_binary in the API
++generation genrule. It just calls the main function for the actual API
++generation script in TensorFlow.
++"""
++
++from __future__ import absolute_import
++from __future__ import division
++from __future__ import print_function
++
++from tensorflow_estimator.python.estimator import estimator_lib # pylint: disable=unused-import
++from tensorflow.python.tools.api.generator import create_python_api
++
++if __name__ == '__main__':
++ create_python_api.main()
+diff --git a/tensorflow_estimator/python/estimator/api/extractor_wrapper.py b/tensorflow_estimator/python/estimator/api/extractor_wrapper.py
+deleted file mode 100644
+index 884fcba..0000000
+--- a/tensorflow_estimator/python/estimator/api/extractor_wrapper.py
++++ /dev/null
+@@ -1,21 +0,0 @@
+-# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# http://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-# ==============================================================================
+-"""Thin wrapper to call TensorFlow's API extractor script."""
+-from absl import app
+-
+-from tensorflow.python.tools.api.generator2.extractor import extractor
+-
+-if __name__ == "__main__":
+- app.run(extractor.main)
+diff --git a/tensorflow_estimator/python/estimator/api/generator_wrapper.py b/tensorflow_estimator/python/estimator/api/generator_wrapper.py
+deleted file mode 100644
+index ffcd49a..0000000
+--- a/tensorflow_estimator/python/estimator/api/generator_wrapper.py
++++ /dev/null
+@@ -1,20 +0,0 @@
+-# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# http://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-# ==============================================================================
+-"""Thin wrapper to call TensorFlow's API generator script."""
+-from absl import app
+-from tensorflow.python.tools.api.generator2.generator import generator
+-
+-if __name__ == "__main__":
+- app.run(generator.main)
+--
+2.41.0
+
diff --git a/sci-libs/tensorflow-estimator/tensorflow-estimator-2.13.0.ebuild b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.13.0.ebuild
new file mode 100644
index 000000000000..5d4bf8bd330d
--- /dev/null
+++ b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.13.0.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+MY_PN="estimator"
+MY_PV=${PV/_rc/-rc}
+MY_P=${MY_PN}-${MY_PV}
+
+inherit bazel distutils-r1
+
+DESCRIPTION="A high-level TensorFlow API that greatly simplifies machine learning programming"
+HOMEPAGE="https://www.tensorflow.org/"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+bazel_external_uris="
+ https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip -> bazelbuild-rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d.zip
+ https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip -> bazelbuild-rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
+
+SRC_URI="https://github.com/tensorflow/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
+ ${bazel_external_uris}"
+
+RDEPEND="
+ =sci-libs/tensorflow-2.13*[python,${PYTHON_USEDEP}]
+ sci-libs/keras[${PYTHON_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ app-arch/unzip
+ >=dev-build/bazel-5.3.0
+ dev-java/java-config
+"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CONTRIBUTING.md README.md )
+
+src_unpack() {
+ unpack "${P}.tar.gz"
+ bazel_load_distfiles "${bazel_external_uris}"
+}
+
+src_prepare() {
+ bazel_setup_bazelrc
+ default
+ python_copy_sources
+}
+
+python_compile() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+
+ ebazel build //tensorflow_estimator/tools/pip_package:build_pip_package
+ ebazel shutdown
+
+ local srcdir="${T}/src-${EPYTHON/./_}"
+ mkdir -p "${srcdir}" || die
+ bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package --src "${srcdir}" || die
+
+ popd >/dev/null || die
+}
+
+src_compile() {
+ export JAVA_HOME=$(java-config --jre-home)
+ distutils-r1_src_compile
+}
+
+python_install() {
+ pushd "${T}/src-${EPYTHON/./_}" >/dev/null || die
+ esetup.py install
+ python_optimize
+ popd >/dev/null || die
+}
diff --git a/sci-libs/tensorflow-estimator/tensorflow-estimator-2.14.0.ebuild b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.14.0.ebuild
new file mode 100644
index 000000000000..7ce12833b815
--- /dev/null
+++ b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.14.0.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+MY_PN="estimator"
+MY_PV=${PV/_rc/-rc}
+MY_P=${MY_PN}-${MY_PV}
+
+inherit bazel distutils-r1
+
+DESCRIPTION="A high-level TensorFlow API that greatly simplifies machine learning programming"
+HOMEPAGE="https://www.tensorflow.org/"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+bazel_external_uris="
+ https://github.com/bazelbuild/rules_cc/releases/download/0.0.2/rules_cc-0.0.2.tar.gz -> bazelbuild-rules_cc-0.0.2.tar.gz
+ https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip -> bazelbuild-rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
+
+SRC_URI="https://github.com/tensorflow/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
+ ${bazel_external_uris}"
+
+RDEPEND="
+ =sci-libs/tensorflow-2.14*[python,${PYTHON_USEDEP}]
+ sci-libs/keras[${PYTHON_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ app-arch/unzip
+ >=dev-build/bazel-5.3.0
+ dev-java/java-config
+"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CONTRIBUTING.md README.md )
+
+src_unpack() {
+ unpack "${P}.tar.gz"
+ bazel_load_distfiles "${bazel_external_uris}"
+}
+
+src_prepare() {
+ bazel_setup_bazelrc
+ default
+ python_copy_sources
+}
+
+python_compile() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+
+ ebazel build //tensorflow_estimator/tools/pip_package:build_pip_package
+ ebazel shutdown
+
+ local srcdir="${T}/src-${EPYTHON/./_}"
+ mkdir -p "${srcdir}" || die
+ bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package --src "${srcdir}" || die
+
+ popd >/dev/null || die
+}
+
+src_compile() {
+ export JAVA_HOME=$(java-config --jre-home)
+ distutils-r1_src_compile
+}
+
+python_install() {
+ pushd "${T}/src-${EPYTHON/./_}" >/dev/null || die
+ esetup.py install
+ python_optimize
+ popd >/dev/null || die
+}
diff --git a/sci-libs/tensorflow-estimator/tensorflow-estimator-2.15.0.ebuild b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.15.0.ebuild
new file mode 100644
index 000000000000..662af9932208
--- /dev/null
+++ b/sci-libs/tensorflow-estimator/tensorflow-estimator-2.15.0.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+MY_PN="estimator"
+MY_PV=${PV/_rc/-rc}
+MY_P=${MY_PN}-${MY_PV}
+
+inherit bazel distutils-r1
+
+DESCRIPTION="A high-level TensorFlow API that greatly simplifies machine learning programming"
+HOMEPAGE="https://www.tensorflow.org/"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+bazel_external_uris="
+ https://github.com/bazelbuild/rules_cc/releases/download/0.0.2/rules_cc-0.0.2.tar.gz -> bazelbuild-rules_cc-0.0.2.tar.gz
+ https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip -> bazelbuild-rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
+
+SRC_URI="https://github.com/tensorflow/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
+ ${bazel_external_uris}"
+
+RDEPEND="
+ =sci-libs/tensorflow-2.15*[python,${PYTHON_USEDEP}]
+ sci-libs/keras[${PYTHON_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ app-arch/unzip
+ >=dev-build/bazel-5.3.0
+ dev-java/java-config
+"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=( CONTRIBUTING.md README.md )
+
+PATCHES=(
+ "${FILESDIR}"/0001-Revert-Exclude-extractor_wrapper-and-generator_wrapp.patch
+ "${FILESDIR}"/0002-Revert-Update-TF-Estimator-to-use-new-TF-API-Generat.patch
+)
+
+src_unpack() {
+ unpack "${P}.tar.gz"
+ bazel_load_distfiles "${bazel_external_uris}"
+}
+
+src_prepare() {
+ bazel_setup_bazelrc
+ default
+ python_copy_sources
+}
+
+python_compile() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+
+ ebazel build //tensorflow_estimator/tools/pip_package:build_pip_package
+ ebazel shutdown
+
+ local srcdir="${T}/src-${EPYTHON/./_}"
+ mkdir -p "${srcdir}" || die
+ bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package --src "${srcdir}" || die
+
+ popd >/dev/null || die
+}
+
+src_compile() {
+ export JAVA_HOME=$(java-config --jre-home)
+ distutils-r1_src_compile
+}
+
+python_install() {
+ pushd "${T}/src-${EPYTHON/./_}" >/dev/null || die
+ esetup.py install
+ python_optimize
+ popd >/dev/null || die
+}