Skip to content

Commit 694e68f

Browse files
committed
Skip passing empty arguments to stub generation
1 parent 553a09b commit 694e68f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/charonload/_finder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ def __init__(self: Self, module_name: str, config: Config, step_number: tuple[in
348348

349349
def _run_impl(self: Self) -> None:
350350
full_extension_path: pathlib.Path = self.cache["location"]
351-
windows_dll_directories: str = self.cache["windows_dll_directories"]
352351
old_checksum: str = self.cache.get("checksum", "")
353352
new_checksum = self._compute_checksum(full_extension_path)
354353

@@ -366,10 +365,7 @@ def _run_impl(self: Self) -> None:
366365
(pathlib.Path(__file__).parent / "pybind11_stubgen").as_posix(),
367366
"--extension-path",
368367
full_extension_path.as_posix(),
369-
"--windows-dll-directories",
370-
windows_dll_directories,
371-
"--root-suffix",
372-
"",
368+
*self._windows_dll_directories(),
373369
"--print-invalid-expressions-as-is",
374370
*self._ignore_invalid(),
375371
"--exit-code",
@@ -385,6 +381,10 @@ def _run_impl(self: Self) -> None:
385381
if status == _StepStatus.FAILED:
386382
raise self.exception_cls(log)
387383

384+
def _windows_dll_directories(self: Self) -> list[str]:
385+
windows_dll_directories: str = self.cache["windows_dll_directories"]
386+
return ["--windows-dll-directories", windows_dll_directories] if windows_dll_directories else []
387+
388388
def _ignore_invalid(self: Self) -> list[str]:
389389
return ["--ignore-all-errors"] if self.config.stubs_invalid_ok else []
390390

src/charonload/pybind11_stubgen/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def main() -> None:
3333
)
3434
parser.add_argument(
3535
"--windows-dll-directories",
36-
required=True,
36+
nargs="?",
37+
const="",
38+
default="",
3739
type=str,
3840
help="the list of DLL directories required for loading the extension",
3941
)

0 commit comments

Comments
 (0)