swh.loader.package.conda.loader module#
- class swh.loader.package.conda.loader.CondaPackageInfo(url: str, name: str, filename: str, version: str, release_version: str, last_modified: datetime | None, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#
Bases:
BasePackageInfo
Method generated by attrs for class CondaPackageInfo.
- name#
Name of the package
- filename#
Archive (tar.gz) file name
- version#
‘linux-64/0.1.1-py37’
- Type:
Complete version and distribution name used as branch name. Ex
- release_version#
‘0.1.1-py37-linux-64’
- Type:
Version number used as release name. Ex
- swh.loader.package.conda.loader.extract_intrinsic_metadata(dir_path: Path) Dict[str, Any] [source]#
Extract intrinsic metadata from file at dir_path.
Each Conda package version may have an info/about.json file in the archive. If missing we try to get metadata from info/recipe/meta.yaml
See https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html?highlight=meta.yaml#info-about-json # noqa: B950 for package specifications.
- Parameters:
dir_path – A directory on disk where a metadata file can be found
- Returns:
A dict mapping from yaml parser
- class swh.loader.package.conda.loader.CondaLoader(storage: StorageInterface, url: str, artifacts: List[Dict[str, Any]], **kwargs)[source]#
Bases:
PackageLoader
[CondaPackageInfo
]- Loader’s constructor. This raises exception if the minimal required
configuration is missing (cf. fn:check method).
- Parameters:
storage – Storage instance
url – Origin url to load data from
- get_versions() Sequence[str] [source]#
Get all released versions of a Conda package
- Returns:
A sequence of versions
Example:
["0.1.1", "0.10.2"]
- get_default_version() str [source]#
Get the newest release version of a Conda package
- Returns:
A string representing a version
Example:
"0.10.2"
- get_package_info(version: str) Iterator[Tuple[str, CondaPackageInfo]] [source]#
Get release name and package information from version
- Parameters:
version – Package version (e.g: “0.1.0”)
- Returns:
Iterator of tuple (release_name, p_info)
- build_release(p_info: CondaPackageInfo, uncompressed_path: str, directory: bytes) Release | None [source]#
Build the release from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.
- Parameters:
p_info – Package information
uncompressed_path – Artifact uncompressed path on disk