mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] python3-numpy: fix building with setuptools >= 74.0.0
@ 2025-12-16 15:28 Markus Heidelberg via ptxdist
  2026-01-15 15:12 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Heidelberg via ptxdist @ 2025-12-16 15:28 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Heidelberg

Fixes these errors:
ModuleNotFoundError: No module named 'distutils.msvccompiler'

Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
---

Is this an acceptable fix? The example on the NumPy website works.

Later I found this fix:
  https://github.com/numpy/numpy/commit/1cc02cc6710384c52e1082a33d1617504eaed296
But there was no fix for the second build error, so I kept my solution.

 ...istutils.msvccompiler-in-setuptools-.patch | 45 +++++++++++++++++++
 patches/numpy-1.26.4/series                   |  3 +-
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch

diff --git a/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch b/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
new file mode 100644
index 000000000..c24cff9f9
--- /dev/null
+++ b/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
@@ -0,0 +1,45 @@
+From: Markus Heidelberg <m.heidelberg@cab.de>
+Date: Tue, 16 Dec 2025 11:50:00 +0100
+Subject: [PATCH] handle missing distutils.msvccompiler in setuptools >= 74.0.0
+
+distutils._msvccompiler exists, but only provides the MSVCCompiler
+class, not the get_build_version function.
+
+Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
+---
+ numpy/distutils/mingw32ccompiler.py | 4 +++-
+ numpy/distutils/msvccompiler.py     | 2 +-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
+index 4763f41ad326..f504d8b6223d 100644
+--- a/numpy/distutils/mingw32ccompiler.py
++++ b/numpy/distutils/mingw32ccompiler.py
+@@ -24,13 +24,15 @@
+ 
+ import distutils.cygwinccompiler
+ from distutils.unixccompiler import UnixCCompiler
+-from distutils.msvccompiler import get_build_version as get_build_msvc_version
+ from distutils.errors import UnknownFileError
+ from numpy.distutils.misc_util import (msvc_runtime_library,
+                                        msvc_runtime_version,
+                                        msvc_runtime_major,
+                                        get_build_architecture)
+ 
++def get_build_msvc_version():
++    return None
++
+ def get_msvcr_replacement():
+     """Replacement for outdated version of get_msvcr from cygwinccompiler"""
+     msvcr = msvc_runtime_library()
+diff --git a/numpy/distutils/msvccompiler.py b/numpy/distutils/msvccompiler.py
+index 2b93221baac8..5e2a030404da 100644
+--- a/numpy/distutils/msvccompiler.py
++++ b/numpy/distutils/msvccompiler.py
+@@ -1,5 +1,5 @@
+ import os
+-from distutils.msvccompiler import MSVCCompiler as _MSVCCompiler
++from distutils._msvccompiler import MSVCCompiler as _MSVCCompiler
+ 
+ from .system_info import platform_bits
+ 
diff --git a/patches/numpy-1.26.4/series b/patches/numpy-1.26.4/series
index a493ac227..57cb0bc5b 100644
--- a/patches/numpy-1.26.4/series
+++ b/patches/numpy-1.26.4/series
@@ -1,4 +1,5 @@
 # generated by git-ptx-patches
 #tag:base --start-number 1
 0001-use-path-from-environment-only-for-library_dirs.patch
-# d9bc0f9a910e0d311ad4c7761b8f6062  - git-ptx-patches magic
+0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
+# 3e55650c70507297b27d494f0e36c7d4  - git-ptx-patches magic
-- 
2.43.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [APPLIED] python3-numpy: fix building with setuptools >= 74.0.0
  2025-12-16 15:28 [ptxdist] [PATCH] python3-numpy: fix building with setuptools >= 74.0.0 Markus Heidelberg via ptxdist
@ 2026-01-15 15:12 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2026-01-15 15:12 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Heidelberg

Thanks, applied as ca274b04a27b0ede0890f925a790098da1df9909.

Michael

[sent from post-receive hook]

On Thu, 15 Jan 2026 16:12:02 +0100, Markus Heidelberg <m.heidelberg@cab.de> wrote:
> Fixes these errors:
> ModuleNotFoundError: No module named 'distutils.msvccompiler'
> 
> Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> Message-Id: <20251216152837.668958-1-m.heidelberg@cab.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch b/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
> new file mode 100644
> index 000000000000..c24cff9f9b08
> --- /dev/null
> +++ b/patches/numpy-1.26.4/0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
> @@ -0,0 +1,45 @@
> +From: Markus Heidelberg <m.heidelberg@cab.de>
> +Date: Tue, 16 Dec 2025 11:50:00 +0100
> +Subject: [PATCH] handle missing distutils.msvccompiler in setuptools >= 74.0.0
> +
> +distutils._msvccompiler exists, but only provides the MSVCCompiler
> +class, not the get_build_version function.
> +
> +Signed-off-by: Markus Heidelberg <m.heidelberg@cab.de>
> +---
> + numpy/distutils/mingw32ccompiler.py | 4 +++-
> + numpy/distutils/msvccompiler.py     | 2 +-
> + 2 files changed, 4 insertions(+), 2 deletions(-)
> +
> +diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
> +index 4763f41ad326..f504d8b6223d 100644
> +--- a/numpy/distutils/mingw32ccompiler.py
> ++++ b/numpy/distutils/mingw32ccompiler.py
> +@@ -24,13 +24,15 @@
> + 
> + import distutils.cygwinccompiler
> + from distutils.unixccompiler import UnixCCompiler
> +-from distutils.msvccompiler import get_build_version as get_build_msvc_version
> + from distutils.errors import UnknownFileError
> + from numpy.distutils.misc_util import (msvc_runtime_library,
> +                                        msvc_runtime_version,
> +                                        msvc_runtime_major,
> +                                        get_build_architecture)
> + 
> ++def get_build_msvc_version():
> ++    return None
> ++
> + def get_msvcr_replacement():
> +     """Replacement for outdated version of get_msvcr from cygwinccompiler"""
> +     msvcr = msvc_runtime_library()
> +diff --git a/numpy/distutils/msvccompiler.py b/numpy/distutils/msvccompiler.py
> +index 2b93221baac8..5e2a030404da 100644
> +--- a/numpy/distutils/msvccompiler.py
> ++++ b/numpy/distutils/msvccompiler.py
> +@@ -1,5 +1,5 @@
> + import os
> +-from distutils.msvccompiler import MSVCCompiler as _MSVCCompiler
> ++from distutils._msvccompiler import MSVCCompiler as _MSVCCompiler
> + 
> + from .system_info import platform_bits
> + 
> diff --git a/patches/numpy-1.26.4/series b/patches/numpy-1.26.4/series
> index a493ac22746e..57cb0bc5b3f2 100644
> --- a/patches/numpy-1.26.4/series
> +++ b/patches/numpy-1.26.4/series
> @@ -1,4 +1,5 @@
>  # generated by git-ptx-patches
>  #tag:base --start-number 1
>  0001-use-path-from-environment-only-for-library_dirs.patch
> -# d9bc0f9a910e0d311ad4c7761b8f6062  - git-ptx-patches magic
> +0002-handle-missing-distutils.msvccompiler-in-setuptools-.patch
> +# 3e55650c70507297b27d494f0e36c7d4  - git-ptx-patches magic



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-15 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 15:28 [ptxdist] [PATCH] python3-numpy: fix building with setuptools >= 74.0.0 Markus Heidelberg via ptxdist
2026-01-15 15:12 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox