···109109110110111111def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]:
112112- return path.rglob(pattern) if recursive else path.glob(pattern)
112112+ if path.is_dir():
113113+ return path.rglob(pattern) if recursive else path.glob(pattern)
114114+ else:
115115+ # path.glob won't return anything if the path is not a directory.
116116+ # We extend that behavior by matching the file name against the pattern.
117117+ # This allows to pass single files instead of dirs to auto_patchelf,
118118+ # for greater control on the files to consider.
119119+ return [path] if path.match(pattern) else []
113120114121115122cached_paths: Set[Path] = set()
···305312 "--no-recurse",
306313 dest="recursive",
307314 action="store_false",
308308- help="Patch only the provided paths, and ignore their children")
315315+ help="Disable the recursive traversal of paths to patch.")
309316 parser.add_argument(
310317 "--paths", nargs="*", type=Path,
311311- help="Paths whose content needs to be patched.")
318318+ help="Paths whose content needs to be patched."
319319+ " Single files and directories are accepted."
320320+ " Directories are traversed recursively by default.")
312321 parser.add_argument(
313322 "--libs", nargs="*", type=Path,
314314- help="Paths where libraries are searched for.")
323323+ help="Paths where libraries are searched for."
324324+ " Single files and directories are accepted."
325325+ " Directories are not searched recursively.")
315326 parser.add_argument(
316327 "--runtime-dependencies", nargs="*", type=Path,
317317- help="Paths to prepend to the runtime path of executable binaries.")
328328+ help="Paths to prepend to the runtime path of executable binaries."
329329+ " Subject to deduplication, which may imply some reordering.")
318330 parser.add_argument(
319331 "--append-rpaths",
320332 nargs="*",