From 90be6e3a11b3489451dcacf918febda2a32f7b10 Mon Sep 17 00:00:00 2001 From: Vadym Matsishevskyi Date: Mon, 16 Sep 2024 13:05:45 -0700 Subject: [PATCH] Add Python 3.13.0rc2 support to rules_python in a form of a patch. TODO: once rules_python has 3.13 out of the box, the patch can be safely removed. rules_python does not depend on rc versions of Python (seems to be against its philosophy), while JAX wants to support it, that is why adding RC support in a form of a patch instead of adding it directly to rules_python. PiperOrigin-RevId: 675261914 --- third_party/py/python_init_rules.bzl | 2 ++ third_party/py/rules_python.patch | 36 +++++++++++++++++++ .../tsl/third_party/py/python_init_rules.bzl | 2 ++ .../tsl/third_party/py/rules_python.patch | 36 +++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 third_party/py/rules_python.patch create mode 100644 third_party/tsl/third_party/py/rules_python.patch diff --git a/third_party/py/python_init_rules.bzl b/third_party/py/python_init_rules.bzl index 4e1473e5342c4..5a13d25df4d97 100644 --- a/third_party/py/python_init_rules.bzl +++ b/third_party/py/python_init_rules.bzl @@ -8,4 +8,6 @@ def python_init_rules(): 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", + 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 new file mode 100644 index 0000000000000..7d59ac107cc95 --- /dev/null +++ b/third_party/py/rules_python.patch @@ -0,0 +1,36 @@ +Subject: [PATCH] Add Python 3.13.0rc2 support to rules_python +--- +Index: python/versions.bzl +<+>UTF-8 +=================================================================== +diff --git a/python/versions.bzl b/python/versions.bzl +--- a/python/versions.bzl (revision 084b877c98b580839ceab2b071b02fc6768f3de6) ++++ b/python/versions.bzl (date 1726256410148) +@@ -484,6 +484,19 @@ + }, + "strip_prefix": "python", + }, ++ "3.13.0": { ++ "url": "20240909/cpython-{python_version}rc2+20240909-{platform}-{build}.tar.gz", ++ "sha256": { ++ "aarch64-apple-darwin": "5d38ca1e6b030b004714e10813903e906c6b8f2a6361770df4512a838f4a4a9f", ++ "aarch64-unknown-linux-gnu": "85e103fc81a1fcf94a93180f6df42e39a7dc15d4b711705e133dc2ec847552e7", ++ "ppc64le-unknown-linux-gnu": "3be3d8aefae579c420fc6abf01658ae89fda8120154f989575b08085d2f8d6dc", ++ "s390x-unknown-linux-gnu": "6ec5130d62473368ecc7e55338bf1cc58607dbfe8088959cab51265b9f13c38d", ++ "x86_64-apple-darwin": "c3dcd4314324159945dc19342c73b9deb8de0f2d1709171427dd52f1a05eecca", ++ "x86_64-pc-windows-msvc": "31282f912e984d399c56925dfb69a4f3ce76226dfb4806b09f37e3b4a15e5a30", ++ "x86_64-unknown-linux-gnu": "028581cce5004c66775a3ae8b3ed65681ab4b289608dfd1aec3354d169216099", ++ }, ++ "strip_prefix": "python", ++ }, + } + + # buildifier: disable=unsorted-dict-items +@@ -493,6 +506,7 @@ + "3.10": "3.10.14", + "3.11": "3.11.9", + "3.12": "3.12.3", ++ "3.13": "3.13.0", + } + + PLATFORMS = { diff --git a/third_party/tsl/third_party/py/python_init_rules.bzl b/third_party/tsl/third_party/py/python_init_rules.bzl index 4e1473e5342c4..5a13d25df4d97 100644 --- a/third_party/tsl/third_party/py/python_init_rules.bzl +++ b/third_party/tsl/third_party/py/python_init_rules.bzl @@ -8,4 +8,6 @@ def python_init_rules(): 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", + patch_args = ["-p1"], + patches = [Label("//third_party/py:rules_python.patch")], ) diff --git a/third_party/tsl/third_party/py/rules_python.patch b/third_party/tsl/third_party/py/rules_python.patch new file mode 100644 index 0000000000000..7d59ac107cc95 --- /dev/null +++ b/third_party/tsl/third_party/py/rules_python.patch @@ -0,0 +1,36 @@ +Subject: [PATCH] Add Python 3.13.0rc2 support to rules_python +--- +Index: python/versions.bzl +<+>UTF-8 +=================================================================== +diff --git a/python/versions.bzl b/python/versions.bzl +--- a/python/versions.bzl (revision 084b877c98b580839ceab2b071b02fc6768f3de6) ++++ b/python/versions.bzl (date 1726256410148) +@@ -484,6 +484,19 @@ + }, + "strip_prefix": "python", + }, ++ "3.13.0": { ++ "url": "20240909/cpython-{python_version}rc2+20240909-{platform}-{build}.tar.gz", ++ "sha256": { ++ "aarch64-apple-darwin": "5d38ca1e6b030b004714e10813903e906c6b8f2a6361770df4512a838f4a4a9f", ++ "aarch64-unknown-linux-gnu": "85e103fc81a1fcf94a93180f6df42e39a7dc15d4b711705e133dc2ec847552e7", ++ "ppc64le-unknown-linux-gnu": "3be3d8aefae579c420fc6abf01658ae89fda8120154f989575b08085d2f8d6dc", ++ "s390x-unknown-linux-gnu": "6ec5130d62473368ecc7e55338bf1cc58607dbfe8088959cab51265b9f13c38d", ++ "x86_64-apple-darwin": "c3dcd4314324159945dc19342c73b9deb8de0f2d1709171427dd52f1a05eecca", ++ "x86_64-pc-windows-msvc": "31282f912e984d399c56925dfb69a4f3ce76226dfb4806b09f37e3b4a15e5a30", ++ "x86_64-unknown-linux-gnu": "028581cce5004c66775a3ae8b3ed65681ab4b289608dfd1aec3354d169216099", ++ }, ++ "strip_prefix": "python", ++ }, + } + + # buildifier: disable=unsorted-dict-items +@@ -493,6 +506,7 @@ + "3.10": "3.10.14", + "3.11": "3.11.9", + "3.12": "3.12.3", ++ "3.13": "3.13.0", + } + + PLATFORMS = {