From a3d37a299235e6f3993605e5765b37969c56c773 Mon Sep 17 00:00:00 2001 From: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com> Date: Tue, 11 Mar 2025 00:45:20 -0400 Subject: [PATCH 1/3] Expand return type of CCompiler.runtime_library_dir_option. Subclasses of `CCompiler`, specifically those in `unix` and `cygwin`, can return lists of strings in addition to strings. Whether this should be loosened further, e.g. `str | Sequence[str]`, is up for debate, but at least adding `list[str]` makes this more accurate. --- distutils/compilers/C/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distutils/compilers/C/base.py b/distutils/compilers/C/base.py index 4767b7f3..26f825b4 100644 --- a/distutils/compilers/C/base.py +++ b/distutils/compilers/C/base.py @@ -862,7 +862,7 @@ def library_dir_option(self, dir: str) -> str: """ raise NotImplementedError - def runtime_library_dir_option(self, dir: str) -> str: + def runtime_library_dir_option(self, dir: str) -> str | list[str]: """Return the compiler option to add 'dir' to the list of directories searched for runtime libraries. """ From 172be5e30fb2eed805fa9941bdf5b7617b0eeb34 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 23 Mar 2025 16:21:47 -0400 Subject: [PATCH 2/3] Add news fragment. --- newsfragments/4902.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/4902.bugfix.rst diff --git a/newsfragments/4902.bugfix.rst b/newsfragments/4902.bugfix.rst new file mode 100644 index 00000000..6388d722 --- /dev/null +++ b/newsfragments/4902.bugfix.rst @@ -0,0 +1 @@ +Reverted distutils changes that broke the monkey patching of command classes. From 90ad083ea3bbac13c37cb55ff7040ff6fd9de26c Mon Sep 17 00:00:00 2001 From: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com> Date: Tue, 25 Mar 2025 00:21:03 -0400 Subject: [PATCH 3/3] Remove unnecessary type-ignore. --- distutils/compilers/C/unix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distutils/compilers/C/unix.py b/distutils/compilers/C/unix.py index e8a53d45..77ff4edc 100644 --- a/distutils/compilers/C/unix.py +++ b/distutils/compilers/C/unix.py @@ -323,7 +323,7 @@ def _is_gcc(self): compiler = os.path.basename(shlex.split(cc_var)[0]) return "gcc" in compiler or "g++" in compiler - def runtime_library_dir_option(self, dir: str) -> str | list[str]: # type: ignore[override] # Fixed in pypa/distutils#339 + def runtime_library_dir_option(self, dir: str) -> str | list[str]: # XXX Hackish, at the very least. See Python bug #445902: # https://bugs.python.org/issue445902 # Linkers on different platforms need different options to