version does have types, false alarm

This commit is contained in:
PartyWumpus
2024-05-05 08:52:23 +01:00
parent 14ea7b964f
commit 10e13571e5
2 changed files with 6 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ from aiohttp import ClientSession
from .localplatform import localplatform
from .enums import UserType
from logging import getLogger
from packaging.version import Version # type: ignore
from packaging.version import Version
REMOTE_DEBUGGER_UNIT = "steam-web-debug-portforward.service"
@@ -63,19 +63,18 @@ def mkdir_as_user(path: str):
localplatform.chown(path)
# Fetches the version of loader
# TODO THIS IS ABSOLUTELY TERRIBLE AND NEVER SHOULDVE BEEN MERGED! packaging HAS NO TYPES AND WE COULD LITERALLY JUST USE A REGEX!!!!! REWRITE THIS!!!!!!!!!!!!!
def get_loader_version() -> str:
try:
# Normalize Python-style version to conform to Decky style
v = Version(importlib.metadata.version("decky_loader")) # type: ignore
v = Version(importlib.metadata.version("decky_loader"))
version_str = f'v{v.major}.{v.minor}.{v.micro}' # type: ignore
version_str = f'v{v.major}.{v.minor}.{v.micro}'
if v.pre: # type: ignore
version_str += f'-pre{v.pre[1]}' # type: ignore
version_str += f'-pre{v.pre[1]}'
if v.post: # type: ignore
version_str += f'-dev{v.post}' # type: ignore
version_str += f'-dev{v.post}'
return version_str
except Exception as e:

View File

@@ -9,7 +9,7 @@ a = Analysis(
('locales', 'locales'),
('static', 'static'),
] + copy_metadata('decky_loader'),
hiddenimports=['logging.handlers', 'sqlite3', 'decky_plugin' 'decky'],
hiddenimports=['logging.handlers', 'sqlite3', 'decky_plugin', 'decky'],
)
pyz = PYZ(a.pure, a.zipped_data)