Skip to content

Commit f58dd41

Browse files
committed
feature: allow specifying additional library paths (fixes: #373)
Add new --add-path option to auditwheel repair to search for libraries in additional directories. This avoid having to manipulate LD_LIBRARY_PATH in the calling process (e.g. cibuildwheel), as this can have undesirable side-effects. The name of the option is chosen to match the one provided by `delvewheel` on Windows.
1 parent f3c7691 commit f58dd41

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/auditwheel/main_repair.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import logging
3+
import os
34
from os.path import abspath, basename, exists, isfile
45

56
from auditwheel.patcher import Patchelf
@@ -92,6 +93,12 @@ def configure_parser(sub_parsers):
9293
help="Do not check for higher policy compatibility",
9394
default=False,
9495
)
96+
p.add_argument(
97+
"--add-path",
98+
dest="PATHS",
99+
default="",
100+
help=f"Additional path(s) to search for libraries, {os.pathsep!r}-delimited"
101+
)
95102
p.set_defaults(func=execute)
96103

97104

@@ -106,6 +113,12 @@ def execute(args, p):
106113

107114
logger.info("Repairing %s", basename(args.WHEEL_FILE))
108115

116+
if args.PATHS:
117+
library_path = args.PATHS
118+
if "LD_LIBRARY_PATH" in os.environ:
119+
library_path += os.pathsep + os.environ["LD_LIBRARY_PATH"]
120+
os.environ["LD_LIBRARY_PATH" ] = library_path
121+
109122
if not exists(args.WHEEL_DIR):
110123
os.makedirs(args.WHEEL_DIR)
111124

0 commit comments

Comments
 (0)