def extract_egg(egg, extract_dir): # Given a bento-produced egg, extract its content in the given directory, # and returned the corresponding build_manifest info instance build_manifest = BuildManifest.from_egg(egg) # egg scheme build_manifest.update_paths({ "prefix": ".", "eprefix": ".", "sitedir": "." }) zid = zipfile.ZipFile(egg) try: for type, sections in build_manifest.files.items(): for name, section in sections.items(): target_dir = build_manifest.resolve_path(section.target_dir) section.source_dir = os.path.join(extract_dir, target_dir) for source, target in section.files: g = os.path.join(target_dir, target) g = os.path.normpath(g) zid.extract(g, extract_dir) finally: zid.close() return build_manifest
def extract_egg(egg, extract_dir): # Given a bento-produced egg, extract its content in the given directory, # and returned the corresponding build_manifest info instance build_manifest = BuildManifest.from_egg(egg) # egg scheme build_manifest.update_paths({"prefix": ".", "eprefix": ".", "sitedir": "."}) zid = zipfile.ZipFile(egg) try: for type, sections in build_manifest.files.items(): for name, section in sections.items(): target_dir = build_manifest.resolve_path(section.target_dir) section.source_dir = os.path.join(extract_dir, target_dir) for source, target in section.files: g = os.path.join(target_dir, target) g = os.path.normpath(g) zid.extract(g, extract_dir) finally: zid.close() return build_manifest