From b4f8e4e0476aad8d9323686246e13b0f9dc25efe Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 13 Aug 2024 12:01:17 -0400 Subject: [PATCH] fix: quote paths from pybind11-config Signed-off-by: Henry Schreiner --- pybind11/__main__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pybind11/__main__.py b/pybind11/__main__.py index 180665c23c..f2be4d0b7e 100644 --- a/pybind11/__main__.py +++ b/pybind11/__main__.py @@ -1,6 +1,7 @@ # pylint: disable=missing-function-docstring import argparse +import shlex import sys import sysconfig @@ -21,7 +22,7 @@ def print_includes() -> None: if d and d not in unique_dirs: unique_dirs.append(d) - print(" ".join("-I" + d for d in unique_dirs)) + print(" ".join(shlex.quote(f"-I{d}") for d in unique_dirs)) def main() -> None: @@ -53,9 +54,9 @@ def main() -> None: if args.includes: print_includes() if args.cmakedir: - print(get_cmake_dir()) + print(shlex.quote(get_cmake_dir())) if args.pkgconfigdir: - print(get_pkgconfig_dir()) + print(shlex.quote(get_pkgconfig_dir())) if __name__ == "__main__":