Skip to content

Commit 6dc3ca7

Browse files
committed
convert: Fix semantic version comparison.
1 parent 996c77d commit 6dc3ca7

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

openage/game/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015-2024 the openage authors. See copying.md for legal info.
1+
# Copyright 2015-2025 the openage authors. See copying.md for legal info.
22
#
33
# pylint: disable=too-many-locals
44

@@ -93,6 +93,7 @@ def main(args, error):
9393
# ensure that the openage API is present
9494
if api_export_required(asset_path):
9595
# export to assets folder
96+
info("Updating outdated nyan API modpack")
9697
converted_path = asset_path / "converted"
9798
converted_path.mkdirs()
9899
export_api(converted_path)

openage/main/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015-2024 the openage authors. See copying.md for legal info.
1+
# Copyright 2015-2025 the openage authors. See copying.md for legal info.
22

33
"""
44
Main engine entry point for openage.
@@ -88,6 +88,7 @@ def main(args, error):
8888
# ensure that the openage API is present
8989
if api_export_required(asset_path):
9090
# export to assets folder
91+
info("Updating outdated nyan API modpack")
9192
converted_path = asset_path / "converted"
9293
converted_path.mkdirs()
9394
export_api(converted_path)

openage/util/version.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024-2024 the openage authors. See copying.md for legal info.
1+
# Copyright 2024-2025 the openage authors. See copying.md for legal info.
22

33
"""
44
Handling of version information for openage.
@@ -36,26 +36,30 @@ def __init__(self, version: str) -> None:
3636
self.buildmetadata = match.group("buildmetadata")
3737

3838
def __lt__(self, other: SemanticVersion) -> bool:
39-
if self.major < other.major:
40-
return True
41-
if self.minor < other.minor:
42-
return True
43-
if self.patch < other.patch:
44-
return True
39+
if self.major != other.major:
40+
return self.major < other.major
4541

42+
if self.minor != other.minor:
43+
return self.minor < other.minor
44+
45+
if self.patch != other.patch:
46+
return self.patch < other.patch
47+
48+
# else: versions are equal
4649
return False
4750

4851
def __le__(self, other: SemanticVersion) -> bool:
49-
if self.major <= other.major:
50-
return True
52+
if self.major != other.major:
53+
return self.major < other.major
5154

52-
if self.minor <= other.minor:
53-
return True
55+
if self.minor != other.minor:
56+
return self.minor < other.minor
5457

55-
if self.patch <= other.patch:
56-
return True
58+
if self.patch != other.patch:
59+
return self.patch < other.patch
5760

58-
return False
61+
# else: versions are equal
62+
return True
5963

6064
def __eq__(self, other: SemanticVersion) -> bool:
6165
return (self.major == other.major and

0 commit comments

Comments
 (0)