Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bin/update_pythons.py to work properly with PyPy win_amd64 #695

Merged
merged 2 commits into from
May 26, 2021
Merged
Changes from 1 commit
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
11 changes: 7 additions & 4 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 = PyPyVersions("64")

self.macos_cpython = CPythonVersions()
self.macos_pypy = PyPyVersions("64")
Expand Down Expand Up @@ -262,9 +262,12 @@ def update_config(self, config: dict[str, str]) -> None:
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("pp"):
config.update(**self.windows_pypy.update_version_windows(spec))
else:
config_update = self.windows_64.update_version_windows(spec)
if config_update:
config.update(**config_update)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if identifier.startswith("pp"):
config.update(**self.windows_pypy.update_version_windows(spec))
else:
config_update = self.windows_64.update_version_windows(spec)
if config_update:
config.update(**config_update)
config_update: ConfigWinCP | ConfigWinPP | None
if identifier.startswith("pp"):
config_update = self.windows_pypy.update_version_windows(spec)
else:
config_update = self.windows_64.update_version_windows(spec)
if config_update:
config.update(**config_update)

Not sure this is any better, though.

Copy link
Contributor

@henryiii henryiii May 25, 2021

Choose a reason for hiding this comment

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

Suggested change
if identifier.startswith("pp"):
config.update(**self.windows_pypy.update_version_windows(spec))
else:
config_update = self.windows_64.update_version_windows(spec)
if config_update:
config.update(**config_update)
config_update = (
self.windows_pypy.update_version_windows(spec)
if identifier.startswith("pp")
else self.windows_64.update_version_windows(spec)
)
if config_update:
config.update(**config_update)

Assuming this passes MyPy, maybe it's better?

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, the current form looks just like the win32 version above, so it's also fine (and if changed, the one above should follow too).

Copy link
Member Author

Choose a reason for hiding this comment

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

I reworked this a bit. Just fail if config_update is None as was done on macOS, it shall never happen.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, sounds good.


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