14
14
from subprocess import check_call
15
15
16
16
from auditwheel .patcher import ElfPatcher
17
+ from auditwheel .pool import POOL
17
18
18
19
from .elfutils import elf_read_dt_needed , elf_read_rpaths , is_subdir
19
20
from .hashfile import hashfile
@@ -82,9 +83,14 @@ def repair_wheel(
82
83
83
84
if not dest_dir .exists ():
84
85
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 )
86
89
soname_map [soname ] = (new_soname , new_path )
87
90
replacements .append ((soname , new_soname ))
91
+
92
+ POOL .wait ()
93
+
88
94
if replacements :
89
95
patcher .replace_needed (fn , * replacements )
90
96
@@ -127,7 +133,9 @@ def strip_symbols(libraries: Iterable[Path]) -> None:
127
133
check_call (["strip" , "-s" , lib ])
128
134
129
135
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 ]:
131
139
"""Graft a shared library from the system into the wheel and update the
132
140
relevant links.
133
141
@@ -151,7 +159,7 @@ def copylib(src_path: Path, dest_dir: Path, patcher: ElfPatcher) -> tuple[str, P
151
159
new_soname = src_name
152
160
153
161
dest_path = dest_dir / new_soname
154
- if dest_path .exists ():
162
+ if dry or dest_path .exists ():
155
163
return new_soname , dest_path
156
164
157
165
logger .debug ("Grafting: %s -> %s" , src_path , dest_path )
0 commit comments