Last active
May 16, 2021 15:01
-
-
Save shuki25/ab5fb3fd10d1efe4dad80528c0e6e621 to your computer and use it in GitHub Desktop.
Elite Dangerous Semantic Versioning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from semantic_version import Version | |
class EDVersion(Version): | |
def __init__(self, version_string=None, **kwargs): | |
self.version_xref = { | |
"April Update EDH": "3.4.0", | |
"April Update Patch 1 EDH": "3.4.1", | |
"April Update Patch 2 EDH": "3.4.2", | |
"January Update": "3.6.0", | |
"January Update - Patch 1": "3.6.1", | |
"January Update - Patch 2": "3.6.2", | |
"Fleet Carriers Update": "3.7.0", | |
"Fleet Carriers Update - Patch 1": "3.7.1", | |
"Fleet Carriers Update - Patch 2": "3.7.2", | |
"Fleet Carriers Update - Patch 3": "3.7.3", | |
"Fleet Carriers Update - Patch 4": "3.7.4", | |
"Fleet Carriers Update - Patch 5": "3.7.5", | |
"Fleet Carriers Update - Patch 6": "3.7.6", | |
"Fleet Carriers Update - Patch 7": "3.7.7", | |
"Fleet Carriers Update - Patch 8": "3.7.8", | |
"Fleet Carriers Update - Patch 9": "3.7.9", | |
"Fleet Carriers Update - Patch 10": "3.7.10", | |
"Fleet Carriers Update - Patch 11": "3.7.11", | |
"Fleet Carriers Update - Patch 12": "3.7.12", | |
} | |
if version_string: | |
v = version_string.split(".", 3) | |
if v[0].isdigit(): | |
for i in range(4 - len(v)): | |
v.append("0") | |
version_string = ".".join(v[0:3]) | |
else: | |
if version_string in self.version_xref: | |
version_string = self.version_xref[version] | |
else: | |
version_string = "0.0.0" | |
super().__init__(version_string=version_string) | |
else: | |
super().__init__(**kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment