fix: bin/update_pythons.py to work properly with PyPy win_amd64 (#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.
This commit is contained in:
Matthieu Darbois
2021-05-26 08:01:07 +02:00
committed by GitHub
parent 61af5e4615
commit 75b707ffb7
+11 -14
View File
@@ -232,7 +232,7 @@ class AllVersions:
def __init__(self) -> None: def __init__(self) -> None:
self.windows_32 = WindowsVersions("32") self.windows_32 = WindowsVersions("32")
self.windows_64 = WindowsVersions("64") self.windows_64 = WindowsVersions("64")
self.windows_pypy = PyPyVersions("32") self.windows_pypy_64 = PyPyVersions("64")
self.macos_cpython = CPythonVersions() self.macos_cpython = CPythonVersions()
self.macos_pypy = PyPyVersions("64") self.macos_pypy = PyPyVersions("64")
@@ -243,27 +243,24 @@ class AllVersions:
spec = Specifier(f"=={version.major}.{version.minor}.*") spec = Specifier(f"=={version.major}.{version.minor}.*")
log.info(f"Reading in '{identifier}' -> {spec} @ {version}") log.info(f"Reading in '{identifier}' -> {spec} @ {version}")
orig_config = copy.copy(config) 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) # We need to use ** in update due to MyPy (probably a bug)
if "macos" in identifier: if "macos" in identifier:
if identifier.startswith("pp"): if identifier.startswith("cp"):
config_update = self.macos_pypy.update_version_macos(spec)
else:
config_update = self.macos_cpython.update_version_macos(identifier, version, spec) config_update = self.macos_cpython.update_version_macos(identifier, version, spec)
elif identifier.startswith("pp"):
assert config_update is not None, f"MacOS {spec} not found!" config_update = self.macos_pypy.update_version_macos(spec)
config.update(**config_update)
elif "win32" in identifier: elif "win32" in identifier:
if identifier.startswith("pp"): if identifier.startswith("cp"):
config.update(**self.windows_pypy.update_version_windows(spec))
else:
config_update = self.windows_32.update_version_windows(spec) config_update = self.windows_32.update_version_windows(spec)
if config_update:
config.update(**config_update)
elif "win_amd64" in identifier: elif "win_amd64" in identifier:
if identifier.startswith("cp"):
config_update = self.windows_64.update_version_windows(spec) config_update = self.windows_64.update_version_windows(spec)
if config_update: 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) config.update(**config_update)
if config != orig_config: if config != orig_config: