Skip to content

Commit

Permalink
Fix extraction of macOS version without build number
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Sep 18, 2024
1 parent 308ec75 commit cbedb9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
> This version is not released yet and is under active development.
- Fix conflicting detection heuristics for Linux distributions. Closes #72.
- Fix fetching of macOS version for releases without build number (like `15.0`).

## [1.3.0 (2024-09-11)](https://github.com/kdeldycke/extra-platforms/compare/v1.2.1...v1.3.0)

Expand Down
24 changes: 15 additions & 9 deletions extra_platforms/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,34 @@ def info(self) -> dict[str, str | bool | None | dict[str, str | None]]:
# Add extra macOS infos.
if self.id == "macos":
release, _versioninfo, _machine = platform.mac_ver()
major, minor, build_number = release.split(".", 2)
parts = dict(
zip(("major", "minor", "build_number"), release.split(".", 2))
)
mac_info = {
"version": release,
"version_parts": {
"major": major,
"minor": minor,
"build_number": build_number,
"major": parts.get("major"),
"minor": parts.get("minor"),
"build_number": parts.get("build_number"),
},
"codename": _get_macos_codename(major, minor),
"codename": _get_macos_codename(
parts.get("major"), parts.get("minor")
),
}
info = _recursive_update(info, mac_info, strict=True)

# Add extra Windows infos.
elif self.id == "windows":
release, version, _csd, _ptype = platform.win32_ver()
major, minor, build_number = version.split(".", 2)
parts = dict(
zip(("major", "minor", "build_number"), version.split(".", 2))
)
win_info = {
"version": release,
"version_parts": {
"major": major,
"minor": minor,
"build_number": build_number,
"major": parts.get("major"),
"minor": parts.get("minor"),
"build_number": parts.get("build_number"),
},
"codename": " ".join((release, platform.win32_edition())),
}
Expand Down

0 comments on commit cbedb9e

Please sign in to comment.