def from_bdist(cls, path): # type: (Path) -> PackageInfo """ Gather package information from a bdist (wheel etc.). :param path: Path to bdist. """ if isinstance(path, (pkginfo.BDist, pkginfo.Wheel)): cls._from_distribution(dist=path) if path.suffix == ".whl": return cls.from_wheel(path=path) try: return cls._from_distribution(pkginfo.BDist(str(path))) except ValueError: raise PackageInfoError(path)
def get_pkginfo(f): fp, ext = os.path.splitext(f) #print(f) try: if ext == '.whl': return pkg.Wheel(f) elif ext == '.gz': return pkg.SDist(f) elif ext == '.zip': return pkg.SDist(f) elif ext == '.egg': return pkg.BDist(f) elif ext == '.bz2': return pkg.SDist(f) elif ext == '.tgz': return pkg.SDist(f) except ReadError: return None except ValueError: return None else: return None
def dist1_metadata(packages): egg = packages.get_egg('dist1') return pkginfo.BDist(str(egg))