Skip to content

Commit

Permalink
Merge pull request #1639 from marticliment/powershell-testing
Browse files Browse the repository at this point in the history
Add Powershell Gallery support
  • Loading branch information
marticliment committed Dec 22, 2023
2 parents d30fae8 + c023e53 commit f50099d
Show file tree
Hide file tree
Showing 9 changed files with 476 additions and 51 deletions.
90 changes: 46 additions & 44 deletions wingetui/Core/Data/Licenses.py
Expand Up @@ -9,53 +9,55 @@
from wingetui.Core.Tools import _

licenses = {
"WingetUI": "LGPL v2.1",
"Python 3": "PSF",
"PySide6": "LGPLv3",
"PyWin32": "PSF",
"Win32mica": "MIT",
"PyInstaller": "GPL 2.0",
"Pythonnet": "MIT",
"Flask": "BSD-3-Clause",
"Flask-Cors": "MIT",
"Waitress": "ZPL 2.1",
"PyYaml": "MIT",
"Windows Toasts": "Apache v2",
"Winget": "MIT",
"Scoop": "MIT",
"Scoop Search": "MIT",
"Chocolatey": "Apache v2",
"Npm": "Artistic License 2.0",
"Pip": "MIT",
"Parse Pip Search": "MIT",
"Dotnet Tool": "Free (Proprietary license)",
"WingetUI": "LGPL v2.1",
"Python 3": "PSF",
"PySide6": "LGPLv3",
"PyWin32": "PSF",
"Win32mica": "MIT",
"PyInstaller": "GPL 2.0",
"Pythonnet": "MIT",
"Flask": "BSD-3-Clause",
"Flask-Cors": "MIT",
"Waitress": "ZPL 2.1",
"PyYaml": "MIT",
"Windows Toasts": "Apache v2",
"Winget": "MIT",
"Scoop": "MIT",
"Scoop Search": "MIT",
"Chocolatey": "Apache v2",
"Npm": "Artistic License 2.0",
"Pip": "MIT",
"Parse Pip Search": "MIT",
"PowerShell Gallery": "Unknown",
"Dotnet Tool": "Free (Proprietary license)",
"dotnet-tools-outdated": "MIT",
"Gsudo": "MIT",
"Icons": "By Icons8"
"Gsudo": "MIT",
"Icons": "By Icons8"
}

licenseUrls = {
"WingetUI": "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html",
"Python 3": "https://docs.python.org/3/license.html#psf-license",
"PySide6": "https://www.tldrlegal.com/license/gnu-lesser-general-public-license-v3-lgpl-3",
"PyWin32": "https://docs.python.org/3/license.html#psf-license",
"Win32mica": "https://github.com/marticliment/win32mica/blob/main/LICENSE",
"PyInstaller": "https://pyinstaller.org/en/stable/license.html",
"Pythonnet": "https://github.com/pythonnet/pythonnet/blob/master/LICENSE",
"Windows Toasts": "https://github.com/DatGuy1/Windows-Toasts/blob/main/LICENSE",
"Winget": "https://github.com/microsoft/winget-cli/blob/master/LICENSE",
"Scoop": "https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE",
"Scoop Search": "https://github.com/shilangyu/scoop-search/blob/master/LICENSE",
"Chocolatey": "https://github.com/chocolatey/choco/blob/develop/LICENSE",
"Npm": "https://github.com/npm/cli/blob/latest/LICENSE",
"Pip": "https://github.com/pypa/pip/blob/main/LICENSE.txt",
"Parse Pip Search": "https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md",
"Dotnet Tool": "https://dotnet.microsoft.com/en-us/platform/free",
"WingetUI": "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html",
"Python 3": "https://docs.python.org/3/license.html#psf-license",
"PySide6": "https://www.tldrlegal.com/license/gnu-lesser-general-public-license-v3-lgpl-3",
"PyWin32": "https://docs.python.org/3/license.html#psf-license",
"Win32mica": "https://github.com/marticliment/win32mica/blob/main/LICENSE",
"PyInstaller": "https://pyinstaller.org/en/stable/license.html",
"Pythonnet": "https://github.com/pythonnet/pythonnet/blob/master/LICENSE",
"Windows Toasts": "https://github.com/DatGuy1/Windows-Toasts/blob/main/LICENSE",
"Winget": "https://github.com/microsoft/winget-cli/blob/master/LICENSE",
"Scoop": "https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE",
"Scoop Search": "https://github.com/shilangyu/scoop-search/blob/master/LICENSE",
"Chocolatey": "https://github.com/chocolatey/choco/blob/develop/LICENSE",
"Npm": "https://github.com/npm/cli/blob/latest/LICENSE",
"Pip": "https://github.com/pypa/pip/blob/main/LICENSE.txt",
"Parse Pip Search": "https://github.com/marticliment/parseable_pip_search/blob/master/LICENSE.md",
"Dotnet Tool": "https://dotnet.microsoft.com/en-us/platform/free",
"dotnet-tools-outdated": "https://github.com/rychlym/dotnet-tools-outdated/blob/master/LICENSE",
"Gsudo": "https://github.com/gerardog/gsudo/blob/master/LICENSE.txt",
"Icons": "https://icons8.com",
"Flask": "https://flask.palletsprojects.com/en/latest/license/",
"Flask-Cors": "https://github.com/corydolphin/flask-cors/blob/main/LICENSE",
"Waitress": "https://github.com/Pylons/waitress/blob/main/LICENSE.txt",
"PyYaml": "https://github.com/yaml/pyyaml/blob/main/LICENSE"
"Gsudo": "https://github.com/gerardog/gsudo/blob/master/LICENSE.txt",
"Icons": "https://icons8.com",
"Flask": "https://flask.palletsprojects.com/en/latest/license/",
"Flask-Cors": "https://github.com/corydolphin/flask-cors/blob/main/LICENSE",
"Waitress": "https://github.com/Pylons/waitress/blob/main/LICENSE.txt",
"PyYaml": "https://github.com/yaml/pyyaml/blob/main/LICENSE",
"PowerShell Gallery": "https://www.powershellgallery.com/",
}
4 changes: 3 additions & 1 deletion wingetui/Interface/SoftwareSections.py
Expand Up @@ -2099,6 +2099,7 @@ def loadPackageCommandLine(self, saveOptionsToDisk: bool = False):
CMD_UPDATE_VARIANT = 'update' if self.isAnUpdate else ('uninstall' if self.isAnUninstall else 'install')
CMD_UPGRADE_VARIANT = 'upgrade' if self.isAnUpdate else ('uninstall' if self.isAnUninstall else 'install')
CMD_PIP_VARIANT = 'install --upgrade' if self.isAnUpdate else ('uninstall' if self.isAnUninstall else 'install')
CMD_PWSH_VARIANT = 'Update-Module' if self.isAnUpdate else ('Uninstall-Module' if self.isAnUninstall else 'Install-Module')

