aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-03-28 19:17:11 +0200
committerChristian Tismer <tismer@stackless.com>2021-04-07 11:00:57 +0200
commit817fae35a8669f16e6442b9d416c5578bb14285c (patch)
treef4b9ddb2a76dc3dc345605fa387cbb10b9293e9d /examples
parente641c225d2954cfc5c85e00eda83f5319c84b3c8 (diff)
wheel_tester: Enable it again for Qt >= 6 with Nuitka
With the usage of nuitka, we have a working compiled test, again. Only the scriptableapplication fails, and only for CMake. This will be fixed in another check-in. The PyInstaller test remains in the code for being re-enabled. Task-number: PYSIDE-1523 Change-Id: Ic831fa5b110bbff4150a01cb8a7344ae050aae02 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/installer_test/hello.py15
-rw-r--r--examples/scriptableapplication/CMakeLists.txt2
-rw-r--r--examples/widgetbinding/CMakeLists.txt2
3 files changed, 12 insertions, 7 deletions
diff --git a/examples/installer_test/hello.py b/examples/installer_test/hello.py
index 7a8811158..f8434133e 100644
--- a/examples/installer_test/hello.py
+++ b/examples/installer_test/hello.py
@@ -46,10 +46,10 @@ hello.py
This simple script shows a label with changing "Hello World" messages.
It can be used directly as a script, but we use it also to automatically
-test PyInstaller. See testing/wheel_tester.py .
+test PyInstaller or Nuitka. See testing/wheel_tester.py .
-When used with PyInstaller, it automatically stops its execution after
-2 seconds.
+When compiled with Nuitka or used with PyInstaller, it automatically
+stops its execution after 2 seconds.
"""
import sys
@@ -61,6 +61,11 @@ from PySide6.QtWidgets import (QApplication, QLabel, QPushButton,
QVBoxLayout, QWidget)
from PySide6.QtCore import Slot, Qt, QTimer
+is_compiled = "__compiled__" in globals() # Nuitka
+uses_embedding = sys.pyside_uses_embedding # PyInstaller
+auto_quit = "Nuitka" if is_compiled else "PyInst" if uses_embedding else False
+
+
class MyWidget(QWidget):
def __init__(self):
QWidget.__init__(self)
@@ -69,7 +74,7 @@ class MyWidget(QWidget):
"Hola Mundo", "Привет мир"]
self.button = QPushButton("Click me!")
- self.text = QLabel("Hello World embedded={}".format(sys.pyside_uses_embedding))
+ self.text = QLabel("Hello World auto_quit={}".format(auto_quit))
self.text.setAlignment(Qt.AlignCenter)
self.layout = QVBoxLayout()
@@ -94,7 +99,7 @@ if __name__ == "__main__":
widget = MyWidget()
widget.resize(800, 600)
widget.show()
- if sys.pyside_uses_embedding:
+ if auto_quit:
milliseconds = 2 * 1000 # run 2 second
QTimer.singleShot(milliseconds, app.quit)
retcode = app.exec_()
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index 9e306cdd4..63b70c5da 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -74,7 +74,7 @@ endforeach()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)
if (QtCore_is_framework)
- get_target_property(qt_core_library_location Qt5::Core LOCATION)
+ get_target_property(qt_core_library_location Qt6::Core LOCATION)
get_filename_component(qt_core_library_location_dir "${qt_core_library_location}" DIRECTORY)
get_filename_component(lib_dir "${qt_core_library_location_dir}/../" ABSOLUTE)
list(APPEND INCLUDES "--framework-include-paths=${lib_dir}")
diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt
index 3b6a645ff..e601a3579 100644
--- a/examples/widgetbinding/CMakeLists.txt
+++ b/examples/widgetbinding/CMakeLists.txt
@@ -126,7 +126,7 @@ endforeach()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)
if (QtCore_is_framework)
- get_target_property(qt_core_library_location Qt5::Core LOCATION)
+ get_target_property(qt_core_library_location Qt6::Core LOCATION)
get_filename_component(qt_core_library_location_dir "${qt_core_library_location}" DIRECTORY)
get_filename_component(lib_dir "${qt_core_library_location_dir}/../" ABSOLUTE)
list(APPEND INCLUDES "--framework-include-paths=${lib_dir}")