1414from subprocess import check_call
1515
1616from auditwheel .patcher import ElfPatcher
17+ from auditwheel .pool import POOL
1718
1819from .elfutils import elf_read_dt_needed , elf_read_rpaths , is_subdir
1920from .hashfile import hashfile
@@ -82,9 +83,14 @@ def repair_wheel(
8283
8384 if not dest_dir .exists ():
8485 dest_dir .mkdir ()
85- new_soname , new_path = copylib (src_path , dest_dir , patcher )
86+ new_soname , new_path = copylib (src_path , dest_dir , patcher , dry = True )
87+ if new_path not in POOL :
88+ POOL .submit (new_path , copylib , src_path , dest_dir , patcher )
8689 soname_map [soname ] = (new_soname , new_path )
8790 replacements .append ((soname , new_soname ))
91+
92+ POOL .wait ()
93+
8894 if replacements :
8995 patcher .replace_needed (fn , * replacements )
9096
@@ -127,7 +133,9 @@ def strip_symbols(libraries: Iterable[Path]) -> None:
127133 check_call (["strip" , "-s" , lib ])
128134
129135
130- def copylib (src_path : Path , dest_dir : Path , patcher : ElfPatcher ) -> tuple [str , Path ]:
136+ def copylib (
137+ src_path : Path , dest_dir : Path , patcher : ElfPatcher , dry : bool = False
138+ ) -> tuple [str , Path ]:
131139 """Graft a shared library from the system into the wheel and update the
132140 relevant links.
133141
@@ -151,7 +159,7 @@ def copylib(src_path: Path, dest_dir: Path, patcher: ElfPatcher) -> tuple[str, P
151159 new_soname = src_name
152160
153161 dest_path = dest_dir / new_soname
154- if dest_path .exists ():
162+ if dry or dest_path .exists ():
155163 return new_soname , dest_path
156164
157165 logger .debug ("Grafting: %s -> %s" , src_path , dest_path )
0 commit comments