From 78a65c76e863f7eef9a063d5e37dea6ec0232810 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 2 Mar 2022 16:28:04 -0800 Subject: [PATCH] Allow previous indygreg releases This gives us more python patch versions --- .../tests/toolchains/versions_test.bzl | 3 +- python/private/versions.bzl | 50 ++++++++++++------- python/repositories.bzl | 2 +- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/python/private/tests/toolchains/versions_test.bzl b/python/private/tests/toolchains/versions_test.bzl index 866249b5c0..19010ac9d2 100644 --- a/python/private/tests/toolchains/versions_test.bzl +++ b/python/private/tests/toolchains/versions_test.bzl @@ -21,14 +21,13 @@ load("//python/private:versions.bzl", "MINOR_MAPPING", "TOOL_VERSIONS") required_platforms = [ "x86_64-apple-darwin", - "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", ] def _smoke_test_impl(ctx): env = unittest.begin(ctx) for version in TOOL_VERSIONS.keys(): - platforms = TOOL_VERSIONS[version] + platforms = TOOL_VERSIONS[version]["sha256"] for required_platform in required_platforms: asserts.true( env, diff --git a/python/private/versions.bzl b/python/private/versions.bzl index a0ff3fc124..ab0be05140 100644 --- a/python/private/versions.bzl +++ b/python/private/versions.bzl @@ -15,19 +15,15 @@ """The Python versions we use for the toolchains. """ -_RELEASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download/20220227" -_RELEASE_FILENAME_TEMPLATE = "cpython-{python_version}+20220227-{platform}-{build}.tar.gz" +_RELEASE_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download" def get_release_url(platform, python_version): - release_filename = _RELEASE_FILENAME_TEMPLATE.format( + release_filename = TOOL_VERSIONS[python_version]["url"].format( platform = platform, python_version = python_version, build = "static-install_only" if ("windows" in platform) else "install_only", ) - url = "{release_url}/{release_filename}".format( - release_url = _RELEASE_URL, - release_filename = release_filename, - ) + url = "/".join([_RELEASE_BASE_URL, release_filename]) return (release_filename, url) # When updating the versions and releases, run the following command to get @@ -36,22 +32,38 @@ def get_release_url(platform, python_version): # # buildifier: disable=unsorted-dict-items TOOL_VERSIONS = { + "3.8.10": { + "url": "20210506/cpython-{python_version}-{platform}-pgo+lto-20210506T0943.tar.zst", + "sha256": { + "x86_64-apple-darwin": "8d06bec08db8cdd0f64f4f05ee892cf2fcbc58cfb1dd69da2caab78fac420238", + "x86_64-unknown-linux-gnu": "aec8c4c53373b90be7e2131093caa26063be6d9d826f599c935c0e1042af3355", + }, + }, "3.8.12": { - "x86_64-apple-darwin": "f323fbc558035c13a85ce2267d0fad9e89282268ecb810e364fff1d0a079d525", - "x86_64-pc-windows-msvc": "924f9fd51ff6ccc533ed8e96c5461768da5781eb3dfc11d846f9e300fab44eda", - "x86_64-unknown-linux-gnu": "5be9c6d61e238b90dfd94755051c0d3a2d8023ebffdb4b0fa4e8fedd09a6cab6", + "url": "20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz", + "sha256": { + "x86_64-apple-darwin": "f323fbc558035c13a85ce2267d0fad9e89282268ecb810e364fff1d0a079d525", + "x86_64-pc-windows-msvc": "924f9fd51ff6ccc533ed8e96c5461768da5781eb3dfc11d846f9e300fab44eda", + "x86_64-unknown-linux-gnu": "5be9c6d61e238b90dfd94755051c0d3a2d8023ebffdb4b0fa4e8fedd09a6cab6", + }, }, "3.9.10": { - "aarch64-apple-darwin": "ad66c2a3e7263147e046a32694de7b897a46fb0124409d29d3a93ede631c8aee", - "x86_64-apple-darwin": "fdaf594142446029e314a9beb91f1ac75af866320b50b8b968181e592550cd68", - "x86_64-pc-windows-msvc": "5bc65ce023614bf496a6748e41dca934b70fc5fac6dfacc46aa8dbcad772afc2", - "x86_64-unknown-linux-gnu": "455089cc576bd9a58db45e919d1fc867ecdbb0208067dffc845cc9bbf0701b70", + "url": "20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz", + "sha256": { + "aarch64-apple-darwin": "ad66c2a3e7263147e046a32694de7b897a46fb0124409d29d3a93ede631c8aee", + "x86_64-apple-darwin": "fdaf594142446029e314a9beb91f1ac75af866320b50b8b968181e592550cd68", + "x86_64-pc-windows-msvc": "5bc65ce023614bf496a6748e41dca934b70fc5fac6dfacc46aa8dbcad772afc2", + "x86_64-unknown-linux-gnu": "455089cc576bd9a58db45e919d1fc867ecdbb0208067dffc845cc9bbf0701b70", + }, }, "3.10.2": { - "aarch64-apple-darwin": "1409acd9a506e2d1d3b65c1488db4e40d8f19d09a7df099667c87a506f71c0ef", - "x86_64-apple-darwin": "8146ad4390710ec69b316a5649912df0247d35f4a42e2aa9615bffd87b3e235a", - "x86_64-pc-windows-msvc": "a293c5838dd9c8438a84372fb95dda9752df63928a8a2ae516438f187f89567d", - "x86_64-unknown-linux-gnu": "9b64eca2a94f7aff9409ad70bdaa7fbbf8148692662e764401883957943620dd", + "url": "20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz", + "sha256": { + "aarch64-apple-darwin": "1409acd9a506e2d1d3b65c1488db4e40d8f19d09a7df099667c87a506f71c0ef", + "x86_64-apple-darwin": "8146ad4390710ec69b316a5649912df0247d35f4a42e2aa9615bffd87b3e235a", + "x86_64-pc-windows-msvc": "a293c5838dd9c8438a84372fb95dda9752df63928a8a2ae516438f187f89567d", + "x86_64-unknown-linux-gnu": "9b64eca2a94f7aff9409ad70bdaa7fbbf8148692662e764401883957943620dd", + }, }, } @@ -91,5 +103,5 @@ def _commands_for_version(python_version): platform = platform, release_url_sha256 = get_release_url(platform, python_version)[1] + ".sha256", ) - for platform in TOOL_VERSIONS[python_version].keys() + for platform in TOOL_VERSIONS[python_version]["sha256"].keys() ]) diff --git a/python/repositories.bzl b/python/repositories.bzl index 29cdc3c720..1bf0a8ad39 100644 --- a/python/repositories.bzl +++ b/python/repositories.bzl @@ -188,7 +188,7 @@ def python_register_toolchains(name, python_version, **kwargs): python_version = MINOR_MAPPING[python_version] for platform in PLATFORMS.keys(): - sha256 = TOOL_VERSIONS[python_version].get(platform, None) + sha256 = TOOL_VERSIONS[python_version]["sha256"].get(platform, None) if not sha256: continue