(importer, path_item, only=False)
Find eggs in zip files; possibly multiple nested eggs.
Find eggs in zip files; possibly multiple nested eggs.
Find eggs in zip files ; possibly multiple nested eggs .
def find_eggs_in_zip(importer, path_item, only=False):
    """
    Find eggs in zip files; possibly multiple nested eggs.
    """
    if importer.archive.endswith('.whl'):
        # wheels are not supported with this finder
        # they don't have PKG-INFO metadata, and won't ever contain eggs
        return
    metadata = EggMetadata(importer)
    if metadata.has_metadata('PKG-INFO'):
        yield Distribution.from_filename(path_item, metadata=metadata)
    if only:
        # don't yield nested distros
        return
    for subitem in metadata.resource_listdir(''):
        if _is_egg_path(subitem):
            subpath = os.path.join(path_item, subitem)
            dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
            for dist in dists:
                yield dist
        elif subitem.lower().endswith('.dist-info'):
            subpath = os.path.join(path_item, subitem)
            submeta = EggMetadata(zipimport.zipimporter(subpath))
            submeta.egg_info = subpath
            yield Distribution.from_location(path_item, subitem, submeta)
def find_eggs_in_zip ( importer , path_item , only = False ) : if importer . archive . endswith ( '.whl' ) : # wheels are not supported with this finder # they don't have PKG-INFO metadata, and won't ever contain eggs return metadata = EggMetadata ( importer ) if metadata . has_metadata ( 'PKG-INFO' ) : yield Distribution . from_filename ( path_item , metadata = metadata ) if only : # don't yield nested distros return for subitem in metadata . resource_listdir ( '' ) : if _is_egg_path ( subitem ) : subpath = os . path . join ( path_item , subitem ) dists = find_eggs_in_zip ( zipimport . zipimporter ( subpath ) , subpath ) for dist in dists : yield dist elif subitem . lower ( ) . endswith ( '.dist-info' ) : subpath = os . path . join ( path_item , subitem ) submeta = EggMetadata ( zipimport . zipimporter ( subpath ) ) submeta . egg_info = subpath yield Distribution . from_location ( path_item , subitem , submeta )