Date: Sat, 4 Apr 2026 22:30:58 +0300 From: Dima Panov <fluffy@FreeBSD.org> To: dev-commits-ports-all@FreeBSD.org, ports-committers@FreeBSD.org, dev-commits-ports-main@FreeBSD.org, Charlie Li <vishwin@FreeBSD.org> Subject: Re: git: 28081ef83218 - main - math/py-numpy1: backport configtool/pkg-config file from numpy 2 Message-ID: <4f3f2978-762f-43ec-8507-4c780a316b98@Canary> In-Reply-To: <c1549e75-8fea-488b-b759-8accad24684e@FreeBSD.org> References: <69d06e94.335f7.791ef923@gitrepo.freebsd.org> <c1549e75-8fea-488b-b759-8accad24684e@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] BTW, it looks like missing -lm in LDFLAGS -- Dima. (desktop, kde, x11, office, ports-secteam)@FreeBSD team (fluffy@FreeBSD.org, https://t.me/FluffyBSD) > On суббота, апр. 04, 2026 at 8:08 PM, Dima Panov <fluffy@FreeBSD.org (mailto:fluffy@FreeBSD.org)> wrote: > hello! > > > This not fixed Imath and boot-python-libs on -current ( FreeBSD 16.0-CURRENT #0 main-2d843b7c9758: Fri Apr 3 23:38:53 MSK 2026 arm64) :( > > However, build is fine on releng/15 and releng/14 > > -- generating PyImath.pc > -- Configuring imathnumpy module > Traceback (most recent call last): > File "/usr/local/lib/python3.11/site-packages/numpy/core/__init__.py", line 24, in <module> > from . import multiarray > File "/usr/local/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module> > from . import overrides > File "/usr/local/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module> > from numpy.core._multiarray_umath import ( > ImportError: /usr/local/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311.so: Undefined symbol "feraiseexcept" > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/usr/local/lib/python3.11/site-packages/numpy/__init__.py", line 130, in <module> > from numpy.__config__ import show as show_config > File "/usr/local/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module> > from numpy.core._multiarray_umath import ( > File "/usr/local/lib/python3.11/site-packages/numpy/core/__init__.py", line 50, in <module> > raise ImportError(msg) > ImportError: > > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > > Importing the numpy C-extensions failed. This error can happen for > many reasons, often due to issues with your setup or how NumPy was > installed. > > We have compiled some common reasons and troubleshooting tips at: > > https://numpy.org/devdocs/user/troubleshooting-importerror.html > > Please note and check the following: > > * The Python version is: Python3.11 from "/usr/local/bin/python3.11" > * The NumPy version is: "1.26.4" > > and make sure that they are the versions you expect. > Please carefully study the documentation linked above for further help. > > Original error was: /usr/local/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311.so: Undefined symbol "feraiseexcept" > > > The above exception was the direct cause of the following exception: > > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "/usr/local/lib/python3.11/site-packages/numpy/__init__.py", line 135, in <module> > raise ImportError(msg) from e > ImportError: Error importing numpy: you should not try to import numpy from > its source directory; please exit the numpy source tree, and relaunch > your python interpreter from there. > -- installing imathnumpy module to lib/python3.11/site-packages > > > > On 04.04.2026 04:51, Charlie Li wrote: > > The branch main has been updated by vishwin: > > > > URL: https://cgit.FreeBSD.org/ports/commit/?id=28081ef83218b02fe882f736d7935ea05bb23d68 > > > > commit 28081ef83218b02fe882f736d7935ea05bb23d68 > > Author: Charlie Li <vishwin@FreeBSD.org> > > AuthorDate: 2026-04-04 01:47:26 +0000 > > Commit: Charlie Li <vishwin@FreeBSD.org> > > CommitDate: 2026-04-04 01:47:26 +0000 > > > > math/py-numpy1: backport configtool/pkg-config file from numpy 2 > > > > Traditionally the way to query for the numpy C API has been through > > distutils/setuptools, but the use of setuptools beyond a PEP-517 > > build backend is increasingly discouraged. numpy 2 introduced > > numpy-config and a pkg-config file to allow consumer build systems > > to better support the use of numpy as a dependency. > > > > Based on: https://github.com/numpy/numpy/commit/2634f803313f349170c09606d3cc619accd72247 > > > > Reported by: fluffy > > PR: 281470 > > --- > > math/py-numpy1/Makefile | 1 + > > math/py-numpy1/files/patch-numpy___configtool.py | 42 +++++++++++++++++++++ > > math/py-numpy1/files/patch-numpy_core_meson.build | 26 +++++++++++++ > > math/py-numpy1/files/patch-numpy_core_numpy.pc.in | 10 +++++ > > math/py-numpy1/files/patch-numpy_lib_utils.py | 35 +++++++++++++++++ > > math/py-numpy1/files/patch-numpy_meson.build | 10 +++++ > > .../files/patch-numpy_tests_test__configtool.py | 44 ++++++++++++++++++++++ > > math/py-numpy1/files/patch-pyproject.toml | 21 +++++++++++ > > 8 files changed, 189 insertions(+) > > > > diff --git a/math/py-numpy1/Makefile b/math/py-numpy1/Makefile > > index e6b83231570d..7873d11b3784 100644 > > --- a/math/py-numpy1/Makefile > > +++ b/math/py-numpy1/Makefile > > @@ -1,5 +1,6 @@ > > PORTNAME= numpy > > DISTVERSION= 1.26.4 > > +PORTREVISION= 1 > > CATEGORIES= math python > > MASTER_SITES= PYPI \ > > https://numpy.org/doc/${DISTVERSION:R}/:doc > > diff --git a/math/py-numpy1/files/patch-numpy___configtool.py b/math/py-numpy1/files/patch-numpy___configtool.py > > new file mode 100644 > > index 000000000000..4d6158efa35a > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy___configtool.py > > @@ -0,0 +1,42 @@ > > +--- numpy/_configtool.py.orig 2026-04-04 01:24:53 UTC > > ++++ numpy/_configtool.py > > +@@ -0,0 +1,39 @@ > > ++import argparse > > ++from pathlib import Path > > ++import sys > > ++ > > ++from .version import __version__ > > ++from .lib.utils import get_include > > ++ > > ++ > > ++def main() -> None: > > ++ parser = argparse.ArgumentParser() > > ++ parser.add_argument( > > ++ "--version", > > ++ action="version", > > ++ version=__version__, > > ++ help="Print the version and exit.", > > ++ ) > > ++ parser.add_argument( > > ++ "--cflags", > > ++ action="store_true", > > ++ help="Compile flag needed when using the NumPy headers.", > > ++ ) > > ++ parser.add_argument( > > ++ "--pkgconfigdir", > > ++ action="store_true", > > ++ help=("Print the pkgconfig directory in which `numpy.pc` is stored " > > ++ "(useful for setting $PKG_CONFIG_PATH)."), > > ++ ) > > ++ args = parser.parse_args() > > ++ if not sys.argv[1:]: > > ++ parser.print_help() > > ++ if args.cflags: > > ++ print("-I" + get_include()) > > ++ if args.pkgconfigdir: > > ++ _path = Path(get_include()) / '..' / 'lib' / 'pkgconfig' > > ++ print(_path.resolve()) > > ++ > > ++ > > ++if __name__ == "__main__": > > ++ main() > > diff --git a/math/py-numpy1/files/patch-numpy_core_meson.build b/math/py-numpy1/files/patch-numpy_core_meson.build > > new file mode 100644 > > index 000000000000..1e0b9cdc79ce > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy_core_meson.build > > @@ -0,0 +1,26 @@ > > +--- numpy/core/meson.build.orig 2024-02-05 21:17:48 UTC > > ++++ numpy/core/meson.build > > +@@ -621,6 +621,23 @@ src_ufunc_api = custom_target('__ufunc_api', > > + install_dir: np_dir / 'core/include/numpy' > > + ) > > + > > ++# Write out pkg-config file > > ++# ------------------------- > > ++ > > ++# Note: we can't use Meson's built-in pkgconfig module, because we have to > > ++# install numpy.pc within site-packages rather than in its normal location. > > ++cdata_numpy_pc = configuration_data() > > ++cdata_numpy_pc.set('version', meson.project_version()) > > ++ > > ++# Note: keep install path in sync with numpy/_configtool.py > > ++_numpy_pc = configure_file( > > ++ input: 'numpy.pc.in', > > ++ output: 'numpy.pc', > > ++ configuration: cdata_numpy_pc, > > ++ install: true, > > ++ install_dir: np_dir / 'core/lib/pkgconfig', > > ++ install_tag: 'devel' > > ++) > > + > > + # Set common build flags for C and C++ code > > + # ----------------------------------------- > > diff --git a/math/py-numpy1/files/patch-numpy_core_numpy.pc.in b/math/py-numpy1/files/patch-numpy_core_numpy.pc.in > > new file mode 100644 > > index 000000000000..58f33ee87633 > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy_core_numpy.pc.in > > @@ -0,0 +1,10 @@ > > +--- numpy/core/numpy.pc.in.orig 2026-04-04 00:13:21 UTC > > ++++ numpy/core/numpy.pc.in > > +@@ -0,0 +1,7 @@ > > ++prefix=${pcfiledir}/../.. > > ++includedir=${prefix}/include > > ++ > > ++Name: numpy > > ++Description: NumPy is the fundamental package for scientific computing with Python. > > ++Version: @version@ > > ++Cflags: -I${includedir} > > diff --git a/math/py-numpy1/files/patch-numpy_lib_utils.py b/math/py-numpy1/files/patch-numpy_lib_utils.py > > new file mode 100644 > > index 000000000000..03914f54522c > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy_lib_utils.py > > @@ -0,0 +1,35 @@ > > +--- numpy/lib/utils.py.orig 2024-02-05 21:17:48 UTC > > ++++ numpy/lib/utils.py > > +@@ -76,18 +76,29 @@ def get_include(): > > + """ > > + Return the directory that contains the NumPy \\*.h header files. > > + > > +- Extension modules that need to compile against NumPy should use this > > ++ Extension modules that need to compile against NumPy may need to use this > > + function to locate the appropriate include directory. > > + > > + Notes > > + ----- > > +- When using ``distutils``, for example in ``setup.py``:: > > ++ When using ``setuptools``, for example in ``setup.py``:: > > + > > + import numpy as np > > + ... > > + Extension('extension_name', ... > > +- include_dirs=[np.get_include()]) > > ++ include_dirs=[np.get_include()]) > > + ... > > ++ > > ++ Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using > > ++ that is likely preferred for build systems other than ``setuptools``:: > > ++ > > ++ $ numpy-config --cflags > > ++ -I/path/to/site-packages/numpy/_core/include > > ++ > > ++ # Or rely on pkg-config: > > ++ $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) > > ++ $ pkg-config --cflags > > ++ -I/path/to/site-packages/numpy/_core/include > > + > > + """ > > + import numpy > > diff --git a/math/py-numpy1/files/patch-numpy_meson.build b/math/py-numpy1/files/patch-numpy_meson.build > > new file mode 100644 > > index 000000000000..77cd8dd42fc0 > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy_meson.build > > @@ -0,0 +1,10 @@ > > +--- numpy/meson.build.orig 2024-02-05 21:17:48 UTC > > ++++ numpy/meson.build > > +@@ -215,6 +215,7 @@ python_sources = [ > > + '__init__.pxd', > > + '__init__.py', > > + '__init__.pyi', > > ++ '_configtool.py', > > + '_distributor_init.py', > > + '_globals.py', > > + '_pytesttester.py', > > diff --git a/math/py-numpy1/files/patch-numpy_tests_test__configtool.py b/math/py-numpy1/files/patch-numpy_tests_test__configtool.py > > new file mode 100644 > > index 000000000000..306e0f5f677b > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-numpy_tests_test__configtool.py > > @@ -0,0 +1,44 @@ > > +--- numpy/tests/test_configtool.py.orig 2026-04-04 00:20:07 UTC > > ++++ numpy/tests/test_configtool.py > > +@@ -0,0 +1,41 @@ > > ++import os > > ++import subprocess > > ++import sysconfig > > ++ > > ++import pytest > > ++import numpy as np > > ++ > > ++ > > ++is_editable = not bool(np.__path__) > > ++numpy_in_sitepackages = sysconfig.get_path('platlib') in np.__file__ > > ++# We only expect to have a `numpy-config` available if NumPy was installed via > > ++# a build frontend (and not `spin` for example) > > ++if not (numpy_in_sitepackages or is_editable): > > ++ pytest.skip("`numpy-config` not expected to be installed", > > ++ allow_module_level=True) > > ++ > > ++ > > ++def check_numpyconfig(arg): > > ++ p = subprocess.run(['numpy-config', arg], capture_output=True, text=True) > > ++ p.check_returncode() > > ++ return p.stdout.strip() > > ++ > > ++ > > ++def test_configtool_version(): > > ++ stdout = check_numpyconfig('--version') > > ++ assert stdout == np.__version__ > > ++ > > ++ > > ++def test_configtool_cflags(): > > ++ stdout = check_numpyconfig('--cflags') > > ++ assert stdout.endswith(os.path.join('numpy', 'core', 'include')) > > ++ > > ++ > > ++def test_configtool_pkgconfigdir(): > > ++ stdout = check_numpyconfig('--pkgconfigdir') > > ++ assert stdout.endswith(os.path.join('numpy', 'core', 'lib', 'pkgconfig')) > > ++ > > ++ if not is_editable: > > ++ # Also check that the .pc file actually exists (unless we're using an > > ++ # editable install, then it'll be hiding in the build dir) > > ++ assert os.path.exists(os.path.join(stdout, 'numpy.pc')) > > diff --git a/math/py-numpy1/files/patch-pyproject.toml b/math/py-numpy1/files/patch-pyproject.toml > > new file mode 100644 > > index 000000000000..f26d7ee283c7 > > --- /dev/null > > +++ b/math/py-numpy1/files/patch-pyproject.toml > > @@ -0,0 +1,21 @@ > > +--- pyproject.toml.orig 2024-02-05 21:17:48 UTC > > ++++ pyproject.toml > > +@@ -1,8 +1,8 @@ requires = [ > > + [build-system] > > + build-backend = "mesonpy" > > + requires = [ > > +- "Cython>=0.29.34,<3.1", > > +- "meson-python>=0.15.0,<0.16.0", > > ++ "Cython>=0.29.34", > > ++ "meson-python>=0.15.0", > > + ] > > + > > + [project] > > +@@ -43,6 +43,7 @@ f2py = 'numpy.f2py.f2py2e:main' > > + > > + [project.scripts] > > + f2py = 'numpy.f2py.f2py2e:main' > > ++numpy-config = 'numpy._configtool:main' > > + > > + [project.entry-points.array_api] > > + numpy = 'numpy.array_api' > > > > -- > Sincerely, > Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD, @fluffy:matrix-dev.freebsd.org) > (desktop, kde, x11, office, ports-secteam)@FreeBSD team > [-- Attachment #2 --] <html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> </head> <body style="font-family:Helvetica;color:#000000;font-size:16px;"><div id="CanaryBody" dir="auto"> <div> BTW, it looks like missing -lm in LDFLAGS</div> <div><br></div> </div> <div id="CanarySig"> <div> <div style="font-family:Helvetica;"><div style="font-family:Helvetica;">--<br><div>Dima. (desktop, kde, x11, office, ports-secteam)@FreeBSD team</div><div>(fluffy@FreeBSD.org, https://t.me/FluffyBSD)</div></div></div> <div><br></div> </div> </div> <div id="CanaryDropbox"> </div> <blockquote id="CanaryBlockquote"> <div> <div>On суббота, апр. 04, 2026 at 8:08 PM, Dima Panov <<a href="mailto:fluffy@FreeBSD.org">fluffy@FreeBSD.org</a>> wrote:<br></div> <div><div id="">hello! <br> <br> <br>This not fixed Imath and boot-python-libs on -current ( FreeBSD 16.0-CURRENT #0 main-2d843b7c9758: Fri Apr 3 23:38:53 MSK 2026 arm64) :( <br> <br>However, build is fine on releng/15 and releng/14 <br> <br>-- generating PyImath.pc <br>-- Configuring imathnumpy module <br>Traceback (most recent call last): <br> File "/usr/local/lib/python3.11/site-packages/numpy/core/__init__.py", line 24, in <module> <br> from . import multiarray <br> File "/usr/local/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module> <br> from . import overrides <br> File "/usr/local/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module> <br> from numpy.core._multiarray_umath import ( <br>ImportError: /usr/local/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311.so: Undefined symbol "feraiseexcept" <br> <br>During handling of the above exception, another exception occurred: <br> <br>Traceback (most recent call last): <br> File "/usr/local/lib/python3.11/site-packages/numpy/__init__.py", line 130, in <module> <br> from numpy.__config__ import show as show_config <br> File "/usr/local/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module> <br> from numpy.core._multiarray_umath import ( <br> File "/usr/local/lib/python3.11/site-packages/numpy/core/__init__.py", line 50, in <module> <br> raise ImportError(msg) <br>ImportError: <br> <br>IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! <br> <br>Importing the numpy C-extensions failed. This error can happen for <br>many reasons, often due to issues with your setup or how NumPy was <br>installed. <br> <br>We have compiled some common reasons and troubleshooting tips at: <br> <br> https://numpy.org/devdocs/user/troubleshooting-importerror.html <br> <br>Please note and check the following: <br> <br> * The Python version is: Python3.11 from "/usr/local/bin/python3.11" <br> * The NumPy version is: "1.26.4" <br> <br>and make sure that they are the versions you expect. <br>Please carefully study the documentation linked above for further help. <br> <br>Original error was: /usr/local/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311.so: Undefined symbol "feraiseexcept" <br> <br> <br>The above exception was the direct cause of the following exception: <br> <br>Traceback (most recent call last): <br> File "<string>", line 1, in <module> <br> File "/usr/local/lib/python3.11/site-packages/numpy/__init__.py", line 135, in <module> <br> raise ImportError(msg) from e <br>ImportError: Error importing numpy: you should not try to import numpy from <br> its source directory; please exit the numpy source tree, and relaunch <br> your python interpreter from there. <br>-- installing imathnumpy module to lib/python3.11/site-packages <br> <br> <br> <br>On 04.04.2026 04:51, Charlie Li wrote: <br><blockquote type="cite">The branch main has been updated by vishwin: <br> <br>URL: https://cgit.FreeBSD.org/ports/commit/?id=28081ef83218b02fe882f736d7935ea05bb23d68 <br> <br>commit 28081ef83218b02fe882f736d7935ea05bb23d68 <br>Author: Charlie Li <vishwin@FreeBSD.org> <br>AuthorDate: 2026-04-04 01:47:26 +0000 <br>Commit: Charlie Li <vishwin@FreeBSD.org> <br>CommitDate: 2026-04-04 01:47:26 +0000 <br> <br>math/py-numpy1: backport configtool/pkg-config file from numpy 2 <br> <br>Traditionally the way to query for the numpy C API has been through <br>distutils/setuptools, but the use of setuptools beyond a PEP-517 <br>build backend is increasingly discouraged. numpy 2 introduced <br>numpy-config and a pkg-config file to allow consumer build systems <br>to better support the use of numpy as a dependency. <br> <br>Based on: https://github.com/numpy/numpy/commit/2634f803313f349170c09606d3cc619accd72247 <br> <br>Reported by: fluffy <br>PR: 281470 <br>--- <br>math/py-numpy1/Makefile | 1 + <br>math/py-numpy1/files/patch-numpy___configtool.py | 42 +++++++++++++++++++++ <br>math/py-numpy1/files/patch-numpy_core_meson.build | 26 +++++++++++++ <br>math/py-numpy1/files/patch-numpy_core_numpy.pc.in | 10 +++++ <br>math/py-numpy1/files/patch-numpy_lib_utils.py | 35 +++++++++++++++++ <br>math/py-numpy1/files/patch-numpy_meson.build | 10 +++++ <br>.../files/patch-numpy_tests_test__configtool.py | 44 ++++++++++++++++++++++ <br>math/py-numpy1/files/patch-pyproject.toml | 21 +++++++++++ <br>8 files changed, 189 insertions(+) <br> <br>diff --git a/math/py-numpy1/Makefile b/math/py-numpy1/Makefile <br>index e6b83231570d..7873d11b3784 100644 <br>--- a/math/py-numpy1/Makefile <br>+++ b/math/py-numpy1/Makefile <br>@@ -1,5 +1,6 @@ <br>PORTNAME= numpy <br>DISTVERSION= 1.26.4 <br>+PORTREVISION= 1 <br>CATEGORIES= math python <br>MASTER_SITES= PYPI \ <br> https://numpy.org/doc/${DISTVERSION:R}/:doc <br>diff --git a/math/py-numpy1/files/patch-numpy___configtool.py b/math/py-numpy1/files/patch-numpy___configtool.py <br>new file mode 100644 <br>index 000000000000..4d6158efa35a <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy___configtool.py <br>@@ -0,0 +1,42 @@ <br>+--- numpy/_configtool.py.orig 2026-04-04 01:24:53 UTC <br>++++ numpy/_configtool.py <br>+@@ -0,0 +1,39 @@ <br>++import argparse <br>++from pathlib import Path <br>++import sys <br>++ <br>++from .version import __version__ <br>++from .lib.utils import get_include <br>++ <br>++ <br>++def main() -> None: <br>++ parser = argparse.ArgumentParser() <br>++ parser.add_argument( <br>++ "--version", <br>++ action="version", <br>++ version=__version__, <br>++ help="Print the version and exit.", <br>++ ) <br>++ parser.add_argument( <br>++ "--cflags", <br>++ action="store_true", <br>++ help="Compile flag needed when using the NumPy headers.", <br>++ ) <br>++ parser.add_argument( <br>++ "--pkgconfigdir", <br>++ action="store_true", <br>++ help=("Print the pkgconfig directory in which `numpy.pc` is stored " <br>++ "(useful for setting $PKG_CONFIG_PATH)."), <br>++ ) <br>++ args = parser.parse_args() <br>++ if not sys.argv[1:]: <br>++ parser.print_help() <br>++ if args.cflags: <br>++ print("-I" + get_include()) <br>++ if args.pkgconfigdir: <br>++ _path = Path(get_include()) / '..' / 'lib' / 'pkgconfig' <br>++ print(_path.resolve()) <br>++ <br>++ <br>++if __name__ == "__main__": <br>++ main() <br>diff --git a/math/py-numpy1/files/patch-numpy_core_meson.build b/math/py-numpy1/files/patch-numpy_core_meson.build <br>new file mode 100644 <br>index 000000000000..1e0b9cdc79ce <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy_core_meson.build <br>@@ -0,0 +1,26 @@ <br>+--- numpy/core/meson.build.orig 2024-02-05 21:17:48 UTC <br>++++ numpy/core/meson.build <br>+@@ -621,6 +621,23 @@ src_ufunc_api = custom_target('__ufunc_api', <br>+ install_dir: np_dir / 'core/include/numpy' <br>+ ) <br>+ <br>++# Write out pkg-config file <br>++# ------------------------- <br>++ <br>++# Note: we can't use Meson's built-in pkgconfig module, because we have to <br>++# install numpy.pc within site-packages rather than in its normal location. <br>++cdata_numpy_pc = configuration_data() <br>++cdata_numpy_pc.set('version', meson.project_version()) <br>++ <br>++# Note: keep install path in sync with numpy/_configtool.py <br>++_numpy_pc = configure_file( <br>++ input: 'numpy.pc.in', <br>++ output: 'numpy.pc', <br>++ configuration: cdata_numpy_pc, <br>++ install: true, <br>++ install_dir: np_dir / 'core/lib/pkgconfig', <br>++ install_tag: 'devel' <br>++) <br>+ <br>+ # Set common build flags for C and C++ code <br>+ # ----------------------------------------- <br>diff --git a/math/py-numpy1/files/patch-numpy_core_numpy.pc.in b/math/py-numpy1/files/patch-numpy_core_numpy.pc.in <br>new file mode 100644 <br>index 000000000000..58f33ee87633 <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy_core_numpy.pc.in <br>@@ -0,0 +1,10 @@ <br>+--- numpy/core/numpy.pc.in.orig 2026-04-04 00:13:21 UTC <br>++++ numpy/core/numpy.pc.in <br>+@@ -0,0 +1,7 @@ <br>++prefix=${pcfiledir}/../.. <br>++includedir=${prefix}/include <br>++ <br>++Name: numpy <br>++Description: NumPy is the fundamental package for scientific computing with Python. <br>++Version: @version@ <br>++Cflags: -I${includedir} <br>diff --git a/math/py-numpy1/files/patch-numpy_lib_utils.py b/math/py-numpy1/files/patch-numpy_lib_utils.py <br>new file mode 100644 <br>index 000000000000..03914f54522c <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy_lib_utils.py <br>@@ -0,0 +1,35 @@ <br>+--- numpy/lib/utils.py.orig 2024-02-05 21:17:48 UTC <br>++++ numpy/lib/utils.py <br>+@@ -76,18 +76,29 @@ def get_include(): <br>+ """ <br>+ Return the directory that contains the NumPy \\*.h header files. <br>+ <br>+- Extension modules that need to compile against NumPy should use this <br>++ Extension modules that need to compile against NumPy may need to use this <br>+ function to locate the appropriate include directory. <br>+ <br>+ Notes <br>+ ----- <br>+- When using ``distutils``, for example in ``setup.py``:: <br>++ When using ``setuptools``, for example in ``setup.py``:: <br>+ <br>+ import numpy as np <br>+ ... <br>+ Extension('extension_name', ... <br>+- include_dirs=[np.get_include()]) <br>++ include_dirs=[np.get_include()]) <br>+ ... <br>++ <br>++ Note that a CLI tool ``numpy-config`` was introduced in NumPy 2.0, using <br>++ that is likely preferred for build systems other than ``setuptools``:: <br>++ <br>++ $ numpy-config --cflags <br>++ -I/path/to/site-packages/numpy/_core/include <br>++ <br>++ # Or rely on pkg-config: <br>++ $ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir) <br>++ $ pkg-config --cflags <br>++ -I/path/to/site-packages/numpy/_core/include <br>+ <br>+ """ <br>+ import numpy <br>diff --git a/math/py-numpy1/files/patch-numpy_meson.build b/math/py-numpy1/files/patch-numpy_meson.build <br>new file mode 100644 <br>index 000000000000..77cd8dd42fc0 <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy_meson.build <br>@@ -0,0 +1,10 @@ <br>+--- numpy/meson.build.orig 2024-02-05 21:17:48 UTC <br>++++ numpy/meson.build <br>+@@ -215,6 +215,7 @@ python_sources = [ <br>+ '__init__.pxd', <br>+ '__init__.py', <br>+ '__init__.pyi', <br>++ '_configtool.py', <br>+ '_distributor_init.py', <br>+ '_globals.py', <br>+ '_pytesttester.py', <br>diff --git a/math/py-numpy1/files/patch-numpy_tests_test__configtool.py b/math/py-numpy1/files/patch-numpy_tests_test__configtool.py <br>new file mode 100644 <br>index 000000000000..306e0f5f677b <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-numpy_tests_test__configtool.py <br>@@ -0,0 +1,44 @@ <br>+--- numpy/tests/test_configtool.py.orig 2026-04-04 00:20:07 UTC <br>++++ numpy/tests/test_configtool.py <br>+@@ -0,0 +1,41 @@ <br>++import os <br>++import subprocess <br>++import sysconfig <br>++ <br>++import pytest <br>++import numpy as np <br>++ <br>++ <br>++is_editable = not bool(np.__path__) <br>++numpy_in_sitepackages = sysconfig.get_path('platlib') in np.__file__ <br>++# We only expect to have a `numpy-config` available if NumPy was installed via <br>++# a build frontend (and not `spin` for example) <br>++if not (numpy_in_sitepackages or is_editable): <br>++ pytest.skip("`numpy-config` not expected to be installed", <br>++ allow_module_level=True) <br>++ <br>++ <br>++def check_numpyconfig(arg): <br>++ p = subprocess.run(['numpy-config', arg], capture_output=True, text=True) <br>++ p.check_returncode() <br>++ return p.stdout.strip() <br>++ <br>++ <br>++def test_configtool_version(): <br>++ stdout = check_numpyconfig('--version') <br>++ assert stdout == np.__version__ <br>++ <br>++ <br>++def test_configtool_cflags(): <br>++ stdout = check_numpyconfig('--cflags') <br>++ assert stdout.endswith(os.path.join('numpy', 'core', 'include')) <br>++ <br>++ <br>++def test_configtool_pkgconfigdir(): <br>++ stdout = check_numpyconfig('--pkgconfigdir') <br>++ assert stdout.endswith(os.path.join('numpy', 'core', 'lib', 'pkgconfig')) <br>++ <br>++ if not is_editable: <br>++ # Also check that the .pc file actually exists (unless we're using an <br>++ # editable install, then it'll be hiding in the build dir) <br>++ assert os.path.exists(os.path.join(stdout, 'numpy.pc')) <br>diff --git a/math/py-numpy1/files/patch-pyproject.toml b/math/py-numpy1/files/patch-pyproject.toml <br>new file mode 100644 <br>index 000000000000..f26d7ee283c7 <br>--- /dev/null <br>+++ b/math/py-numpy1/files/patch-pyproject.toml <br>@@ -0,0 +1,21 @@ <br>+--- pyproject.toml.orig 2024-02-05 21:17:48 UTC <br>++++ pyproject.toml <br>+@@ -1,8 +1,8 @@ requires = [ <br>+ [build-system] <br>+ build-backend = "mesonpy" <br>+ requires = [ <br>+- "Cython>=0.29.34,<3.1", <br>+- "meson-python>=0.15.0,<0.16.0", <br>++ "Cython>=0.29.34", <br>++ "meson-python>=0.15.0", <br>+ ] <br>+ <br>+ [project] <br>+@@ -43,6 +43,7 @@ f2py = 'numpy.f2py.f2py2e:main' <br>+ <br>+ [project.scripts] <br>+ f2py = 'numpy.f2py.f2py2e:main' <br>++numpy-config = 'numpy._configtool:main' <br>+ <br>+ [project.entry-points.array_api] <br>+ numpy = 'numpy.array_api' <br> <br></blockquote> <br>-- <br>Sincerely, <br>Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD, @fluffy:matrix-dev.freebsd.org) <br>(desktop, kde, x11, office, ports-secteam)@FreeBSD team <br> <br></div></div> </div> </blockquote> </body></html>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4f3f2978-762f-43ec-8507-4c780a316b98>
