예제 #1
0
파일: info.py 프로젝트: yahkun/poetry
    def _from_distribution(
        cls, dist
    ):  # type: (Union[pkginfo.BDist, pkginfo.SDist, pkginfo.Wheel]) -> PackageInfo
        """
        Helper method to parse package information from a `pkginfo.Distribution` instance.

        :param dist: The distribution instance to parse information from.
        """
        requirements = None

        if dist.requires_dist:
            requirements = list(dist.requires_dist)
        else:
            requires = Path(dist.filename) / "requires.txt"
            if requires.exists():
                with requires.open(encoding="utf-8") as f:
                    requirements = parse_requires(f.read())

        info = cls(
            name=dist.name,
            version=dist.version,
            summary=dist.summary,
            platform=dist.supported_platforms,
            requires_dist=requirements,
            requires_python=dist.requires_python,
        )

        info._source_type = "file"
        info._source_url = Path(dist.filename).resolve().as_posix()

        return info
예제 #2
0
def test_build_wheel_extended():
    with temporary_directory() as tmp_dir, cwd(
            os.path.join(fixtures, "extended")):
        filename = api.build_wheel(tmp_dir)
        whl = Path(tmp_dir) / filename
        assert whl.exists()
        validate_wheel_contents(name="extended",
                                version="0.1",
                                path=whl.as_posix())
예제 #3
0
파일: test_api.py 프로젝트: tomgrin10/core
def test_build_wheel_extended():
    with temporary_directory() as tmp_dir, cwd(
            os.path.join(fixtures, "extended")):
        filename = api.build_wheel(tmp_dir)

        whl = Path(tmp_dir) / filename
        assert whl.exists()

        with zipfile.ZipFile(str(os.path.join(tmp_dir, filename))) as zip:
            namelist = zip.namelist()

            assert "extended-0.1.dist-info/RECORD" in namelist
            assert "extended-0.1.dist-info/WHEEL" in namelist
            assert "extended-0.1.dist-info/METADATA" in namelist