Skip to content

Commit

Permalink
fix: bin/update_pythons.py to work properly with PyPy win_amd64 (#…
Browse files Browse the repository at this point in the history
…695)

* fix: `bin/update_pythons.py` to work properly with PyPy `win_amd64`
* refactor: use the same pattern for all python updates
* follow up to #671, for the record.
  • Loading branch information
mayeut authored May 26, 2021
1 parent 61af5e4 commit 75b707f
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions bin/update_pythons.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class AllVersions:
def __init__(self) -> None:
self.windows_32 = WindowsVersions("32")
self.windows_64 = WindowsVersions("64")
self.windows_pypy = PyPyVersions("32")
self.windows_pypy_64 = PyPyVersions("64")

self.macos_cpython = CPythonVersions()
self.macos_pypy = PyPyVersions("64")
Expand All @@ -243,28 +243,25 @@ def update_config(self, config: dict[str, str]) -> None:
spec = Specifier(f"=={version.major}.{version.minor}.*")
log.info(f"Reading in '{identifier}' -> {spec} @ {version}")
orig_config = copy.copy(config)
config_update: AnyConfig | None
config_update: AnyConfig | None = None

# We need to use ** in update due to MyPy (probably a bug)
if "macos" in identifier:
if identifier.startswith("pp"):
config_update = self.macos_pypy.update_version_macos(spec)
else:
if identifier.startswith("cp"):
config_update = self.macos_cpython.update_version_macos(identifier, version, spec)

assert config_update is not None, f"MacOS {spec} not found!"
config.update(**config_update)
elif identifier.startswith("pp"):
config_update = self.macos_pypy.update_version_macos(spec)
elif "win32" in identifier:
if identifier.startswith("pp"):
config.update(**self.windows_pypy.update_version_windows(spec))
else:
if identifier.startswith("cp"):
config_update = self.windows_32.update_version_windows(spec)
if config_update:
config.update(**config_update)
elif "win_amd64" in identifier:
config_update = self.windows_64.update_version_windows(spec)
if config_update:
config.update(**config_update)
if identifier.startswith("cp"):
config_update = self.windows_64.update_version_windows(spec)
elif identifier.startswith("pp"):
config_update = self.windows_pypy_64.update_version_windows(spec)

assert config_update is not None, f"{identifier} not found!"
config.update(**config_update)

if config != orig_config:
log.info(f" Updated {orig_config} to {config}")
Expand Down

0 comments on commit 75b707f

Please sign in to comment.