From 554f81b65da81779ae201cc1f3065d0eb0b829d9 Mon Sep 17 00:00:00 2001 From: Harsha HS Date: Mon, 4 Nov 2024 08:43:36 -0800 Subject: [PATCH 1/2] Add mirror sites to download cpython, rules_python and rules_cc --- third_party/py/python_init_rules.bzl | 2 +- third_party/py/rules_python.patch | 31 +++++++++++++++++-- .../xla/third_party/py/python_init_rules.bzl | 2 +- .../tsl/third_party/py/python_init_rules.bzl | 2 +- .../tsl/third_party/py/rules_python.patch | 31 +++++++++++++++++-- 5 files changed, 59 insertions(+), 9 deletions(-) diff --git a/third_party/py/python_init_rules.bzl b/third_party/py/python_init_rules.bzl index 5a13d25df4d977..6c5e97279123fd 100644 --- a/third_party/py/python_init_rules.bzl +++ b/third_party/py/python_init_rules.bzl @@ -7,7 +7,7 @@ def python_init_rules(): name = "rules_python", sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", strip_prefix = "rules_python-0.34.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", + url = "https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", patch_args = ["-p1"], patches = [Label("//third_party/py:rules_python.patch")], ) diff --git a/third_party/py/rules_python.patch b/third_party/py/rules_python.patch index 3dbe06dd2d6d96..2fa419ea0b0726 100644 --- a/third_party/py/rules_python.patch +++ b/third_party/py/rules_python.patch @@ -1,7 +1,32 @@ +diff --git a/python/repositories.bzl b/python/repositories.bzl +index d58feef..4ce550d 100644 +--- a/python/repositories.bzl ++++ b/python/repositories.bzl +@@ -64,7 +64,10 @@ def py_repositories(): + ) + http_archive( + name = "rules_cc", +- urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], ++ urls = [ ++ "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz", ++ "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" ++ ], + sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", + strip_prefix = "rules_cc-0.0.9", + ) diff --git a/python/versions.bzl b/python/versions.bzl -index fd385cd1..eb4133f1 100644 +index fd385cd..9a52e80 100644 --- a/python/versions.bzl +++ b/python/versions.bzl +@@ -20,7 +20,7 @@ MACOS_NAME = "mac os" + LINUX_NAME = "linux" + WINDOWS_NAME = "windows" + +-DEFAULT_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download" ++DEFAULT_RELEASE_BASE_URL = "https://mirror.bazel.build/github.com/indygreg/python-build-standalone/releases/download" + + # When updating the versions and releases, run the following command to get + # the hashes: @@ -484,6 +484,19 @@ TOOL_VERSIONS = { }, "strip_prefix": "python", @@ -20,7 +45,7 @@ index fd385cd1..eb4133f1 100644 + "strip_prefix": "python", + }, } - + # buildifier: disable=unsorted-dict-items @@ -493,6 +506,7 @@ MINOR_MAPPING = { "3.10": "3.10.14", @@ -28,5 +53,5 @@ index fd385cd1..eb4133f1 100644 "3.12": "3.12.3", + "3.13": "3.13.0", } - + PLATFORMS = { diff --git a/third_party/xla/third_party/py/python_init_rules.bzl b/third_party/xla/third_party/py/python_init_rules.bzl index 5a13d25df4d977..6c5e97279123fd 100644 --- a/third_party/xla/third_party/py/python_init_rules.bzl +++ b/third_party/xla/third_party/py/python_init_rules.bzl @@ -7,7 +7,7 @@ def python_init_rules(): name = "rules_python", sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", strip_prefix = "rules_python-0.34.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", + url = "https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", patch_args = ["-p1"], patches = [Label("//third_party/py:rules_python.patch")], ) diff --git a/third_party/xla/third_party/tsl/third_party/py/python_init_rules.bzl b/third_party/xla/third_party/tsl/third_party/py/python_init_rules.bzl index 5a13d25df4d977..6c5e97279123fd 100644 --- a/third_party/xla/third_party/tsl/third_party/py/python_init_rules.bzl +++ b/third_party/xla/third_party/tsl/third_party/py/python_init_rules.bzl @@ -7,7 +7,7 @@ def python_init_rules(): name = "rules_python", sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", strip_prefix = "rules_python-0.34.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", + url = "https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", patch_args = ["-p1"], patches = [Label("//third_party/py:rules_python.patch")], ) diff --git a/third_party/xla/third_party/tsl/third_party/py/rules_python.patch b/third_party/xla/third_party/tsl/third_party/py/rules_python.patch index 3dbe06dd2d6d96..2fa419ea0b0726 100644 --- a/third_party/xla/third_party/tsl/third_party/py/rules_python.patch +++ b/third_party/xla/third_party/tsl/third_party/py/rules_python.patch @@ -1,7 +1,32 @@ +diff --git a/python/repositories.bzl b/python/repositories.bzl +index d58feef..4ce550d 100644 +--- a/python/repositories.bzl ++++ b/python/repositories.bzl +@@ -64,7 +64,10 @@ def py_repositories(): + ) + http_archive( + name = "rules_cc", +- urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], ++ urls = [ ++ "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz", ++ "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" ++ ], + sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", + strip_prefix = "rules_cc-0.0.9", + ) diff --git a/python/versions.bzl b/python/versions.bzl -index fd385cd1..eb4133f1 100644 +index fd385cd..9a52e80 100644 --- a/python/versions.bzl +++ b/python/versions.bzl +@@ -20,7 +20,7 @@ MACOS_NAME = "mac os" + LINUX_NAME = "linux" + WINDOWS_NAME = "windows" + +-DEFAULT_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download" ++DEFAULT_RELEASE_BASE_URL = "https://mirror.bazel.build/github.com/indygreg/python-build-standalone/releases/download" + + # When updating the versions and releases, run the following command to get + # the hashes: @@ -484,6 +484,19 @@ TOOL_VERSIONS = { }, "strip_prefix": "python", @@ -20,7 +45,7 @@ index fd385cd1..eb4133f1 100644 + "strip_prefix": "python", + }, } - + # buildifier: disable=unsorted-dict-items @@ -493,6 +506,7 @@ MINOR_MAPPING = { "3.10": "3.10.14", @@ -28,5 +53,5 @@ index fd385cd1..eb4133f1 100644 "3.12": "3.12.3", + "3.13": "3.13.0", } - + PLATFORMS = { From 33a418c300e57c7328de785280b534c02fd3eb5a Mon Sep 17 00:00:00 2001 From: Harsha HS Date: Tue, 5 Nov 2024 12:08:13 -0800 Subject: [PATCH 2/2] Add sh_binary rule to copy tensorflow wheel to wheel artifact directory --- tensorflow/tools/pip_package/BUILD | 7 +++++++ tensorflow/tools/pip_package/copy_wheel.sh | 3 +++ 2 files changed, 10 insertions(+) create mode 100755 tensorflow/tools/pip_package/copy_wheel.sh diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index 25ac69f4ecbbc4..9c1a523c7d6c6c 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -315,6 +315,13 @@ genrule( cmd = "echo '' > $@", ) + +sh_binary( + name = "copy_wheel", + srcs = ['copy_wheel.sh'], + data = [":wheel"], +) + py_test( name = "prebuilt_wheel_import_api_packages_test", srcs = if_wheel_dependency( diff --git a/tensorflow/tools/pip_package/copy_wheel.sh b/tensorflow/tools/pip_package/copy_wheel.sh new file mode 100755 index 00000000000000..ded68c5e4a55d3 --- /dev/null +++ b/tensorflow/tools/pip_package/copy_wheel.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cp tensorflow/tools/pip_package/wheel_house/*.whl $1