mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 00:19:58 +01:00
Update rules_python to v1.6 in XLA and TensorFlow projects.
`com_google_protobuf` and `rules_cc` initialization was moved to `python_init_rules` macros. The JAX repository update will be done [in the next step](https://github.com/jax-ml/jax/pull/31709) PiperOrigin-RevId: 808689003
This commit is contained in:
parent
0635220735
commit
3eae65361b
6
.bazelrc
6
.bazelrc
|
|
@ -96,7 +96,11 @@ build --host_copt=-DGRPC_BAZEL_BUILD
|
|||
build --action_env=GRPC_BAZEL_RUNTIME=1
|
||||
build --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
||||
build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
||||
build --repo_env=RULES_PYTHON_ENABLE_PYSTAR=0
|
||||
# Some targets have the same py source file, but use different
|
||||
# configurations via `requires-` tags. This results in an action
|
||||
# conflict when precompiling. Disable to avoid that problem.
|
||||
# See https://github.com/bazel-contrib/rules_python/issues/2445
|
||||
build --@rules_python//python/config_settings:precompile=force_disabled
|
||||
|
||||
# Do not do this. If enabled protobuf's core internal target
|
||||
# @com_google_protobuf//python:protobuf_python will start depending on a bunch
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
|
||||
load("@python//:defs.bzl", "compile_pip_requirements")
|
||||
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
|
||||
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
|
||||
|
||||
# TODO(ybaturina): Remove once TF is migrated to CUDA 12.9.
|
||||
genrule(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,13 @@
|
|||
# learning applications.
|
||||
|
||||
load("@rules_cc//cc:cc_import.bzl", "cc_import")
|
||||
|
||||
# buildifier: disable=out-of-order-load
|
||||
# copybara:comment_begin(oss-only)
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# copybara:comment_end
|
||||
# buildifier: enable=out-of-order-load
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "bool_setting")
|
||||
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
|
||||
|
|
@ -1695,7 +1702,7 @@ generate_apis(
|
|||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_library(
|
||||
py_strict_library(
|
||||
name = "tensorflow_py",
|
||||
srcs_version = "PY3",
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
@ -1707,7 +1714,7 @@ py_library(
|
|||
],
|
||||
)
|
||||
|
||||
py_library(
|
||||
py_strict_library(
|
||||
name = "tensorflow_py_no_contrib",
|
||||
srcs = select({
|
||||
"api_version_2": [":tf_python_api_gen_v2"],
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
|
|||
load("@bazel_skylib//rules:build_test.bzl", "build_test")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "if_google", "if_oss", "tf_cc_binary", "tf_cc_test", "tf_native_cc_binary")
|
||||
load("//tensorflow:tensorflow.default.bzl", "filegroup", "get_compatible_with_portable")
|
||||
load("//tensorflow/compiler/mlir/lite:build_def.bzl", "tflite_copts_warnings")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary", "tf_cc_test")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load("//tensorflow/compiler/mlir/quantization/stablehlo:internal_visibility_allowlist.bzl", "internal_visibility_allowlist")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_binary")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load("//tensorflow/compiler/mlir/quantization/tensorflow:internal_visibility_allowlist.bzl", "internal_visibility_allowlist")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_contrib_test", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test",
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ load(
|
|||
"@local_xla//xla/tsl/platform/default:cuda_build_defs.bzl",
|
||||
"cuda_rpath_flags",
|
||||
)
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"VERSION",
|
||||
|
|
|
|||
|
|
@ -62,14 +62,13 @@
|
|||
# build targets.
|
||||
|
||||
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
|
||||
load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt")
|
||||
load(
|
||||
"@local_xla//xla/tsl/mkl:build_defs.bzl",
|
||||
"if_mkl",
|
||||
)
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"if_android",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
# a watch state.
|
||||
# ":debug_node_key" - Defines a struct used for tracking tensors.
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"check_deps",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_proto_library",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_proto_library",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# copybara:uncomment(oss-unused) load("//net/grpc/go/build_defs:go_grpc_library.bzl", "go_grpc_library")
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
|
||||
load("//tensorflow:tensorflow.default.bzl", "filegroup")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_additional_all_protos", "tf_proto_library")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
|
||||
package(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_additional_all_protos",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.bzl", "if_google", "tf_cc_shared_object", "tf_cc_test")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# TPU Kernel Implementations
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"if_google",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# The autotuning results can be serialized as a string, allowing you to save
|
||||
# and later restore them.
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_additional_all_protos",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
|
||||
package(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_binary",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_cc//cc:cc_test.bzl", "cc_test")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_binary", "py_strict_library", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.bzl", "tf_cc_binary", "tf_cc_test")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Placeholder: load py_proto_library
|
||||
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_proto_library",
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ load(
|
|||
"if_cuda_is_configured",
|
||||
)
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"VERSION",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
# python/framework package
|
||||
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"if_cuda_tools",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Description:
|
||||
# Contains Keras protobufs
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
|
||||
package(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Tests of tf.io.*proto.
|
||||
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.bzl", "if_oss", "tf_cc_shared_object")
|
||||
load("//tensorflow:tensorflow.default.bzl", "stripped_cc_info", "tf_py_strict_test")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_additional_all_protos", "tf_proto_library")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Rules to generate the TensorFlow public API from annotated files."""
|
||||
|
||||
# Placeholder: load PyInfo
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("@rules_python//python:py_info.bzl", "PyInfo")
|
||||
load("//tensorflow/python/tools/api/generator:api_init_files.bzl", "TENSORFLOW_API_INIT_FILES")
|
||||
load(":apis.bzl", _APIS = "APIS")
|
||||
load(":patterns.bzl", "any_match")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
|
||||
# Description: Operations defined for Cloud TPUs
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.default.bzl", "tf_py_strict_test", "tf_python_pybind_extension")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
load("//tensorflow/core/platform:build_config_root.bzl", "if_pywrap")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.default.bzl", "cuda_py_strict_test", "tf_py_strict_test")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library")
|
||||
load("//tensorflow/core/platform:distribute.bzl", "distribute_py_strict_test")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Tensorflow protobuf utility package
|
||||
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable", "tf_py_strict_test")
|
||||
load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library") # @unused
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Helper libraries for TensorFlow API compatibility test.
|
||||
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_library")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_proto_library",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ load(
|
|||
load("@local_xla//third_party/py:python_wheel.bzl", "collect_data_files", "transitive_py_deps")
|
||||
load("@local_xla//xla/tsl/mkl:build_defs.bzl", "if_enable_mkl", "if_mkl", "if_mkl_ml")
|
||||
load("@nvidia_wheel_versions//:versions.bzl", "NVIDIA_WHEEL_VERSIONS")
|
||||
load("//tensorflow:py.default.bzl", "py_binary", "py_test")
|
||||
load("//tensorflow:tensorflow.bzl", "if_wheel_dependency", "if_with_tpu_support", "transitive_hdrs")
|
||||
load("//tensorflow:tf_version.bzl", "TF_SEMANTIC_VERSION_SUFFIX", "TF_VERSION")
|
||||
load(
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
# Utilities for splitting and joining large protos > 2GB.
|
||||
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:pytype.default.bzl", "pytype_strict_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_test")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow:tensorflow.bzl",
|
||||
"if_oss",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//tensorflow:strict.default.bzl", "py_strict_binary")
|
||||
|
||||
# Placeholder: load py_proto_library
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config.bzl",
|
||||
"tf_proto_library",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
load("@bazel_features//:deps.bzl", "bazel_features_deps")
|
||||
load("@bazel_skylib//lib:versions.bzl", "versions")
|
||||
load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
|
||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
load("@local_xla//third_party/absl:workspace.bzl", absl = "repo")
|
||||
load("@local_xla//third_party/benchmark:workspace.bzl", benchmark = "repo")
|
||||
load("@local_xla//third_party/clang_toolchain:cc_configure_clang.bzl", "cc_download_clang_toolchain")
|
||||
|
|
@ -391,7 +392,8 @@ def _tf_repositories():
|
|||
urls = tf_mirror_urls("https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.tar.gz"),
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
maybe(
|
||||
tf_http_archive,
|
||||
name = "com_google_protobuf",
|
||||
patch_file = ["@local_xla//third_party/protobuf:protobuf.patch"],
|
||||
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
|
||||
|
|
|
|||
2
third_party/py/BUILD.bazel
vendored
2
third_party/py/BUILD.bazel
vendored
|
|
@ -1,6 +1,6 @@
|
|||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@python//:defs.bzl", "compile_pip_requirements")
|
||||
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
|
||||
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
|
||||
|
||||
compile_pip_requirements(
|
||||
name = "requirements",
|
||||
|
|
|
|||
7
third_party/py/BUILD.tpl
vendored
7
third_party/py/BUILD.tpl
vendored
|
|
@ -5,17 +5,16 @@ package(default_visibility = ["//visibility:public"])
|
|||
# Point both runtimes to the same python binary to ensure we always
|
||||
# use the python binary specified by ./configure.py script.
|
||||
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
|
||||
load("@python//:defs.bzl", "interpreter")
|
||||
|
||||
py_runtime(
|
||||
name = "py2_runtime",
|
||||
interpreter_path = interpreter,
|
||||
interpreter = "%{PYTHON_INTERPRETER}",
|
||||
python_version = "PY2",
|
||||
)
|
||||
|
||||
py_runtime(
|
||||
name = "py3_runtime",
|
||||
interpreter_path = interpreter,
|
||||
interpreter = "%{PYTHON_INTERPRETER}",
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ toolchain(
|
|||
)
|
||||
|
||||
alias(name = "python_headers",
|
||||
actual = "@python//:python_headers")
|
||||
actual = "@rules_python//python/cc:current_py_cc_headers")
|
||||
|
||||
# This alias is exists for the use of targets in the @llvm-project dependency,
|
||||
# which expect a python_headers target called @python_runtime//:headers. We use
|
||||
|
|
|
|||
25
third_party/py/python_configure.bzl
vendored
25
third_party/py/python_configure.bzl
vendored
|
|
@ -7,18 +7,27 @@ load(
|
|||
"PYTHON_BIN_PATH",
|
||||
"PYTHON_LIB_PATH",
|
||||
)
|
||||
load("//third_party/py:python_init_toolchains.bzl", "get_toolchain_name_per_python_version")
|
||||
|
||||
def _get_python_interpreter():
|
||||
return "@{}_host//:python".format(
|
||||
get_toolchain_name_per_python_version("python"),
|
||||
)
|
||||
|
||||
def _create_local_python_repository(repository_ctx):
|
||||
"""Creates the repository containing files set up to build with Python."""
|
||||
|
||||
# Resolve all labels before doing any real work. Resolving causes the
|
||||
# function to be restarted with all previous state being lost. This
|
||||
# can easily lead to a O(n^2) runtime in the number of labels.
|
||||
build_tpl = repository_ctx.path(Label("//third_party/py:BUILD.tpl"))
|
||||
platform_constraint = ""
|
||||
if repository_ctx.attr.platform_constraint:
|
||||
platform_constraint = "\"%s\"" % repository_ctx.attr.platform_constraint
|
||||
repository_ctx.template("BUILD", build_tpl, {"%{PLATFORM_CONSTRAINT}": platform_constraint})
|
||||
repository_ctx.template(
|
||||
"BUILD",
|
||||
repository_ctx.attr.build_tpl,
|
||||
{
|
||||
"%{PLATFORM_CONSTRAINT}": platform_constraint,
|
||||
"%{PYTHON_INTERPRETER}": repository_ctx.attr.python_interpreter,
|
||||
},
|
||||
)
|
||||
|
||||
def _python_autoconf_impl(repository_ctx):
|
||||
"""Implementation of the python_autoconf repository rule."""
|
||||
|
|
@ -35,6 +44,8 @@ local_python_configure = repository_rule(
|
|||
attrs = {
|
||||
"environ": attr.string_dict(),
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -45,6 +56,8 @@ remote_python_configure = repository_rule(
|
|||
attrs = {
|
||||
"environ": attr.string_dict(),
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -52,6 +65,8 @@ python_configure = repository_rule(
|
|||
implementation = _python_autoconf_impl,
|
||||
attrs = {
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
"""Detects and configures the local Python.
|
||||
|
|
|
|||
9
third_party/py/python_init_pip.bzl
vendored
9
third_party/py/python_init_pip.bzl
vendored
|
|
@ -1,8 +1,11 @@
|
|||
"""Hermetic Python initialization. Consult the WORKSPACE on how to use it."""
|
||||
|
||||
load("@python//:defs.bzl", "interpreter")
|
||||
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS_WITH_LOCAL_WHEELS")
|
||||
load("@rules_python//python:pip.bzl", "package_annotation", "pip_parse")
|
||||
load(
|
||||
"//third_party/py:python_init_toolchains.bzl",
|
||||
"get_toolchain_name_per_python_version",
|
||||
)
|
||||
|
||||
def python_init_pip():
|
||||
numpy_annotations = {
|
||||
|
|
@ -29,6 +32,8 @@ cc_library(
|
|||
pip_parse(
|
||||
name = "pypi",
|
||||
annotations = numpy_annotations,
|
||||
python_interpreter_target = interpreter,
|
||||
python_interpreter_target = "@{}_host//:python".format(
|
||||
get_toolchain_name_per_python_version("python"),
|
||||
),
|
||||
requirements_lock = REQUIREMENTS_WITH_LOCAL_WHEELS,
|
||||
)
|
||||
|
|
|
|||
36
third_party/py/python_init_rules.bzl
vendored
36
third_party/py/python_init_rules.bzl
vendored
|
|
@ -1,6 +1,7 @@
|
|||
"""Hermetic Python initialization. Consult the WORKSPACE on how to use it."""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
|
||||
|
||||
def python_init_rules(extra_patches = []):
|
||||
"""Defines (doesn't setup) the rules_python repository.
|
||||
|
|
@ -9,15 +10,38 @@ def python_init_rules(extra_patches = []):
|
|||
extra_patches: list of labels. Additional patches to apply after the default
|
||||
set of patches.
|
||||
"""
|
||||
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.1.0.tar.gz"],
|
||||
strip_prefix = "rules_cc-0.1.0",
|
||||
sha256 = "4b12149a041ddfb8306a8fd0e904e39d673552ce82e4296e96fac9cbf0780e59",
|
||||
patches = [
|
||||
Label("//third_party/py:rules_cc_protobuf.patch"),
|
||||
],
|
||||
patch_args = ["-p1"],
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
name = "com_google_protobuf",
|
||||
patch_file = ["//third_party/protobuf:protobuf.patch"],
|
||||
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
|
||||
strip_prefix = "protobuf-6.31.1",
|
||||
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip"),
|
||||
repo_mapping = {
|
||||
"@abseil-cpp": "@com_google_absl",
|
||||
"@protobuf_pip_deps": "@pypi",
|
||||
},
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "rules_python",
|
||||
sha256 = "62ddebb766b4d6ddf1712f753dac5740bea072646f630eb9982caa09ad8a7687",
|
||||
strip_prefix = "rules_python-0.39.0",
|
||||
url = "https://github.com/bazelbuild/rules_python/releases/download/0.39.0/rules_python-0.39.0.tar.gz",
|
||||
sha256 = "fa7dd2c6b7d63b3585028dd8a90a6cf9db83c33b250959c2ee7b583a6c130e12",
|
||||
strip_prefix = "rules_python-1.6.0",
|
||||
url = "https://github.com/bazelbuild/rules_python/releases/download/1.6.0/rules_python-1.6.0.tar.gz",
|
||||
patch_args = ["-p1"],
|
||||
patches = [
|
||||
Label("//third_party/py:rules_python1.patch"),
|
||||
Label("//third_party/py:rules_python2.patch"),
|
||||
Label("//third_party/py:rules_python3.patch"),
|
||||
Label("//third_party/py:rules_python_pip_version.patch"),
|
||||
Label("//third_party/py:rules_python_freethreaded.patch"),
|
||||
] + extra_patches,
|
||||
)
|
||||
|
|
|
|||
16
third_party/py/python_init_toolchains.bzl
vendored
16
third_party/py/python_init_toolchains.bzl
vendored
|
|
@ -6,16 +6,21 @@ load(
|
|||
"HERMETIC_PYTHON_SHA256",
|
||||
"HERMETIC_PYTHON_URL",
|
||||
"HERMETIC_PYTHON_VERSION",
|
||||
"HERMETIC_PYTHON_VERSION_KIND",
|
||||
)
|
||||
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
|
||||
load("@rules_python//python:versions.bzl", "MINOR_MAPPING", "PLATFORMS")
|
||||
|
||||
def get_toolchain_name_per_python_version(name):
|
||||
return "{name}_{version}".format(
|
||||
name = name,
|
||||
version = HERMETIC_PYTHON_VERSION.replace(".", "_"),
|
||||
)
|
||||
|
||||
def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
||||
"""Register hermetic python toolchains.
|
||||
|
||||
Args:
|
||||
name: name of the toolchain, "python" by default (it is strongly
|
||||
name: prefix of the toolchain, "python" by default (it is strongly
|
||||
recommended to rely on the default).
|
||||
python_version: version of the python to register; if set it will bypass
|
||||
kwargs to underlying python_register_toolchains as is (manual
|
||||
|
|
@ -27,7 +32,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
|
||||
if python_version:
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
python_version = python_version,
|
||||
**kwargs
|
||||
)
|
||||
|
|
@ -44,7 +49,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
sha256s[platform] = HERMETIC_PYTHON_SHA256
|
||||
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
base_url = url_components[0] + "://",
|
||||
ignore_root_user_error = True,
|
||||
python_version = tool_version,
|
||||
|
|
@ -59,8 +64,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
)
|
||||
elif HERMETIC_PYTHON_VERSION in MINOR_MAPPING:
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
ignore_root_user_error = True,
|
||||
python_version = HERMETIC_PYTHON_VERSION,
|
||||
python_version_kind = HERMETIC_PYTHON_VERSION_KIND,
|
||||
)
|
||||
|
|
|
|||
16
third_party/py/rules_cc_protobuf.patch
vendored
Normal file
16
third_party/py/rules_cc_protobuf.patch
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/cc/defs.bzl b/cc/defs.bzl
|
||||
index 3448e77..9c298ab 100644
|
||||
--- a/cc/defs.bzl
|
||||
+++ b/cc/defs.bzl
|
||||
@@ -30,9 +30,11 @@ load("//cc/toolchains:cc_toolchain_suite.bzl", _cc_toolchain_suite = "cc_toolcha
|
||||
load("//cc/toolchains:compiler_flag.bzl", _compiler_flag = "compiler_flag")
|
||||
load("//cc/toolchains:fdo_prefetch_hints.bzl", _fdo_prefetch_hints = "fdo_prefetch_hints")
|
||||
load("//cc/toolchains:fdo_profile.bzl", _fdo_profile = "fdo_profile")
|
||||
+load("@com_google_protobuf//bazel:cc_proto_library.bzl", _protobuf_cc_proto_library = "cc_proto_library")
|
||||
|
||||
# Rules
|
||||
|
||||
+cc_proto_library = _protobuf_cc_proto_library
|
||||
cc_library = _cc_library
|
||||
cc_binary = _cc_binary
|
||||
cc_test = _cc_test
|
||||
93
third_party/py/rules_python1.patch
vendored
93
third_party/py/rules_python1.patch
vendored
|
|
@ -1,93 +0,0 @@
|
|||
diff --git a/python/private/pypi/deps.bzl b/python/private/pypi/deps.bzl
|
||||
index 8949ed4a..8d0ab0e7 100644
|
||||
--- a/python/private/pypi/deps.bzl
|
||||
+++ b/python/private/pypi/deps.bzl
|
||||
@@ -51,8 +51,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__packaging",
|
||||
- "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
|
||||
- "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
|
||||
+ "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
|
||||
+ "09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
|
||||
),
|
||||
(
|
||||
"pypi__pep517",
|
||||
@@ -61,8 +61,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__pip",
|
||||
- "https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
|
||||
- "ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
|
||||
+ "https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
|
||||
+ "3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
|
||||
),
|
||||
(
|
||||
"pypi__pip_tools",
|
||||
diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl
|
||||
index c805fd7a..e57e6138 100644
|
||||
--- a/python/private/pypi/evaluate_markers.bzl
|
||||
+++ b/python/private/pypi/evaluate_markers.bzl
|
||||
@@ -20,7 +20,7 @@ load(":pypi_repo_utils.bzl", "pypi_repo_utils")
|
||||
SRCS = [
|
||||
# When the version, or any of the files in `packaging` package changes,
|
||||
# this file will change as well.
|
||||
- Label("@pypi__packaging//:packaging-24.0.dist-info/RECORD"),
|
||||
+ Label("@pypi__packaging//:packaging-24.2.dist-info/RECORD"),
|
||||
Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"),
|
||||
Label("//python/private/pypi/whl_installer:platform.py"),
|
||||
]
|
||||
diff --git a/python/versions.bzl b/python/versions.bzl
|
||||
index 774c24d1..91e59f9b 100644
|
||||
--- a/python/versions.bzl
|
||||
+++ b/python/versions.bzl
|
||||
@@ -561,6 +561,20 @@ TOOL_VERSIONS = {
|
||||
},
|
||||
"strip_prefix": "python",
|
||||
},
|
||||
+ "3.12.8": {
|
||||
+ "url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "e3c4aa607717b23903ca2650d5c3ee24f89b97543e2db2b0f463bddc7a9e92f3",
|
||||
+ "aarch64-unknown-linux-gnu": "ce674b55442b732973afb2932c281bb1ded4ad7e22bcf9b07071165770758c7e",
|
||||
+ "ppc64le-unknown-linux-gnu": "b7214790b273de9ed0532420054b72ba1393d62d2fc844ec55ade193771bd90c",
|
||||
+ "s390x-unknown-linux-gnu": "73102f5dbd7d1e7e9c2f2c80aedf2893d99a7fa407f6674ec8b2f57ba07daee5",
|
||||
+ "x86_64-apple-darwin": "3ba35c706577d755e8e52a4c161a042464577c0e695e2a605362fa469e26de10",
|
||||
+ "x86_64-pc-windows-msvc": "767b4be3ddf6b99e5ade519789c1615c191d8cf99d5aff4685cc18b48931f1e6",
|
||||
+ "x86_64-unknown-linux-gnu": "b9d6ee5ddac1198e72d53112698773fc8bb597de095592eb849ca794306699ba",
|
||||
+ "x86_64-unknown-linux-musl": "6f305888703691dd04cfff85284d23ea0b0146ed7c4415e472f1fb72b3f32cdf",
|
||||
+ },
|
||||
+ "strip_prefix": "python",
|
||||
+ },
|
||||
"3.13.0": {
|
||||
"url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
|
||||
"sha256": {
|
||||
@@ -589,7 +603,7 @@ MINOR_MAPPING = {
|
||||
"3.9": "3.9.20",
|
||||
"3.10": "3.10.15",
|
||||
"3.11": "3.11.10",
|
||||
- "3.12": "3.12.7",
|
||||
+ "3.12": "3.12.8",
|
||||
"3.13": "3.13.0",
|
||||
}
|
||||
|
||||
diff --git a/python/private/python_bootstrap_template.txt b/python/private/python_bootstrap_template.txt
|
||||
index 0f9c90b3..567bdc88 100644
|
||||
--- a/python/private/python_bootstrap_template.txt
|
||||
+++ b/python/private/python_bootstrap_template.txt
|
||||
@@ -52,7 +52,14 @@ def GetWindowsPathWithUNCPrefix(path):
|
||||
# removed from common Win32 file and directory functions.
|
||||
# Related doc: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later
|
||||
import platform
|
||||
- if platform.win32_ver()[1] >= '10.0.14393':
|
||||
+ version = None
|
||||
+ # The try-except block is needed to fix the flakiness of RBE tests
|
||||
+ # on Windows 2022 using hermetic python 3.12.8.
|
||||
+ try:
|
||||
+ version = platform.win32_ver()[1]
|
||||
+ except (ValueError, KeyError):
|
||||
+ version = platform.win32_ver()[1]
|
||||
+ if version and version >= '10.0.14393':
|
||||
return path
|
||||
|
||||
# import sysconfig only now to maintain python 2.6 compatibility
|
||||
150
third_party/py/rules_python2.patch
vendored
150
third_party/py/rules_python2.patch
vendored
|
|
@ -1,150 +0,0 @@
|
|||
diff --git a/python/versions.bzl b/python/versions.bzl
|
||||
index 91e59f9b..d72855db 100644
|
||||
--- a/python/versions.bzl
|
||||
+++ b/python/versions.bzl
|
||||
@@ -21,7 +21,7 @@ LINUX_NAME = "linux"
|
||||
WINDOWS_NAME = "windows"
|
||||
FREETHREADED = "freethreaded"
|
||||
|
||||
-DEFAULT_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download"
|
||||
+DEFAULT_RELEASE_BASE_URL = "https://github.com/astral-sh/python-build-standalone/releases/download"
|
||||
|
||||
# When updating the versions and releases, run the following command to get
|
||||
# the hashes:
|
||||
@@ -575,25 +575,81 @@ TOOL_VERSIONS = {
|
||||
},
|
||||
"strip_prefix": "python",
|
||||
},
|
||||
- "3.13.0": {
|
||||
- "url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
|
||||
- "sha256": {
|
||||
- "aarch64-apple-darwin": "31397953849d275aa2506580f3fa1cb5a85b6a3d392e495f8030e8b6412f5556",
|
||||
- "aarch64-unknown-linux-gnu": "e8378c0162b2e0e4cc1f62b29443a3305d116d09583304dbb0149fecaff6347b",
|
||||
- "ppc64le-unknown-linux-gnu": "fc4b7f27c4e84c78f3c8e6c7f8e4023e4638d11f1b36b6b5ce457b1926cebb53",
|
||||
- "s390x-unknown-linux-gnu": "66b19e6a07717f6cfcd3a8ca953f0a2eaa232291142f3d26a8d17c979ec0f467",
|
||||
- "x86_64-apple-darwin": "cff1b7e7cd26f2d47acac1ad6590e27d29829776f77e8afa067e9419f2f6ce77",
|
||||
- "x86_64-pc-windows-msvc": "b25926e8ce4164cf103bacc4f4d154894ea53e07dd3fdd5ebb16fb1a82a7b1a0",
|
||||
- "x86_64-unknown-linux-gnu": "2c8cb15c6a2caadaa98af51df6fe78a8155b8471cb3dd7b9836038e0d3657fb4",
|
||||
- "aarch64-apple-darwin-freethreaded": "efc2e71c0e05bc5bedb7a846e05f28dd26491b1744ded35ed82f8b49ccfa684b",
|
||||
- "aarch64-unknown-linux-gnu-freethreaded": "59b50df9826475d24bb7eff781fa3949112b5e9c92adb29e96a09cdf1216d5bd",
|
||||
- "ppc64le-unknown-linux-gnu-freethreaded": "1217efa5f4ce67fcc9f7eb64165b1bd0912b2a21bc25c1a7e2cb174a21a5df7e",
|
||||
- "s390x-unknown-linux-gnu-freethreaded": "6c3e1e4f19d2b018b65a7e3ef4cd4225c5b9adfbc490218628466e636d5c4b8c",
|
||||
- "x86_64-apple-darwin-freethreaded": "2e07dfea62fe2215738551a179c87dbed1cc79d1b3654f4d7559889a6d5ce4eb",
|
||||
- "x86_64-pc-windows-msvc-freethreaded": "bfd89f9acf866463bc4baf01733da5e767d13f5d0112175a4f57ba91f1541310",
|
||||
- "x86_64-unknown-linux-gnu-freethreaded": "a73adeda301ad843cce05f31a2d3e76222b656984535a7b87696a24a098b216c",
|
||||
+ "3.13.2": {
|
||||
+ "url": "20250317/cpython-{python_version}+20250317-{platform}-{build}.{ext}",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "faa44274a331eb39786362818b21b3a4e74514e8805000b20b0e55c590cecb94",
|
||||
+ "aarch64-unknown-linux-gnu": "9c67260446fee6ea706dad577a0b32936c63f449c25d66e4383d5846b2ab2e36",
|
||||
+ "ppc64le-unknown-linux-gnu": "345b53d2f86c9dbd7f1320657cb227ff9a42ef63ff21f129abbbc8c82a375147",
|
||||
+ "s390x-unknown-linux-gnu": "ec3b16ea8a97e3138acec72bc5ff35949950c62c8994a8ec8e213fd93f0e806b",
|
||||
+ "x86_64-apple-darwin": "ee4526e84b5ce5b11141c50060b385320f2773616249a741f90c96d460ce8e8f",
|
||||
+ "x86_64-pc-windows-msvc": "84d7b52f3558c8e35c670a4fa14080c75e3ec584adfae49fec8b51008b75b21e",
|
||||
+ "x86_64-unknown-linux-gnu": "db011f0cd29cab2291584958f4e2eb001b0e6051848d89b38a2dc23c5c54e512",
|
||||
+ "x86_64-unknown-linux-musl": "00bb2d629f7eacbb5c6b44dc04af26d1f1da64cee3425b0d8eb5135a93830296",
|
||||
+ "aarch64-apple-darwin-freethreaded": "c98c9c977e6fa05c3813bd49f3553904d89d60fed27e2e36468da7afa1d6d5e2",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "b8635e59e3143fd17f19a3dfe8ccc246ee6587c87da359bd1bcab35eefbb5f19",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "6ae8fa44cb2edf4ab49cff1820b53c40c10349c0f39e11b8cd76ce7f3e7e1def",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "c074144cc80c2af32c420b79a9df26e8db405212619990c1fbdd308bd75afe3f",
|
||||
+ "x86_64-apple-darwin-freethreaded": "0d73e4348d8d4b5159058609d2303705190405b485dd09ad05d870d7e0f36e0f",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "c51b4845fda5421e044067c111192f645234081d704313f74ee77fa013a186ea",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "1aea5062614c036904b55c1cc2fb4b500b7f6f7a4cacc263f4888889d355eef8",
|
||||
+ },
|
||||
+ "strip_prefix": {
|
||||
+ "aarch64-apple-darwin": "python",
|
||||
+ "aarch64-unknown-linux-gnu": "python",
|
||||
+ "ppc64le-unknown-linux-gnu": "python",
|
||||
+ "s390x-unknown-linux-gnu": "python",
|
||||
+ "x86_64-apple-darwin": "python",
|
||||
+ "x86_64-pc-windows-msvc": "python",
|
||||
+ "x86_64-unknown-linux-gnu": "python",
|
||||
+ "x86_64-unknown-linux-musl": "python",
|
||||
+ "aarch64-apple-darwin-freethreaded": "python/install",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "x86_64-apple-darwin-freethreaded": "python/install",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "python/install",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ },
|
||||
+ },
|
||||
+ # Note: This is python 3.14.0rc1, but it is labeled as '3.14.0' due to limitation within rules_python
|
||||
+ # that prevents the correct handling of pre-release version identifiers like '3.14.0a'.
|
||||
+ "3.14.0": {
|
||||
+ "url": "20250723/cpython-{python_version}rc1+20250723-{platform}-{build}.{ext}",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "2b92957f70585f5672390fff3401055e668819777df47e3a66e000e382940979",
|
||||
+ "aarch64-unknown-linux-gnu": "832ce0f827bb3f2c93c993d45a8706e20d3222edf35a918879cf94f9545732a4",
|
||||
+ "ppc64le-unknown-linux-gnu": "a28efca51e222133acd159cd304f1b4a0634b3c782ed833fae0ee0b9a18173df",
|
||||
+ "s390x-unknown-linux-gnu": "7638642bbdf0fba3fe2cd515fd8d14d91846bfaad20acc8ef87efe5c3e55b05d",
|
||||
+ "x86_64-apple-darwin": "244348d8504ff649a6e79c128c51e1ec52bef689f15433fe7948fdd1d523076e",
|
||||
+ "x86_64-pc-windows-msvc": "dbaac5ef2aeba93372f7a829bd1f88c2d8612875a87bffc1be68fa1a1940613e",
|
||||
+ "x86_64-unknown-linux-gnu": "7547d0f0621cc9641a98b5dfb93ef2386f194b9c95996912cf9e3195d3760089",
|
||||
+ "x86_64-unknown-linux-musl": "09142c7c4f413393b035f015733adb02f0fb72a4af3fab43b01fa03d3682c9ad",
|
||||
+ "aarch64-apple-darwin-freethreaded": "0bed2d0aee3eec6ae47fb5aa18e83c63d31621276ec73956cff8074870e2b8cd",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "b71f5c60fdffb4f375d53a3d16a45520b76af52448f55414243b6b20606447ac",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "982f0f8451cd90986b43683b119f157fe4eb69f763be18a65503b4869266798a",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "d870eb1d41bdf97a9739c387b6d8ca948f66f9ea9a77e5a3591c3b88551bdcfd",
|
||||
+ "x86_64-apple-darwin-freethreaded": "04447e12c93b9299a28bfba10d94fb02bd18ff858097fa95474c5c6673d826d1",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "3cf7290af19454ed0e30649ccd0c68d67911b22428e008af08766723efd212b2",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "ab51a2a4162b9ec329fdcd2e15ac0d59a458d8db133c03a07ad86a8890a302ae",
|
||||
+ },
|
||||
+ "strip_prefix": {
|
||||
+ "aarch64-apple-darwin": "python",
|
||||
+ "aarch64-unknown-linux-gnu": "python",
|
||||
+ "ppc64le-unknown-linux-gnu": "python",
|
||||
+ "s390x-unknown-linux-gnu": "python",
|
||||
+ "x86_64-apple-darwin": "python",
|
||||
+ "x86_64-pc-windows-msvc": "python",
|
||||
+ "x86_64-unknown-linux-gnu": "python",
|
||||
+ "x86_64-unknown-linux-musl": "python",
|
||||
+ "aarch64-apple-darwin-freethreaded": "python/install",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "x86_64-apple-darwin-freethreaded": "python/install",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "python/install",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
},
|
||||
- "strip_prefix": "python",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -604,7 +660,8 @@ MINOR_MAPPING = {
|
||||
"3.10": "3.10.15",
|
||||
"3.11": "3.11.10",
|
||||
"3.12": "3.12.8",
|
||||
- "3.13": "3.13.0",
|
||||
+ "3.13": "3.13.2",
|
||||
+ "3.14": "3.14.0",
|
||||
}
|
||||
|
||||
def _generate_platforms():
|
||||
@@ -778,11 +835,15 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
|
||||
p, _, _ = platform.partition("-" + FREETHREADED)
|
||||
|
||||
if FREETHREADED in platform:
|
||||
+ if "3.13" in python_version:
|
||||
+ aarch64_linux_suffix = "lto"
|
||||
+ else:
|
||||
+ aarch64_linux_suffix = "pgo+lto"
|
||||
build = "{}+{}-full".format(
|
||||
FREETHREADED,
|
||||
{
|
||||
"aarch64-apple-darwin": "pgo+lto",
|
||||
- "aarch64-unknown-linux-gnu": "lto",
|
||||
+ "aarch64-unknown-linux-gnu": aarch64_linux_suffix,
|
||||
"ppc64le-unknown-linux-gnu": "lto",
|
||||
"s390x-unknown-linux-gnu": "lto",
|
||||
"x86_64-apple-darwin": "pgo+lto",
|
||||
@@ -793,9 +854,6 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
|
||||
else:
|
||||
build = "install_only"
|
||||
|
||||
- if WINDOWS_NAME in platform:
|
||||
- build = "shared-" + build
|
||||
-
|
||||
release_filename = u.format(
|
||||
platform = p,
|
||||
python_version = python_version,
|
||||
45
third_party/py/rules_python3.patch
vendored
45
third_party/py/rules_python3.patch
vendored
|
|
@ -1,45 +0,0 @@
|
|||
diff --git a/python/private/python_register_toolchains.bzl b/python/private/python_register_toolchains.bzl
|
||||
index 98c8e5bf..fc533001 100644
|
||||
--- a/python/private/python_register_toolchains.bzl
|
||||
+++ b/python/private/python_register_toolchains.bzl
|
||||
@@ -86,6 +86,7 @@ def python_register_toolchains(
|
||||
minor_mapping = minor_mapping or MINOR_MAPPING
|
||||
|
||||
python_version = full_version(version = python_version, minor_mapping = minor_mapping)
|
||||
+ python_version_kind = kwargs.pop("python_version_kind", "")
|
||||
|
||||
toolchain_repo_name = "{name}_toolchains".format(name = name)
|
||||
|
||||
@@ -165,6 +166,7 @@ def python_register_toolchains(
|
||||
toolchain_aliases(
|
||||
name = name,
|
||||
python_version = python_version,
|
||||
+ python_version_kind = python_version_kind,
|
||||
user_repository_name = name,
|
||||
platforms = loaded_platforms,
|
||||
)
|
||||
diff --git a/python/private/toolchains_repo.bzl b/python/private/toolchains_repo.bzl
|
||||
index d21fb53a..a5271c18 100644
|
||||
--- a/python/private/toolchains_repo.bzl
|
||||
+++ b/python/private/toolchains_repo.bzl
|
||||
@@ -130,6 +130,9 @@ def _toolchain_aliases_impl(rctx):
|
||||
(os_name, arch) = _get_host_os_arch(rctx, logger)
|
||||
|
||||
host_platform = _get_host_platform(os_name, arch)
|
||||
+ python_version_kind = rctx.attr.python_version_kind
|
||||
+ if python_version_kind == "ft":
|
||||
+ host_platform += "-freethreaded"
|
||||
|
||||
is_windows = (os_name == WINDOWS_NAME)
|
||||
python3_binary_path = "python.exe" if is_windows else "bin/python3"
|
||||
@@ -233,6 +236,10 @@ actions.""",
|
||||
doc = "List of platforms for which aliases shall be created",
|
||||
),
|
||||
"python_version": attr.string(doc = "The Python version."),
|
||||
+ "python_version_kind": attr.string(
|
||||
+ doc = "Python version kind, e.g. ft (free-threaded)",
|
||||
+ default = ""
|
||||
+ ),
|
||||
"user_repository_name": attr.string(
|
||||
mandatory = True,
|
||||
doc = "The base name for all created repositories, like 'python38'.",
|
||||
13
third_party/py/rules_python_freethreaded.patch
vendored
Normal file
13
third_party/py/rules_python_freethreaded.patch
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/python/private/toolchains_repo.bzl b/python/private/toolchains_repo.bzl
|
||||
index 93bbb521..f7ff19c3 100644
|
||||
--- a/python/private/toolchains_repo.bzl
|
||||
+++ b/python/private/toolchains_repo.bzl
|
||||
@@ -214,7 +214,7 @@ def python_toolchain_build_file_content(
|
||||
user_repository_name = "{}_{}".format(user_repository_name, platform),
|
||||
python_version = python_version,
|
||||
set_python_version_constraint = set_python_version_constraint,
|
||||
- target_settings = [],
|
||||
+ target_settings = meta.target_settings,
|
||||
))
|
||||
return "\n\n".join(entries)
|
||||
|
||||
26
third_party/py/rules_python_pip_version.patch
vendored
Normal file
26
third_party/py/rules_python_pip_version.patch
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/python/private/pypi/deps.bzl b/python/private/pypi/deps.bzl
|
||||
index 8949ed4a..8d0ab0e7 100644
|
||||
--- a/python/private/pypi/deps.bzl
|
||||
+++ b/python/private/pypi/deps.bzl
|
||||
@@ -51,8 +51,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__packaging",
|
||||
- "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
|
||||
- "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
|
||||
+ "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
|
||||
+ "09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
|
||||
),
|
||||
(
|
||||
"pypi__pep517",
|
||||
@@ -61,8 +61,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__pip",
|
||||
- "https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
|
||||
- "ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
|
||||
+ "https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
|
||||
+ "3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
|
||||
),
|
||||
(
|
||||
"pypi__pip_tools",
|
||||
7
third_party/xla/tensorflow.bazelrc
vendored
7
third_party/xla/tensorflow.bazelrc
vendored
|
|
@ -64,7 +64,12 @@ build --host_copt=-DGRPC_BAZEL_BUILD
|
|||
build --action_env=GRPC_BAZEL_RUNTIME=1
|
||||
build --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
||||
build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
||||
build --repo_env=RULES_PYTHON_ENABLE_PYSTAR=0
|
||||
# Some targets have the same py source file, but use different
|
||||
# configurations via `requires-` tags. This results in an action
|
||||
# conflict when precompiling. Disable to avoid that problem.
|
||||
# See https://github.com/bazel-contrib/rules_python/issues/2445
|
||||
build --@rules_python//python/config_settings:precompile=force_disabled
|
||||
|
||||
# Do not do this. This is how gRPC builds itself by default, but we don't want
|
||||
# that as it would link protobuf into its own set of dynamic libraries, which
|
||||
# would conflict with our protobuf linkage.
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ diff --git a/python/dist/system_python.bzl b/python/dist/system_python.bzl
|
|||
- visibility = ["//visibility:public"],
|
||||
+alias(
|
||||
+ name = "python_headers",
|
||||
+ actual = "@python//:python_headers",
|
||||
+ actual = "@rules_python//python/cc:current_py_cc_headers",
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
|
|
|||
2
third_party/xla/third_party/py/BUILD.bazel
vendored
2
third_party/xla/third_party/py/BUILD.bazel
vendored
|
|
@ -1,6 +1,6 @@
|
|||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@python//:defs.bzl", "compile_pip_requirements")
|
||||
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
|
||||
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
|
||||
|
||||
compile_pip_requirements(
|
||||
name = "requirements",
|
||||
|
|
|
|||
7
third_party/xla/third_party/py/BUILD.tpl
vendored
7
third_party/xla/third_party/py/BUILD.tpl
vendored
|
|
@ -5,17 +5,16 @@ package(default_visibility = ["//visibility:public"])
|
|||
# Point both runtimes to the same python binary to ensure we always
|
||||
# use the python binary specified by ./configure.py script.
|
||||
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
|
||||
load("@python//:defs.bzl", "interpreter")
|
||||
|
||||
py_runtime(
|
||||
name = "py2_runtime",
|
||||
interpreter_path = interpreter,
|
||||
interpreter = "%{PYTHON_INTERPRETER}",
|
||||
python_version = "PY2",
|
||||
)
|
||||
|
||||
py_runtime(
|
||||
name = "py3_runtime",
|
||||
interpreter_path = interpreter,
|
||||
interpreter = "%{PYTHON_INTERPRETER}",
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ toolchain(
|
|||
)
|
||||
|
||||
alias(name = "python_headers",
|
||||
actual = "@python//:python_headers")
|
||||
actual = "@rules_python//python/cc:current_py_cc_headers")
|
||||
|
||||
# This alias is exists for the use of targets in the @llvm-project dependency,
|
||||
# which expect a python_headers target called @python_runtime//:headers. We use
|
||||
|
|
|
|||
|
|
@ -7,18 +7,27 @@ load(
|
|||
"PYTHON_BIN_PATH",
|
||||
"PYTHON_LIB_PATH",
|
||||
)
|
||||
load("//third_party/py:python_init_toolchains.bzl", "get_toolchain_name_per_python_version")
|
||||
|
||||
def _get_python_interpreter():
|
||||
return "@{}_host//:python".format(
|
||||
get_toolchain_name_per_python_version("python"),
|
||||
)
|
||||
|
||||
def _create_local_python_repository(repository_ctx):
|
||||
"""Creates the repository containing files set up to build with Python."""
|
||||
|
||||
# Resolve all labels before doing any real work. Resolving causes the
|
||||
# function to be restarted with all previous state being lost. This
|
||||
# can easily lead to a O(n^2) runtime in the number of labels.
|
||||
build_tpl = repository_ctx.path(Label("//third_party/py:BUILD.tpl"))
|
||||
platform_constraint = ""
|
||||
if repository_ctx.attr.platform_constraint:
|
||||
platform_constraint = "\"%s\"" % repository_ctx.attr.platform_constraint
|
||||
repository_ctx.template("BUILD", build_tpl, {"%{PLATFORM_CONSTRAINT}": platform_constraint})
|
||||
repository_ctx.template(
|
||||
"BUILD",
|
||||
repository_ctx.attr.build_tpl,
|
||||
{
|
||||
"%{PLATFORM_CONSTRAINT}": platform_constraint,
|
||||
"%{PYTHON_INTERPRETER}": repository_ctx.attr.python_interpreter,
|
||||
},
|
||||
)
|
||||
|
||||
def _python_autoconf_impl(repository_ctx):
|
||||
"""Implementation of the python_autoconf repository rule."""
|
||||
|
|
@ -35,6 +44,8 @@ local_python_configure = repository_rule(
|
|||
attrs = {
|
||||
"environ": attr.string_dict(),
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -45,6 +56,8 @@ remote_python_configure = repository_rule(
|
|||
attrs = {
|
||||
"environ": attr.string_dict(),
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -52,6 +65,8 @@ python_configure = repository_rule(
|
|||
implementation = _python_autoconf_impl,
|
||||
attrs = {
|
||||
"platform_constraint": attr.string(),
|
||||
"build_tpl": attr.label(default = Label("//third_party/py:BUILD.tpl")),
|
||||
"python_interpreter": attr.string(default = _get_python_interpreter()),
|
||||
},
|
||||
)
|
||||
"""Detects and configures the local Python.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
"""Hermetic Python initialization. Consult the WORKSPACE on how to use it."""
|
||||
|
||||
load("@python//:defs.bzl", "interpreter")
|
||||
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS_WITH_LOCAL_WHEELS")
|
||||
load("@rules_python//python:pip.bzl", "package_annotation", "pip_parse")
|
||||
load(
|
||||
"//third_party/py:python_init_toolchains.bzl",
|
||||
"get_toolchain_name_per_python_version",
|
||||
)
|
||||
|
||||
def python_init_pip():
|
||||
numpy_annotations = {
|
||||
|
|
@ -29,6 +32,8 @@ cc_library(
|
|||
pip_parse(
|
||||
name = "pypi",
|
||||
annotations = numpy_annotations,
|
||||
python_interpreter_target = interpreter,
|
||||
python_interpreter_target = "@{}_host//:python".format(
|
||||
get_toolchain_name_per_python_version("python"),
|
||||
),
|
||||
requirements_lock = REQUIREMENTS_WITH_LOCAL_WHEELS,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"""Hermetic Python initialization. Consult the WORKSPACE on how to use it."""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
|
||||
|
||||
def python_init_rules(extra_patches = []):
|
||||
"""Defines (doesn't setup) the rules_python repository.
|
||||
|
|
@ -9,15 +10,38 @@ def python_init_rules(extra_patches = []):
|
|||
extra_patches: list of labels. Additional patches to apply after the default
|
||||
set of patches.
|
||||
"""
|
||||
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.1.0.tar.gz"],
|
||||
strip_prefix = "rules_cc-0.1.0",
|
||||
sha256 = "4b12149a041ddfb8306a8fd0e904e39d673552ce82e4296e96fac9cbf0780e59",
|
||||
patches = [
|
||||
Label("//third_party/py:rules_cc_protobuf.patch"),
|
||||
],
|
||||
patch_args = ["-p1"],
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
name = "com_google_protobuf",
|
||||
patch_file = ["//third_party/protobuf:protobuf.patch"],
|
||||
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
|
||||
strip_prefix = "protobuf-6.31.1",
|
||||
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip"),
|
||||
repo_mapping = {
|
||||
"@abseil-cpp": "@com_google_absl",
|
||||
"@protobuf_pip_deps": "@pypi",
|
||||
},
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "rules_python",
|
||||
sha256 = "62ddebb766b4d6ddf1712f753dac5740bea072646f630eb9982caa09ad8a7687",
|
||||
strip_prefix = "rules_python-0.39.0",
|
||||
url = "https://github.com/bazelbuild/rules_python/releases/download/0.39.0/rules_python-0.39.0.tar.gz",
|
||||
sha256 = "fa7dd2c6b7d63b3585028dd8a90a6cf9db83c33b250959c2ee7b583a6c130e12",
|
||||
strip_prefix = "rules_python-1.6.0",
|
||||
url = "https://github.com/bazelbuild/rules_python/releases/download/1.6.0/rules_python-1.6.0.tar.gz",
|
||||
patch_args = ["-p1"],
|
||||
patches = [
|
||||
Label("//third_party/py:rules_python1.patch"),
|
||||
Label("//third_party/py:rules_python2.patch"),
|
||||
Label("//third_party/py:rules_python3.patch"),
|
||||
Label("//third_party/py:rules_python_pip_version.patch"),
|
||||
Label("//third_party/py:rules_python_freethreaded.patch"),
|
||||
] + extra_patches,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,16 +6,21 @@ load(
|
|||
"HERMETIC_PYTHON_SHA256",
|
||||
"HERMETIC_PYTHON_URL",
|
||||
"HERMETIC_PYTHON_VERSION",
|
||||
"HERMETIC_PYTHON_VERSION_KIND",
|
||||
)
|
||||
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
|
||||
load("@rules_python//python:versions.bzl", "MINOR_MAPPING", "PLATFORMS")
|
||||
|
||||
def get_toolchain_name_per_python_version(name):
|
||||
return "{name}_{version}".format(
|
||||
name = name,
|
||||
version = HERMETIC_PYTHON_VERSION.replace(".", "_"),
|
||||
)
|
||||
|
||||
def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
||||
"""Register hermetic python toolchains.
|
||||
|
||||
Args:
|
||||
name: name of the toolchain, "python" by default (it is strongly
|
||||
name: prefix of the toolchain, "python" by default (it is strongly
|
||||
recommended to rely on the default).
|
||||
python_version: version of the python to register; if set it will bypass
|
||||
kwargs to underlying python_register_toolchains as is (manual
|
||||
|
|
@ -27,7 +32,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
|
||||
if python_version:
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
python_version = python_version,
|
||||
**kwargs
|
||||
)
|
||||
|
|
@ -44,7 +49,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
sha256s[platform] = HERMETIC_PYTHON_SHA256
|
||||
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
base_url = url_components[0] + "://",
|
||||
ignore_root_user_error = True,
|
||||
python_version = tool_version,
|
||||
|
|
@ -59,8 +64,7 @@ def python_init_toolchains(name = "python", python_version = None, **kwargs):
|
|||
)
|
||||
elif HERMETIC_PYTHON_VERSION in MINOR_MAPPING:
|
||||
python_register_toolchains(
|
||||
name = name,
|
||||
name = get_toolchain_name_per_python_version(name),
|
||||
ignore_root_user_error = True,
|
||||
python_version = HERMETIC_PYTHON_VERSION,
|
||||
python_version_kind = HERMETIC_PYTHON_VERSION_KIND,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
load("@rules_python//python:py_info.bzl", "PyInfo")
|
||||
|
||||
""" Repository and build rules for Python wheels packaging utilities. """
|
||||
|
||||
def _get_host_environ(repository_ctx, name, default_value = None):
|
||||
|
|
|
|||
16
third_party/xla/third_party/py/rules_cc_protobuf.patch
vendored
Normal file
16
third_party/xla/third_party/py/rules_cc_protobuf.patch
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/cc/defs.bzl b/cc/defs.bzl
|
||||
index 3448e77..9c298ab 100644
|
||||
--- a/cc/defs.bzl
|
||||
+++ b/cc/defs.bzl
|
||||
@@ -30,9 +30,11 @@ load("//cc/toolchains:cc_toolchain_suite.bzl", _cc_toolchain_suite = "cc_toolcha
|
||||
load("//cc/toolchains:compiler_flag.bzl", _compiler_flag = "compiler_flag")
|
||||
load("//cc/toolchains:fdo_prefetch_hints.bzl", _fdo_prefetch_hints = "fdo_prefetch_hints")
|
||||
load("//cc/toolchains:fdo_profile.bzl", _fdo_profile = "fdo_profile")
|
||||
+load("@com_google_protobuf//bazel:cc_proto_library.bzl", _protobuf_cc_proto_library = "cc_proto_library")
|
||||
|
||||
# Rules
|
||||
|
||||
+cc_proto_library = _protobuf_cc_proto_library
|
||||
cc_library = _cc_library
|
||||
cc_binary = _cc_binary
|
||||
cc_test = _cc_test
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
diff --git a/python/private/pypi/deps.bzl b/python/private/pypi/deps.bzl
|
||||
index 8949ed4a..8d0ab0e7 100644
|
||||
--- a/python/private/pypi/deps.bzl
|
||||
+++ b/python/private/pypi/deps.bzl
|
||||
@@ -51,8 +51,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__packaging",
|
||||
- "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
|
||||
- "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
|
||||
+ "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
|
||||
+ "09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
|
||||
),
|
||||
(
|
||||
"pypi__pep517",
|
||||
@@ -61,8 +61,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__pip",
|
||||
- "https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
|
||||
- "ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
|
||||
+ "https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
|
||||
+ "3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
|
||||
),
|
||||
(
|
||||
"pypi__pip_tools",
|
||||
diff --git a/python/private/pypi/evaluate_markers.bzl b/python/private/pypi/evaluate_markers.bzl
|
||||
index c805fd7a..e57e6138 100644
|
||||
--- a/python/private/pypi/evaluate_markers.bzl
|
||||
+++ b/python/private/pypi/evaluate_markers.bzl
|
||||
@@ -20,7 +20,7 @@ load(":pypi_repo_utils.bzl", "pypi_repo_utils")
|
||||
SRCS = [
|
||||
# When the version, or any of the files in `packaging` package changes,
|
||||
# this file will change as well.
|
||||
- Label("@pypi__packaging//:packaging-24.0.dist-info/RECORD"),
|
||||
+ Label("@pypi__packaging//:packaging-24.2.dist-info/RECORD"),
|
||||
Label("//python/private/pypi/requirements_parser:resolve_target_platforms.py"),
|
||||
Label("//python/private/pypi/whl_installer:platform.py"),
|
||||
]
|
||||
diff --git a/python/versions.bzl b/python/versions.bzl
|
||||
index 774c24d1..91e59f9b 100644
|
||||
--- a/python/versions.bzl
|
||||
+++ b/python/versions.bzl
|
||||
@@ -561,6 +561,20 @@ TOOL_VERSIONS = {
|
||||
},
|
||||
"strip_prefix": "python",
|
||||
},
|
||||
+ "3.12.8": {
|
||||
+ "url": "20241206/cpython-{python_version}+20241206-{platform}-{build}.tar.gz",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "e3c4aa607717b23903ca2650d5c3ee24f89b97543e2db2b0f463bddc7a9e92f3",
|
||||
+ "aarch64-unknown-linux-gnu": "ce674b55442b732973afb2932c281bb1ded4ad7e22bcf9b07071165770758c7e",
|
||||
+ "ppc64le-unknown-linux-gnu": "b7214790b273de9ed0532420054b72ba1393d62d2fc844ec55ade193771bd90c",
|
||||
+ "s390x-unknown-linux-gnu": "73102f5dbd7d1e7e9c2f2c80aedf2893d99a7fa407f6674ec8b2f57ba07daee5",
|
||||
+ "x86_64-apple-darwin": "3ba35c706577d755e8e52a4c161a042464577c0e695e2a605362fa469e26de10",
|
||||
+ "x86_64-pc-windows-msvc": "767b4be3ddf6b99e5ade519789c1615c191d8cf99d5aff4685cc18b48931f1e6",
|
||||
+ "x86_64-unknown-linux-gnu": "b9d6ee5ddac1198e72d53112698773fc8bb597de095592eb849ca794306699ba",
|
||||
+ "x86_64-unknown-linux-musl": "6f305888703691dd04cfff85284d23ea0b0146ed7c4415e472f1fb72b3f32cdf",
|
||||
+ },
|
||||
+ "strip_prefix": "python",
|
||||
+ },
|
||||
"3.13.0": {
|
||||
"url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
|
||||
"sha256": {
|
||||
@@ -589,7 +603,7 @@ MINOR_MAPPING = {
|
||||
"3.9": "3.9.20",
|
||||
"3.10": "3.10.15",
|
||||
"3.11": "3.11.10",
|
||||
- "3.12": "3.12.7",
|
||||
+ "3.12": "3.12.8",
|
||||
"3.13": "3.13.0",
|
||||
}
|
||||
|
||||
diff --git a/python/private/python_bootstrap_template.txt b/python/private/python_bootstrap_template.txt
|
||||
index 0f9c90b3..567bdc88 100644
|
||||
--- a/python/private/python_bootstrap_template.txt
|
||||
+++ b/python/private/python_bootstrap_template.txt
|
||||
@@ -52,7 +52,14 @@ def GetWindowsPathWithUNCPrefix(path):
|
||||
# removed from common Win32 file and directory functions.
|
||||
# Related doc: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later
|
||||
import platform
|
||||
- if platform.win32_ver()[1] >= '10.0.14393':
|
||||
+ version = None
|
||||
+ # The try-except block is needed to fix the flakiness of RBE tests
|
||||
+ # on Windows 2022 using hermetic python 3.12.8.
|
||||
+ try:
|
||||
+ version = platform.win32_ver()[1]
|
||||
+ except (ValueError, KeyError):
|
||||
+ version = platform.win32_ver()[1]
|
||||
+ if version and version >= '10.0.14393':
|
||||
return path
|
||||
|
||||
# import sysconfig only now to maintain python 2.6 compatibility
|
||||
150
third_party/xla/third_party/py/rules_python2.patch
vendored
150
third_party/xla/third_party/py/rules_python2.patch
vendored
|
|
@ -1,150 +0,0 @@
|
|||
diff --git a/python/versions.bzl b/python/versions.bzl
|
||||
index 91e59f9b..d72855db 100644
|
||||
--- a/python/versions.bzl
|
||||
+++ b/python/versions.bzl
|
||||
@@ -21,7 +21,7 @@ LINUX_NAME = "linux"
|
||||
WINDOWS_NAME = "windows"
|
||||
FREETHREADED = "freethreaded"
|
||||
|
||||
-DEFAULT_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download"
|
||||
+DEFAULT_RELEASE_BASE_URL = "https://github.com/astral-sh/python-build-standalone/releases/download"
|
||||
|
||||
# When updating the versions and releases, run the following command to get
|
||||
# the hashes:
|
||||
@@ -575,25 +575,81 @@ TOOL_VERSIONS = {
|
||||
},
|
||||
"strip_prefix": "python",
|
||||
},
|
||||
- "3.13.0": {
|
||||
- "url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
|
||||
- "sha256": {
|
||||
- "aarch64-apple-darwin": "31397953849d275aa2506580f3fa1cb5a85b6a3d392e495f8030e8b6412f5556",
|
||||
- "aarch64-unknown-linux-gnu": "e8378c0162b2e0e4cc1f62b29443a3305d116d09583304dbb0149fecaff6347b",
|
||||
- "ppc64le-unknown-linux-gnu": "fc4b7f27c4e84c78f3c8e6c7f8e4023e4638d11f1b36b6b5ce457b1926cebb53",
|
||||
- "s390x-unknown-linux-gnu": "66b19e6a07717f6cfcd3a8ca953f0a2eaa232291142f3d26a8d17c979ec0f467",
|
||||
- "x86_64-apple-darwin": "cff1b7e7cd26f2d47acac1ad6590e27d29829776f77e8afa067e9419f2f6ce77",
|
||||
- "x86_64-pc-windows-msvc": "b25926e8ce4164cf103bacc4f4d154894ea53e07dd3fdd5ebb16fb1a82a7b1a0",
|
||||
- "x86_64-unknown-linux-gnu": "2c8cb15c6a2caadaa98af51df6fe78a8155b8471cb3dd7b9836038e0d3657fb4",
|
||||
- "aarch64-apple-darwin-freethreaded": "efc2e71c0e05bc5bedb7a846e05f28dd26491b1744ded35ed82f8b49ccfa684b",
|
||||
- "aarch64-unknown-linux-gnu-freethreaded": "59b50df9826475d24bb7eff781fa3949112b5e9c92adb29e96a09cdf1216d5bd",
|
||||
- "ppc64le-unknown-linux-gnu-freethreaded": "1217efa5f4ce67fcc9f7eb64165b1bd0912b2a21bc25c1a7e2cb174a21a5df7e",
|
||||
- "s390x-unknown-linux-gnu-freethreaded": "6c3e1e4f19d2b018b65a7e3ef4cd4225c5b9adfbc490218628466e636d5c4b8c",
|
||||
- "x86_64-apple-darwin-freethreaded": "2e07dfea62fe2215738551a179c87dbed1cc79d1b3654f4d7559889a6d5ce4eb",
|
||||
- "x86_64-pc-windows-msvc-freethreaded": "bfd89f9acf866463bc4baf01733da5e767d13f5d0112175a4f57ba91f1541310",
|
||||
- "x86_64-unknown-linux-gnu-freethreaded": "a73adeda301ad843cce05f31a2d3e76222b656984535a7b87696a24a098b216c",
|
||||
+ "3.13.2": {
|
||||
+ "url": "20250317/cpython-{python_version}+20250317-{platform}-{build}.{ext}",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "faa44274a331eb39786362818b21b3a4e74514e8805000b20b0e55c590cecb94",
|
||||
+ "aarch64-unknown-linux-gnu": "9c67260446fee6ea706dad577a0b32936c63f449c25d66e4383d5846b2ab2e36",
|
||||
+ "ppc64le-unknown-linux-gnu": "345b53d2f86c9dbd7f1320657cb227ff9a42ef63ff21f129abbbc8c82a375147",
|
||||
+ "s390x-unknown-linux-gnu": "ec3b16ea8a97e3138acec72bc5ff35949950c62c8994a8ec8e213fd93f0e806b",
|
||||
+ "x86_64-apple-darwin": "ee4526e84b5ce5b11141c50060b385320f2773616249a741f90c96d460ce8e8f",
|
||||
+ "x86_64-pc-windows-msvc": "84d7b52f3558c8e35c670a4fa14080c75e3ec584adfae49fec8b51008b75b21e",
|
||||
+ "x86_64-unknown-linux-gnu": "db011f0cd29cab2291584958f4e2eb001b0e6051848d89b38a2dc23c5c54e512",
|
||||
+ "x86_64-unknown-linux-musl": "00bb2d629f7eacbb5c6b44dc04af26d1f1da64cee3425b0d8eb5135a93830296",
|
||||
+ "aarch64-apple-darwin-freethreaded": "c98c9c977e6fa05c3813bd49f3553904d89d60fed27e2e36468da7afa1d6d5e2",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "b8635e59e3143fd17f19a3dfe8ccc246ee6587c87da359bd1bcab35eefbb5f19",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "6ae8fa44cb2edf4ab49cff1820b53c40c10349c0f39e11b8cd76ce7f3e7e1def",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "c074144cc80c2af32c420b79a9df26e8db405212619990c1fbdd308bd75afe3f",
|
||||
+ "x86_64-apple-darwin-freethreaded": "0d73e4348d8d4b5159058609d2303705190405b485dd09ad05d870d7e0f36e0f",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "c51b4845fda5421e044067c111192f645234081d704313f74ee77fa013a186ea",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "1aea5062614c036904b55c1cc2fb4b500b7f6f7a4cacc263f4888889d355eef8",
|
||||
+ },
|
||||
+ "strip_prefix": {
|
||||
+ "aarch64-apple-darwin": "python",
|
||||
+ "aarch64-unknown-linux-gnu": "python",
|
||||
+ "ppc64le-unknown-linux-gnu": "python",
|
||||
+ "s390x-unknown-linux-gnu": "python",
|
||||
+ "x86_64-apple-darwin": "python",
|
||||
+ "x86_64-pc-windows-msvc": "python",
|
||||
+ "x86_64-unknown-linux-gnu": "python",
|
||||
+ "x86_64-unknown-linux-musl": "python",
|
||||
+ "aarch64-apple-darwin-freethreaded": "python/install",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "x86_64-apple-darwin-freethreaded": "python/install",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "python/install",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ },
|
||||
+ },
|
||||
+ # Note: This is python 3.14.0rc1, but it is labeled as '3.14.0' due to limitation within rules_python
|
||||
+ # that prevents the correct handling of pre-release version identifiers like '3.14.0a'.
|
||||
+ "3.14.0": {
|
||||
+ "url": "20250723/cpython-{python_version}rc1+20250723-{platform}-{build}.{ext}",
|
||||
+ "sha256": {
|
||||
+ "aarch64-apple-darwin": "2b92957f70585f5672390fff3401055e668819777df47e3a66e000e382940979",
|
||||
+ "aarch64-unknown-linux-gnu": "832ce0f827bb3f2c93c993d45a8706e20d3222edf35a918879cf94f9545732a4",
|
||||
+ "ppc64le-unknown-linux-gnu": "a28efca51e222133acd159cd304f1b4a0634b3c782ed833fae0ee0b9a18173df",
|
||||
+ "s390x-unknown-linux-gnu": "7638642bbdf0fba3fe2cd515fd8d14d91846bfaad20acc8ef87efe5c3e55b05d",
|
||||
+ "x86_64-apple-darwin": "244348d8504ff649a6e79c128c51e1ec52bef689f15433fe7948fdd1d523076e",
|
||||
+ "x86_64-pc-windows-msvc": "dbaac5ef2aeba93372f7a829bd1f88c2d8612875a87bffc1be68fa1a1940613e",
|
||||
+ "x86_64-unknown-linux-gnu": "7547d0f0621cc9641a98b5dfb93ef2386f194b9c95996912cf9e3195d3760089",
|
||||
+ "x86_64-unknown-linux-musl": "09142c7c4f413393b035f015733adb02f0fb72a4af3fab43b01fa03d3682c9ad",
|
||||
+ "aarch64-apple-darwin-freethreaded": "0bed2d0aee3eec6ae47fb5aa18e83c63d31621276ec73956cff8074870e2b8cd",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "b71f5c60fdffb4f375d53a3d16a45520b76af52448f55414243b6b20606447ac",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "982f0f8451cd90986b43683b119f157fe4eb69f763be18a65503b4869266798a",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "d870eb1d41bdf97a9739c387b6d8ca948f66f9ea9a77e5a3591c3b88551bdcfd",
|
||||
+ "x86_64-apple-darwin-freethreaded": "04447e12c93b9299a28bfba10d94fb02bd18ff858097fa95474c5c6673d826d1",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "3cf7290af19454ed0e30649ccd0c68d67911b22428e008af08766723efd212b2",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "ab51a2a4162b9ec329fdcd2e15ac0d59a458d8db133c03a07ad86a8890a302ae",
|
||||
+ },
|
||||
+ "strip_prefix": {
|
||||
+ "aarch64-apple-darwin": "python",
|
||||
+ "aarch64-unknown-linux-gnu": "python",
|
||||
+ "ppc64le-unknown-linux-gnu": "python",
|
||||
+ "s390x-unknown-linux-gnu": "python",
|
||||
+ "x86_64-apple-darwin": "python",
|
||||
+ "x86_64-pc-windows-msvc": "python",
|
||||
+ "x86_64-unknown-linux-gnu": "python",
|
||||
+ "x86_64-unknown-linux-musl": "python",
|
||||
+ "aarch64-apple-darwin-freethreaded": "python/install",
|
||||
+ "aarch64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "ppc64le-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "s390x-unknown-linux-gnu-freethreaded": "python/install",
|
||||
+ "x86_64-apple-darwin-freethreaded": "python/install",
|
||||
+ "x86_64-pc-windows-msvc-freethreaded": "python/install",
|
||||
+ "x86_64-unknown-linux-gnu-freethreaded": "python/install",
|
||||
},
|
||||
- "strip_prefix": "python",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -604,7 +660,8 @@ MINOR_MAPPING = {
|
||||
"3.10": "3.10.15",
|
||||
"3.11": "3.11.10",
|
||||
"3.12": "3.12.8",
|
||||
- "3.13": "3.13.0",
|
||||
+ "3.13": "3.13.2",
|
||||
+ "3.14": "3.14.0",
|
||||
}
|
||||
|
||||
def _generate_platforms():
|
||||
@@ -778,11 +835,15 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
|
||||
p, _, _ = platform.partition("-" + FREETHREADED)
|
||||
|
||||
if FREETHREADED in platform:
|
||||
+ if "3.13" in python_version:
|
||||
+ aarch64_linux_suffix = "lto"
|
||||
+ else:
|
||||
+ aarch64_linux_suffix = "pgo+lto"
|
||||
build = "{}+{}-full".format(
|
||||
FREETHREADED,
|
||||
{
|
||||
"aarch64-apple-darwin": "pgo+lto",
|
||||
- "aarch64-unknown-linux-gnu": "lto",
|
||||
+ "aarch64-unknown-linux-gnu": aarch64_linux_suffix,
|
||||
"ppc64le-unknown-linux-gnu": "lto",
|
||||
"s390x-unknown-linux-gnu": "lto",
|
||||
"x86_64-apple-darwin": "pgo+lto",
|
||||
@@ -793,9 +854,6 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
|
||||
else:
|
||||
build = "install_only"
|
||||
|
||||
- if WINDOWS_NAME in platform:
|
||||
- build = "shared-" + build
|
||||
-
|
||||
release_filename = u.format(
|
||||
platform = p,
|
||||
python_version = python_version,
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
diff --git a/python/private/python_register_toolchains.bzl b/python/private/python_register_toolchains.bzl
|
||||
index 98c8e5bf..fc533001 100644
|
||||
--- a/python/private/python_register_toolchains.bzl
|
||||
+++ b/python/private/python_register_toolchains.bzl
|
||||
@@ -86,6 +86,7 @@ def python_register_toolchains(
|
||||
minor_mapping = minor_mapping or MINOR_MAPPING
|
||||
|
||||
python_version = full_version(version = python_version, minor_mapping = minor_mapping)
|
||||
+ python_version_kind = kwargs.pop("python_version_kind", "")
|
||||
|
||||
toolchain_repo_name = "{name}_toolchains".format(name = name)
|
||||
|
||||
@@ -165,6 +166,7 @@ def python_register_toolchains(
|
||||
toolchain_aliases(
|
||||
name = name,
|
||||
python_version = python_version,
|
||||
+ python_version_kind = python_version_kind,
|
||||
user_repository_name = name,
|
||||
platforms = loaded_platforms,
|
||||
)
|
||||
diff --git a/python/private/toolchains_repo.bzl b/python/private/toolchains_repo.bzl
|
||||
index d21fb53a..a5271c18 100644
|
||||
--- a/python/private/toolchains_repo.bzl
|
||||
+++ b/python/private/toolchains_repo.bzl
|
||||
@@ -130,6 +130,9 @@ def _toolchain_aliases_impl(rctx):
|
||||
(os_name, arch) = _get_host_os_arch(rctx, logger)
|
||||
|
||||
host_platform = _get_host_platform(os_name, arch)
|
||||
+ python_version_kind = rctx.attr.python_version_kind
|
||||
+ if python_version_kind == "ft":
|
||||
+ host_platform += "-freethreaded"
|
||||
|
||||
is_windows = (os_name == WINDOWS_NAME)
|
||||
python3_binary_path = "python.exe" if is_windows else "bin/python3"
|
||||
@@ -233,6 +236,10 @@ actions.""",
|
||||
doc = "List of platforms for which aliases shall be created",
|
||||
),
|
||||
"python_version": attr.string(doc = "The Python version."),
|
||||
+ "python_version_kind": attr.string(
|
||||
+ doc = "Python version kind, e.g. ft (free-threaded)",
|
||||
+ default = ""
|
||||
+ ),
|
||||
"user_repository_name": attr.string(
|
||||
mandatory = True,
|
||||
doc = "The base name for all created repositories, like 'python38'.",
|
||||
13
third_party/xla/third_party/py/rules_python_freethreaded.patch
vendored
Normal file
13
third_party/xla/third_party/py/rules_python_freethreaded.patch
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/python/private/toolchains_repo.bzl b/python/private/toolchains_repo.bzl
|
||||
index 93bbb521..f7ff19c3 100644
|
||||
--- a/python/private/toolchains_repo.bzl
|
||||
+++ b/python/private/toolchains_repo.bzl
|
||||
@@ -214,7 +214,7 @@ def python_toolchain_build_file_content(
|
||||
user_repository_name = "{}_{}".format(user_repository_name, platform),
|
||||
python_version = python_version,
|
||||
set_python_version_constraint = set_python_version_constraint,
|
||||
- target_settings = [],
|
||||
+ target_settings = meta.target_settings,
|
||||
))
|
||||
return "\n\n".join(entries)
|
||||
|
||||
26
third_party/xla/third_party/py/rules_python_pip_version.patch
vendored
Normal file
26
third_party/xla/third_party/py/rules_python_pip_version.patch
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/python/private/pypi/deps.bzl b/python/private/pypi/deps.bzl
|
||||
index 8949ed4a..8d0ab0e7 100644
|
||||
--- a/python/private/pypi/deps.bzl
|
||||
+++ b/python/private/pypi/deps.bzl
|
||||
@@ -51,8 +51,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__packaging",
|
||||
- "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl",
|
||||
- "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5",
|
||||
+ "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl",
|
||||
+ "09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759",
|
||||
),
|
||||
(
|
||||
"pypi__pep517",
|
||||
@@ -61,8 +61,8 @@ _RULE_DEPS = [
|
||||
),
|
||||
(
|
||||
"pypi__pip",
|
||||
- "https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl",
|
||||
- "ba0d021a166865d2265246961bec0152ff124de910c5cc39f1156ce3fa7c69dc",
|
||||
+ "https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl",
|
||||
+ "3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed",
|
||||
),
|
||||
(
|
||||
"pypi__pip_tools",
|
||||
|
|
@ -2,6 +2,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_c
|
|||
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
|
||||
load("@rules_cc//cc:cc_import.bzl", "cc_import")
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:py_info.bzl", "PyInfo")
|
||||
load("@rules_python//python:py_library.bzl", "py_library")
|
||||
|
||||
PywrapInfo = provider(
|
||||
|
|
|
|||
5
third_party/xla/workspace2.bzl
vendored
5
third_party/xla/workspace2.bzl
vendored
|
|
@ -3,6 +3,7 @@
|
|||
load("@bazel_features//:deps.bzl", "bazel_features_deps")
|
||||
load("@bazel_skylib//lib:versions.bzl", "versions")
|
||||
load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
|
||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
load("@io_bazel_rules_closure//closure:defs.bzl", "filegroup_external")
|
||||
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
|
||||
load("//third_party/absl:workspace.bzl", absl = "repo")
|
||||
|
|
@ -305,7 +306,9 @@ def _tf_repositories():
|
|||
},
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
# `com_google_protobuf` is initialized in `python_init_rules()`.
|
||||
maybe(
|
||||
tf_http_archive,
|
||||
name = "com_google_protobuf",
|
||||
patch_file = ["//third_party/protobuf:protobuf.patch"],
|
||||
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user