Skip to content

Commit

Permalink
fix winget incorrect package listing (fix #369)
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed Jun 13, 2023
1 parent 1fd6894 commit cc7a284
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wingetui/PackageManagers/winget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cc7a284

Please sign in to comment.