baseCommands = {
Winget: f"winget {CMD_UPDATE_VARIANT} --id {self.currentPackage.Id} --exact",
Expand All @@ -2107,6 +2108,7 @@ def loadPackageCommandLine(self, saveOptionsToDisk: bool = False):
Npm: f"npm {CMD_UPDATE_VARIANT} {self.currentPackage.Id}",
Pip: f"pip {CMD_PIP_VARIANT} {pipId}",
Dotnet: f"dotnet tool {CMD_UPDATE_VARIANT}",
Powershell: f"powershell -Command {CMD_PWSH_VARIANT} -Name {self.currentPackage.Id}",
}

if PackageManager not in baseCommands:
Expand Down Expand Up @@ -2374,7 +2376,7 @@ def loadPackageScreenshots(self, package: Package) -> None:

except Exception as e:
try:
if type(e) is KeyError:
if type(e) is not KeyError:
report(e)
else:
print(f"🟡 Image {iconId} not found in json")
Expand Down
6 changes: 6 additions & 0 deletions wingetui/PackageEngine/Classes.py
Expand Up @@ -74,6 +74,8 @@ def getPackageIconUrl(self) -> str:
iconUrl = f"https://community.chocolatey.org/content/packageimages/{self.Id}.{self.Version}.png"
else:
iconUrl = ""
except KeyError:
print(f"🟡 Icon {iconId} not found in IconDatabase")
except Exception as e:
report(e)
iconUrl = ""
Expand Down Expand Up @@ -292,6 +294,10 @@ def __init__(self, package: Package):
self.Version = package.Version
self.Source = package.Source
self.PackageObject = package
self.Versions = []
self.Architectures = []
self.Scopes = []
self.Tags = []
if type(package) is UpgradablePackage:
self.NewVersion = package.NewVersion

Expand Down
13 changes: 9 additions & 4 deletions wingetui/PackageEngine/Loader.py
Expand Up @@ -13,14 +13,16 @@
from wingetui.PackageEngine.Managers.scoop import Scoop
from wingetui.PackageEngine.Managers.winget import Winget
from wingetui.PackageEngine.Managers.dotnet import Dotnet
from wingetui.PackageEngine.Managers.powershell import Powershell

PackageManagersList: list[PackageManagerModule] = [
Winget,
Scoop,
Choco,
Pip,
Npm,
Dotnet
Dotnet,
Powershell
]

PackagesLoadedDict: dict[PackageManagerModule:bool] = {
Expand All @@ -29,7 +31,8 @@
Choco: False,
Pip: False,
Npm: False,
Dotnet: False
Dotnet: False,
Powershell: False
}

DynaimcPackageManagersList: list[PackageManagerModule] = [
Expand All @@ -38,7 +41,8 @@
Choco,
Winget,
Scoop,
Dotnet
Dotnet,
Powershell
]

DynamicPackagesLoadedDict: dict[PackageManagerModule:bool] = {
Expand All @@ -47,5 +51,6 @@
Winget: False,
Choco: False,
Scoop: False,
Dotnet: False
Dotnet: False,
Powershell: False
}

0 comments on commit f50099d

Please sign in to comment.