swh.loader.package.cran.loader module¶
-
class
swh.loader.package.cran.loader.
CRANPackageInfo
(url: str, filename: Optional[str], raw_info: Dict[str, Any], version: str, *, directory_extrinsic_metadata: List[swh.loader.package.loader.RawExtrinsicMetadataCore] = [])[source]¶ Bases:
swh.loader.package.loader.BasePackageInfo
-
ID_KEYS
= ['url', 'version']¶
-
classmethod
from_metadata
(a_metadata: Dict[str, Any]) → swh.loader.package.cran.loader.CRANPackageInfo[source]¶
-
-
class
swh.loader.package.cran.loader.
CRANLoader
(url: str, artifacts: List[Dict])[source]¶ Bases:
swh.loader.package.loader.PackageLoader
[swh.loader.package.cran.loader.CRANPackageInfo
]-
visit_type
= 'cran'¶
-
get_versions
() → List[str][source]¶ Return the list of all published package versions.
- Returns
Sequence of published versions
-
get_default_version
() → str[source]¶ Retrieve the latest release version if any.
- Returns
Latest version
-
get_package_info
(version: str) → Iterator[Tuple[str, swh.loader.package.cran.loader.CRANPackageInfo]][source]¶ - Given a release version of a package, retrieve the associated
package information for such version.
- Parameters
version – Package version
- Returns
(branch name, package metadata)
-
resolve_revision_from
(known_artifacts: Mapping[bytes, Mapping], p_info: swh.loader.package.cran.loader.CRANPackageInfo) → Optional[bytes][source]¶ Given known_artifacts per revision, try to determine the revision for artifact_metadata
-
build_revision
(p_info: swh.loader.package.cran.loader.CRANPackageInfo, uncompressed_path: str, directory: bytes) → Optional[swh.model.model.Revision][source]¶ Build the revision from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.
- Parameters
p_info – Package information
uncompressed_path – Artifact uncompressed path on disk
- Returns
Revision object
-
-
swh.loader.package.cran.loader.
parse_debian_control
(filepath: str) → Dict[str, Any][source]¶ Parse debian control at filepath
-
swh.loader.package.cran.loader.
extract_intrinsic_metadata
(dir_path: str) → Dict[str, Any][source]¶ - Given an uncompressed path holding the DESCRIPTION file, returns a
DESCRIPTION parsed structure as a dict.
Cran origins describes their intrinsic metadata within a DESCRIPTION file at the root tree of a tarball. This DESCRIPTION uses a simple file format called DCF, the Debian control format.
The release artifact contains at their root one folder. For example: $ tar tvf zprint-0.0.6.tar.gz drwxr-xr-x root/root 0 2018-08-22 11:01 zprint-0.0.6/ …
- Parameters
dir_path (str) – Path to the uncompressed directory representing a release artifact from pypi.
- Returns
the DESCRIPTION parsed structure as a dict (or empty dict if missing)
-
swh.loader.package.cran.loader.
parse_date
(date: Optional[str]) → Optional[swh.model.model.TimestampWithTimezone][source]¶ Parse a date into a datetime