From 6cc65c76ad73c655abb8e0c213c1724552fde239 Mon Sep 17 00:00:00 2001 From: Joey Vagedes Date: Thu, 22 Aug 2024 12:37:22 -0700 Subject: [PATCH] Initial commit --- .../environment/extdeptypes/nuget_dependency.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/edk2toolext/environment/extdeptypes/nuget_dependency.py b/edk2toolext/environment/extdeptypes/nuget_dependency.py index ba312901..71f6fcaa 100644 --- a/edk2toolext/environment/extdeptypes/nuget_dependency.py +++ b/edk2toolext/environment/extdeptypes/nuget_dependency.py @@ -38,6 +38,7 @@ class NugetDependency(ExternalDependency): def __init__(self, descriptor: dict) -> None: """Inits a nuget dependency based off the provided descriptor.""" super().__init__(descriptor) + self.package = descriptor.get("package", self.name) self.nuget_cache_path = None @classmethod @@ -187,7 +188,7 @@ def _fetch_from_nuget_cache(self, package_name: str) -> bool: try: nuget_version = NugetDependency.normalize_version(self.version) except ValueError: - logging.error(f"NuGet dependency {self.name} has an invalid " + logging.error(f"NuGet dependency {self.package} has an invalid " f"version string: {self.version}") cache_search_path = os.path.join( @@ -210,15 +211,15 @@ def _fetch_from_nuget_cache(self, package_name: str) -> bool: def __str__(self) -> str: """Return a string representation.""" - return f"NugetDependecy: {self.name}@{self.version}" + return f"NugetDependecy: {self.package}@{self.version}" def _attempt_nuget_install(self, install_dir: str, non_interactive: Optional[bool]=True) -> None: # # fetch the contents of the package. # - package_name = self.name + package_name = self.package cmd = NugetDependency.GetNugetCmd() - cmd += ["install", self.name] + cmd += ["install", package_name] cmd += ["-Source", self.source] cmd += ["-ExcludeVersion"] if non_interactive: @@ -260,7 +261,7 @@ def _attempt_nuget_install(self, install_dir: str, non_interactive: Optional[boo def fetch(self) -> None: """Fetches the dependency using internal state from the init.""" - package_name = self.name + package_name = self.package # First, check the global cache to see if it's present. if super().fetch():