mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
autoPatchelfHook: Add support for single files
This commit is contained in:
parent
2a441ffb14
commit
dd0dee4c97
|
@ -109,7 +109,14 @@ def osabi_are_compatible(wanted: str, got: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]:
|
def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]:
|
||||||
|
if path.is_dir():
|
||||||
return path.rglob(pattern) if recursive else path.glob(pattern)
|
return path.rglob(pattern) if recursive else path.glob(pattern)
|
||||||
|
else:
|
||||||
|
# path.glob won't return anything if the path is not a directory.
|
||||||
|
# We extend that behavior by matching the file name against the pattern.
|
||||||
|
# This allows to pass single files instead of dirs to auto_patchelf,
|
||||||
|
# for greater control on the files to consider.
|
||||||
|
return [path] if path.match(pattern) else []
|
||||||
|
|
||||||
|
|
||||||
cached_paths: Set[Path] = set()
|
cached_paths: Set[Path] = set()
|
||||||
|
@ -305,16 +312,21 @@ def main() -> None:
|
||||||
"--no-recurse",
|
"--no-recurse",
|
||||||
dest="recursive",
|
dest="recursive",
|
||||||
action="store_false",
|
action="store_false",
|
||||||
help="Patch only the provided paths, and ignore their children")
|
help="Disable the recursive traversal of paths to patch.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--paths", nargs="*", type=Path,
|
"--paths", nargs="*", type=Path,
|
||||||
help="Paths whose content needs to be patched.")
|
help="Paths whose content needs to be patched."
|
||||||
|
" Single files and directories are accepted."
|
||||||
|
" Directories are traversed recursively by default.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--libs", nargs="*", type=Path,
|
"--libs", nargs="*", type=Path,
|
||||||
help="Paths where libraries are searched for.")
|
help="Paths where libraries are searched for."
|
||||||
|
" Single files and directories are accepted."
|
||||||
|
" Directories are not searched recursively.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--runtime-dependencies", nargs="*", type=Path,
|
"--runtime-dependencies", nargs="*", type=Path,
|
||||||
help="Paths to prepend to the runtime path of executable binaries.")
|
help="Paths to prepend to the runtime path of executable binaries."
|
||||||
|
" Subject to deduplication, which may imply some reordering.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--append-rpaths",
|
"--append-rpaths",
|
||||||
nargs="*",
|
nargs="*",
|
||||||
|
|
Loading…
Reference in a new issue