def unpack(wheel_path, dest_directory): # TODO(): don't use unsupported wheel library with wheelfile.WheelFile(wheel_path) as wheel_file: distribution_name = wheel_file.parsed_filename.group("name") library_name = util.normalize_distribution_name(distribution_name) package_directory = os.path.join(dest_directory, library_name) wheel_file.extractall(package_directory) try: return next(pkg_resources.find_distributions(package_directory)) except StopIteration: raise DistributionNotFoundError(package_directory)
def base_package_name(self): return util.normalize_distribution_name(self.distribution.project_name)
def from_distribution_requirement(cls, requirement): return cls(util.normalize_distribution_name(requirement.project_name))