swh.loader.package.hackage.loader module#
- class swh.loader.package.hackage.loader.HackagePackageInfo(url: str, filename: str | None, name: str, version: str, last_modified: str, author: Person, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#
Bases:
BasePackageInfo
Method generated by attrs for class HackagePackageInfo.
- name#
Name of the package
- version#
Current version
- last_modified#
File last modified date as release date
- author#
Author
- swh.loader.package.hackage.loader.extract_intrinsic_metadata(dir_path: Path, pkgname: str) Dict[str, Any] [source]#
Extract intrinsic metadata from {pkgname}.cabal file at dir_path.
Each Haskell package version has a {pkgname}.cabal file at the root of the archive.
See https://cabal.readthedocs.io/en/3.4/cabal-package.html#package-properties for package properties specifications.
- Parameters:
dir_path – A directory on disk where a {pkgname}.cabal must be present
- Returns:
A dict mapping with ‘name’, ‘version’ and ‘author’
- class swh.loader.package.hackage.loader.HackageLoader(storage: StorageInterface, url: str, **kwargs)[source]#
Bases:
PackageLoader
[HackagePackageInfo
]- 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
- info_versions() Dict [source]#
Return the package versions (fetched from https://hackage.haskell.org/package/{pkgname})
Api documentation https://hackage.haskell.org/api
- info_revisions(url) Dict [source]#
Return the package version revisions (fetched from https://hackage.haskell.org/package/{pkgname}-{version}/revisions/)
Api documentation https://hackage.haskell.org/api
- get_versions() Sequence[str] [source]#
Get all released versions of an Haskell package
- Returns:
A sequence of versions
Example:
["0.1.1", "0.10.2"]
- get_default_version() str [source]#
Get the newest release version of an Haskell package
- Returns:
A string representing a version
Example:
"0.10.2"
- get_package_info(version: str) Iterator[Tuple[str, HackagePackageInfo]] [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: HackagePackageInfo, 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