28081ef832
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
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
--- 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()
|