diff options
author | Friedemann Kleint <[email protected]> | 2021-04-15 15:27:49 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2021-04-21 13:19:58 +0200 |
commit | 4cde4075f97fc9f8d349591291289127666b35e5 (patch) | |
tree | 98a36dcfac8e46b11dfc27d38fcf33a8a5c41193 /build_scripts/utils.py | |
parent | 3506158551488788450498f9b4ffe86375172fea (diff) |
Build system: Make numpy centrally available
In order to be able to use numpy in PySide6 modules
besides libshiboken, move the numpy detection into the
build scripts and pass it as a CMake variable.
Task-number: PYSIDE-1540
Task-number: PYSIDE-1503
Change-Id: Ib30fdbab83904878286b7eaae1674ffba0f2febd
Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'build_scripts/utils.py')
-rw-r--r-- | build_scripts/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py index d80e59a3d..0a9036905 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -38,6 +38,7 @@ ############################################################################# import sys +from pathlib import Path import os import re import stat @@ -83,6 +84,15 @@ def update_env_path(newpaths): os.environ['PATH'] = f"{path}{os.pathsep}{os.environ['PATH']}" +def get_numpy_location(): + for p in sys.path: + if 'site-' in p: + numpy = Path(p).resolve() / 'numpy' + if numpy.is_dir(): + return os.fspath(numpy / 'core' / 'include') + return None + + def winsdk_setenv(platform_arch, build_type): from distutils.msvc9compiler import VERSION as MSVC_VERSION from distutils.msvc9compiler import Reg |