···109110111def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]:
112- return path.rglob(pattern) if recursive else path.glob(pattern)
0000000113114115cached_paths: Set[Path] = set()
···305 "--no-recurse",
306 dest="recursive",
307 action="store_false",
308- help="Patch only the provided paths, and ignore their children")
309 parser.add_argument(
310 "--paths", nargs="*", type=Path,
311- help="Paths whose content needs to be patched.")
00312 parser.add_argument(
313 "--libs", nargs="*", type=Path,
314- help="Paths where libraries are searched for.")
00315 parser.add_argument(
316 "--runtime-dependencies", nargs="*", type=Path,
317- help="Paths to prepend to the runtime path of executable binaries.")
0318 parser.add_argument(
319 "--append-rpaths",
320 nargs="*",
···109110111def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]:
112+ if path.is_dir():
113+ return path.rglob(pattern) if recursive else path.glob(pattern)
114+ else:
115+ # path.glob won't return anything if the path is not a directory.
116+ # We extend that behavior by matching the file name against the pattern.
117+ # This allows to pass single files instead of dirs to auto_patchelf,
118+ # for greater control on the files to consider.
119+ return [path] if path.match(pattern) else []
120121122cached_paths: Set[Path] = set()
···312 "--no-recurse",
313 dest="recursive",
314 action="store_false",
315+ help="Disable the recursive traversal of paths to patch.")
316 parser.add_argument(
317 "--paths", nargs="*", type=Path,
318+ help="Paths whose content needs to be patched."
319+ " Single files and directories are accepted."
320+ " Directories are traversed recursively by default.")
321 parser.add_argument(
322 "--libs", nargs="*", type=Path,
323+ help="Paths where libraries are searched for."
324+ " Single files and directories are accepted."
325+ " Directories are not searched recursively.")
326 parser.add_argument(
327 "--runtime-dependencies", nargs="*", type=Path,
328+ help="Paths to prepend to the runtime path of executable binaries."
329+ " Subject to deduplication, which may imply some reordering.")
330 parser.add_argument(
331 "--append-rpaths",
332 nargs="*",