From cc7a2843ad9fcdb4ef3d2f894a9fe1c66a03925c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Tue, 13 Jun 2023 14:05:18 +0200 Subject: [PATCH] fix winget incorrect package listing (fix #369) --- wingetui/PackageManagers/winget.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wingetui/PackageManagers/winget.py b/wingetui/PackageManagers/winget.py index 8ddd949d3..b019f916d 100644 --- a/wingetui/PackageManagers/winget.py +++ b/wingetui/PackageManagers/winget.py @@ -100,7 +100,7 @@ def cacheAvailablePackages(self) -> None: line: str = str(p.stdout.readline().strip(), "utf-8", errors="ignore") if line: if not hasShownId: - if "Id" in line: + if " Id " in line: line = line.replace("\x08-\x08\\\x08|\x08 \r","") for char in ("\r", "/", "|", "\\", "-"): line = line.split(char)[-1].strip() @@ -180,7 +180,7 @@ def getPackagesForQuery(self, query: str) -> list[Package]: print(line) if line: if not hasShownId: - if "Id" in line: + if " Id " in line: line = line.replace("\x08-\x08\\\x08|\x08 \r","") for char in ("\r", "/", "|", "\\", "-"): line = line.split(char)[-1].strip() @@ -253,7 +253,7 @@ def getAvailableUpdates(self) -> list[UpgradablePackage]: while p.poll() is None: line: str = str(p.stdout.readline().strip(), "utf-8", errors="ignore") if not hasShownId: - if "Id" in line: + if " Id " in line: line = line.replace("\x08-\x08\\\x08|\x08 \r","") for char in ("\r", "/", "|", "\\", "-"): line = line.split(char)[-1].strip() @@ -372,7 +372,7 @@ def getSource(id: str) -> str: while p.poll() is None: line: str = str(p.stdout.readline().strip(), "utf-8", errors="ignore") if not hasShownId: - if "Id" in line: + if " Id " in line: line = line.replace("\x08-\x08\\\x08|\x08 \r","") for char in ("\r", "/", "|", "\\", "-"): line = line.split(char)[-1].strip() @@ -673,7 +673,7 @@ def getFullPackageId(self, id: str) -> tuple[str, str]: return str(line[idSeparator:], "utf-8", errors="ignore").split(" ")[0].strip() else: l = str(line, encoding='utf-8', errors="ignore").replace("\x08-\x08\\\x08|\x08 \r","").split("\r")[-1] - if("Id" in l): + if(" Id " in l): idSeparator = len(l.split("Id")[0]) print("🟡 Better id not found!") return id