Skip to content

Commit

Permalink
feature: allow specifying additional library paths (fixes: #373)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jlaine committed Feb 24, 2022
1 parent f3c7691 commit ae0aae5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/auditwheel/main_repair.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import logging
import os
from os.path import abspath, basename, exists, isfile

from auditwheel.patcher import Patchelf
Expand Down Expand Up @@ -92,6 +93,12 @@ def configure_parser(sub_parsers):
help="Do not check for higher policy compatibility",
default=False,
)
p.add_argument(
"--add-path",
dest="PATHS",
default="",
help=f"Additional path(s) to search for libraries, {os.pathsep!r}-delimited",
)
p.set_defaults(func=execute)


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

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

if args.PATHS:
library_path = args.PATHS
if "LD_LIBRARY_PATH" in os.environ:
library_path += os.pathsep + os.environ["LD_LIBRARY_PATH"]
os.environ["LD_LIBRARY_PATH"] = library_path

if not exists(args.WHEEL_DIR):
os.makedirs(args.WHEEL_DIR)

Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_bundled_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_wheel_source_date_epoch(tmp_path, monkeypatch):
args = Namespace(
LIB_SDIR=".libs",
ONLY_PLAT=False,
PATHS="",
PLAT="manylinux_2_5_x86_64",
STRIP=False,
UPDATE_TAGS=True,
Expand Down

0 comments on commit ae0aae5

Please sign in to comment.