Skip to content

Commit

Permalink
fix: update Python update script to process beta versions
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed May 19, 2021
1 parent 53f66d3 commit d07e7ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions bin/update_pythons.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import difflib
import logging
from pathlib import Path
from typing import Any, Union
from typing import Any, Iterable, Union, cast

import click
import requests
Expand Down Expand Up @@ -83,15 +83,15 @@ def __init__(self, arch_str: ArchStr) -> None:
self.versions = sorted(v for v in versions if not v.is_devrelease)

def update_version_windows(self, spec: Specifier) -> ConfigWinCP | None:
versions = sorted(v for v in self.versions if spec.contains(v))
if not all(v.is_prerelease for v in versions):
versions = [v for v in versions if not v.is_prerelease]
unsorted_versions = cast(Iterable[Version], spec.filter(self.versions))
versions = sorted(unsorted_versions, reverse=True)

log.debug(f"Windows {self.arch} {spec} has {', '.join(str(v) for v in versions)}")

if not versions:
return None

version = versions[-1]
version = versions[0]
identifier = f"cp{version.major}{version.minor}-{self.arch}"
return ConfigWinCP(
identifier=identifier,
Expand Down Expand Up @@ -190,21 +190,22 @@ def __init__(self) -> None:
# Removing the prefix, Python 3.9 would use: release["name"].removeprefix("Python ")
version = Version(release["name"][7:])

if not version.is_prerelease and not version.is_devrelease:
uri = int(release["resource_uri"].rstrip("/").split("/")[-1])
self.versions_dict[version] = uri
uri = int(release["resource_uri"].rstrip("/").split("/")[-1])
self.versions_dict[version] = uri

def update_version_macos(
self, identifier: str, version: Version, spec: Specifier
) -> ConfigMacOS | None:
sorted_versions = sorted(v for v in self.versions_dict if spec.contains(v))

unsorted_versions = cast(Iterable[Version], spec.filter(self.versions_dict))
sorted_versions = sorted(unsorted_versions, reverse=True)

if version <= Version("3.8.9999"):
file_ident = "macosx10.9.pkg"
else:
file_ident = "macos11.pkg"

for new_version in reversed(sorted_versions):
for new_version in sorted_versions:
# Find the first patch version that contains the requested file
uri = self.versions_dict[new_version]
response = requests.get(
Expand Down Expand Up @@ -273,7 +274,7 @@ def update_config(self, config: dict[str, str]) -> None:
@click.command()
@click.option("--force", is_flag=True)
@click.option(
"--level", default="INFO", type=click.Choice(["INFO", "DEBUG", "TRACE"], case_sensitive=False)
"--level", default="INFO", type=click.Choice(["WARNING", "INFO", "DEBUG"], case_sensitive=False)
)
def update_pythons(force: bool, level: str) -> None:

Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/resources/build-platforms.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ python_configurations = [
{ identifier = "cp38-win_amd64", version = "3.8.10", arch = "64" },
{ identifier = "cp39-win32", version = "3.9.5", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.5", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.0-b1", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.0-b1", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.0b1", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.0b1", arch = "64" },
{ identifier = "pp37-win32", version = "3.7", arch = "32", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.3-win32.zip" },
]

0 comments on commit d07e7ce

Please sign in to comment.