def get_package_info(
         self, version: str) -> Iterator[Tuple[str, DebianPackageInfo]]:
     meta = self.packages[version]
     p_info = DebianPackageInfo.from_metadata(meta,
                                              url=self.origin.url,
                                              version=version)
     yield release_name(version), p_info
    def get_package_info(
            self, version: str) -> Iterator[Tuple[str, PyPIPackageInfo]]:
        res = []
        for meta in self.info()["releases"][version]:
            # process only standard sdist archives
            if meta["packagetype"] != "sdist" or meta["filename"].lower(
            ).endswith((".deb", ".egg", ".rpm", ".whl")):
                continue

            p_info = PyPIPackageInfo.from_metadata(
                meta, name=self.info()["info"]["name"], version=version)
            res.append((version, p_info))

        if len(res) == 1:
            version, p_info = res[0]
            yield release_name(version), p_info
        else:
            for version, p_info in res:
                yield release_name(version, p_info.filename), p_info
Beispiel #3
0
    def get_package_info(
            self, version: str) -> Iterator[Tuple[str, ArchPackageInfo]]:
        """Get release name and package information from version

        Args:
            version: arch version (e.g: "0.1.0")

        Returns:
            Iterator of tuple (release_name, p_info)
        """
        artifact = self.artifacts[version]
        assert version == artifact["version"]

        p_info = ArchPackageInfo(
            name=artifact["name"],
            filename=artifact["filename"],
            url=artifact["url"],
            version=version,
            last_modified=artifact["last_modified"],
        )
        yield release_name(version, artifact["filename"]), p_info
    def get_package_info(
            self, version: str) -> Iterator[Tuple[str, CratesPackageInfo]]:
        """Get release name and package information from version

        Args:
            version: crate version (e.g: "0.1.0")

        Returns:
            Iterator of tuple (release_name, p_info)
        """
        artifact = self.artifacts[version]
        filename = artifact["filename"]
        package_name = urlparse(self.url).path.split("/")[-1]
        url = artifact["url"]

        # Get extrinsic metadata from http api
        e_metadata = ExtrinsicPackageMetadata(
            **self.info())  # type: ignore[misc]

        # Extract crate info for current version (One .crate file for a given version)
        (crate_version, ) = [
            crate for crate in e_metadata["versions"]
            if crate["num"] == version
        ]
        e_metadata_version = ExtrinsicVersionPackageMetadata(  # type: ignore[misc]
            **crate_version)

        p_info = CratesPackageInfo(
            name=package_name,
            filename=filename,
            url=url,
            version=version,
            e_metadata=e_metadata,
            e_metadata_version=e_metadata_version,
        )
        yield release_name(version, filename), p_info
def test_release_name():
    for version, filename, expected_release in [
        ("0.0.1", None, "releases/0.0.1"),
        ("0.0.2", "something", "releases/0.0.2/something"),
    ]:
        assert release_name(version, filename) == expected_release
Beispiel #6
0
 def get_package_info(
         self, version: str) -> Iterator[Tuple[str, CRANPackageInfo]]:
     for a_metadata in self.artifacts:
         p_info = CRANPackageInfo.from_metadata(a_metadata)
         if version == p_info.version:
             yield release_name(version), p_info
 def get_package_info(self,
                      version: str) -> Iterator[Tuple[str, NpmPackageInfo]]:
     p_info = NpmPackageInfo.from_metadata(project_metadata=self.info(),
                                           version=version)
     yield release_name(version), p_info
Beispiel #8
0
 def get_package_info(
         self, version: str) -> Iterator[Tuple[str, MavenPackageInfo]]:
     a_metadata = self.version_artifact[version]
     rel_name = release_name(a_metadata["version"])
     yield rel_name, MavenPackageInfo.from_metadata(a_metadata)