Skip to content

Use mirror sites to pull hermetic packages and create copy_wheel rule to copy artifacts #2745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tensorflow/tools/pip_package/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions tensorflow/tools/pip_package/copy_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

cp tensorflow/tools/pip_package/wheel_house/*.whl $1
2 changes: 1 addition & 1 deletion third_party/py/python_init_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
)
31 changes: 28 additions & 3 deletions third_party/py/rules_python.patch
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -20,13 +45,13 @@ index fd385cd1..eb4133f1 100644
+ "strip_prefix": "python",
+ },
}

# buildifier: disable=unsorted-dict-items
@@ -493,6 +506,7 @@ MINOR_MAPPING = {
"3.10": "3.10.14",
"3.11": "3.11.9",
"3.12": "3.12.3",
+ "3.13": "3.13.0",
}

PLATFORMS = {
2 changes: 1 addition & 1 deletion third_party/xla/third_party/py/python_init_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
)
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
)
31 changes: 28 additions & 3 deletions third_party/xla/third_party/tsl/third_party/py/rules_python.patch
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -20,13 +45,13 @@ index fd385cd1..eb4133f1 100644
+ "strip_prefix": "python",
+ },
}

# buildifier: disable=unsorted-dict-items
@@ -493,6 +506,7 @@ MINOR_MAPPING = {
"3.10": "3.10.14",
"3.11": "3.11.9",
"3.12": "3.12.3",
+ "3.13": "3.13.0",
}

PLATFORMS = {