Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/private/tests/toolchains/versions_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ load("//python/private:versions.bzl", "MINOR_MAPPING", "TOOL_VERSIONS")

required_platforms = [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, there are windows distros of 3.8.10:

cpython-3.8.10-x86_64-pc-windows-msvc-shared-pgo-20210506T0943.tar.zst
cpython-3.8.10-x86_64-pc-windows-msvc-static-noopt-20210506T0943.tar.zst

but they don't follow the naming convention that darwin and linux use, so we'd have to make the templating even more complex. I think we can just say that windows is not always included in every patch version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this.

"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,
Expand Down
50 changes: 31 additions & 19 deletions python/private/versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
},
},
}

Expand Down Expand Up @@ -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()
])
2 changes: 1 addition & 1 deletion python/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down