Skip to content

Nuget dependency

nuget_dependency

An ExternalDependency subclass able to download from NuGet.

NugetDependency

An ExternalDependency subclass able to download from NuGet.

Attributes:

Name Type Description
source str

Source of the nuget dependency.

version str

Version of the web dependency.

Tip

The attributes are what must be described in the ext_dep yaml file!

__init__

__init__(descriptor: dict) -> None

Inits a nuget dependency based off the provided descriptor.

GetNugetCmd classmethod

GetNugetCmd() -> list[str]

Appends mono to the command and resolves the full path of the exe for mono.

Used to add nuget support on posix platforms. https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools

Note

Strings returned might not be pathlike given they may be quoted for use on the command line.

Returns:

Type Description
list

["nuget.exe"] or ["mono", "/PATH/TO/nuget.exe"]

None

none was found

normalize_version staticmethod

normalize_version(
    version: str, nuget_name: Optional[str] = ""
) -> str

Normalizes the version as NuGet versioning diverges from Semantic Versioning.

https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#where-nugetversion-diverges-from-semantic-versioning

These cases will be handled befpre a Semantic Version Compatible" set of data is passed to the Semantic Version checker.

__str__

__str__() -> str

Return a string representation.

fetch

fetch() -> None

Fetches the dependency using internal state from the init.

get_temp_dir

get_temp_dir() -> str

Returns the temporary directory the NuGet package is downloaded to.

clean

clean() -> None

Removes the temporary directory the NuGet package is downloaded to.