aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-05-05 12:19:16 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-05-05 18:46:41 +0200
commit36431b071095b8999347df87621bf23ffcc2ac3d (patch)
tree014550c8f87f70320e1fd3a7572fb6ee7969021a
parenta7726c8ccc6e48b03cf33a864b9268e2d3de605d (diff)
Turn off numpy support in libpyside by default
Add a configure parameter for it and mark it as experimental. It has been found to: - break cx_freeeze - Cause embedding applications to fail to load with "undefined symbol: PyExc_RecursionError" Pick-to: 6.1 6.1.0 Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Task-number: PYSIDE-1455 Change-Id: I72fa4a3324a37eb996c42b83dce55fe1990b6fc3 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--build_scripts/main.py3
-rw-r--r--build_scripts/options.py6
-rw-r--r--sources/pyside6/libpyside/CMakeLists.txt6
-rw-r--r--sources/pyside6/tests/QtGui/qpainter_test.py3
4 files changed, 15 insertions, 3 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 0f887a830..b2d0be565 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -878,6 +878,9 @@ class PysideBuild(_build, DistUtilsCommandMixin):
else:
cmake_cmd.append("-DSKIP_DOCS=1")
+ if OPTION["PYSIDE_NUMPY_SUPPORT"]:
+ cmake_cmd.append("-DPYSIDE_NUMPY_SUPPORT=1")
+
if not OPTION["SKIP_CMAKE"]:
log.info(f"Configuring module {extension} ({module_src_dir})...")
if run_process(cmake_cmd) != 0:
diff --git a/build_scripts/options.py b/build_scripts/options.py
index ec61fe0db..6971c188e 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -220,7 +220,9 @@ class DistUtilsCommandMixin(object):
('rpath=', None, 'RPATH'),
('qt-conf-prefix=', None, 'Qt configuration prefix'),
('qt-src-dir=', None, 'Qt source directory'),
- ('no-qt-tools', None, 'Do not copy the Qt tools')]
+ ('no-qt-tools', None, 'Do not copy the Qt tools'),
+ ('pyside-numpy-support', None, 'libpyside: Add (experimental) numpy support')
+ ]
def __init__(self):
self.avoid_protected_hack = False
@@ -258,6 +260,7 @@ class DistUtilsCommandMixin(object):
self.qt_conf_prefix = None
self.qt_src_dir = None
self.no_qt_tools = False
+ self.pyside_numpy_support = False
def mixin_finalize_options(self):
# Bail out on 2nd call to mixin_finalize_options() since that is the
@@ -309,6 +312,7 @@ class DistUtilsCommandMixin(object):
OPTION['QT_CONF_PREFIX'] = self.qt_conf_prefix
OPTION['QT_SRC'] = self.qt_src_dir
OPTION['NO_QT_TOOLS'] = self.no_qt_tools
+ OPTION['PYSIDE_NUMPY_SUPPORT'] = self.pyside_numpy_support
def _determine_defaults_and_check(self):
if not self.cmake:
diff --git a/sources/pyside6/libpyside/CMakeLists.txt b/sources/pyside6/libpyside/CMakeLists.txt
index 78be0c082..90f333e5d 100644
--- a/sources/pyside6/libpyside/CMakeLists.txt
+++ b/sources/pyside6/libpyside/CMakeLists.txt
@@ -95,10 +95,14 @@ target_include_directories(pyside6 PUBLIC
$<INSTALL_INTERFACE:include/PySide6>
)
-if (NOT "${NUMPY_INCLUDE_DIR}" STREQUAL "")
+if (PYSIDE_NUMPY_SUPPORT AND NOT "${NUMPY_INCLUDE_DIR}" STREQUAL "")
+ message(STATUS "Enabling experimental numpy support in libpyside.")
target_include_directories(pyside6 PRIVATE ${NUMPY_INCLUDE_DIR})
target_compile_definitions(pyside6 PRIVATE -DHAVE_NUMPY
PRIVATE -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
+
+else()
+ message(STATUS "Disabled experimental numpy support in libpyside.")
endif()
target_link_libraries(pyside6
diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py
index 2a9db8598..a099e9df8 100644
--- a/sources/pyside6/tests/QtGui/qpainter_test.py
+++ b/sources/pyside6/tests/QtGui/qpainter_test.py
@@ -116,7 +116,8 @@ class QPainterDrawText(UsesQGuiApplication):
QPoint(20.0, 10.0),
QPoint(80.0, 30.0),
QPoint(90.0, 70.0)])
- if HAVE_NUMPY:
+ # FIXME: Activate once libpyside numpy support is on by default
+ if False and HAVE_NUMPY:
x = np.array([10.0, 20.0, 80.0, 90.0])
y = np.array([80.0, 10.0, 30.0, 70.0])
self.painter.drawPointsNp(x, y)