diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-11-07 16:14:11 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-11-15 15:47:09 +0000 |
commit | e455d995be989cbdfef2bcd54fd7057a9b036b52 (patch) | |
tree | 38a2865cb44350696d60fd15cd5b46a9278d17d9 /setup.py | |
parent | 49fb9494ba6589cacda3c9e76fc354650a9fd87e (diff) |
Make standalone installations relocatable
This is achieved by registering a qt.conf file with a Prefix pointing
to a directory relative to the loaded PySide2 module (e.g. QtCore).
Thus Qt does not crash due to not finding platform plugins.
Because this change would affect tests, which are ran before the
PySide package is installed, a new environment variable called
PYSIDE_DISABLE_INTERNAL_QT_CONF is introduced. This variable disables
the registration of the internal qt.conf file, thus it will not point
to a not yet created location, which will allow tests to run as
before.
Change-Id: I5a96037adfafe1f08ea57535aa4a2a0d1660dfaf
Task-number: PYSIDE-558
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -61,6 +61,15 @@ without rebuilding entire PySide2 every time: # Then we create bdist_egg reusing PySide2 build with option --only-package python setup.py bdist_egg --only-package --qmake=c:\Qt\4.8.5\bin\qmake.exe --cmake=c:\tools\cmake\bin\cmake.exe --opnessl=c:\libs\OpenSSL32bit\bin +You can use the option --qt-conf-prefix to pass a path relative to the PySide2 installed package, +which will be embedded into an auto-generated qt.conf registered in the Qt resource system. This +path will serve as the PrefixPath for QLibraryInfo, thus allowing to choose where Qt plugins +should be loaded from. This option overrides the usual prefix chosen by --standalone option, or when +building on Windows. +To temporarily disable registration of the internal qt.conf file, a new environment variable called +PYSIDE_DISABLE_INTERNAL_QT_CONF is introduced. You should assign the integer "1" to disable the +internal qt.conf, or "0" (or leave empty) to keep use the internal qt.conf file. + For development purposes the following options might be of use, when using "setup.py build": --reuse-build option allows recompiling only the modified sources and not the whole world, shortening development iteration time, @@ -241,6 +250,7 @@ OPTION_SKIP_CMAKE = has_option("skip-cmake") OPTION_SKIP_MAKE_INSTALL = has_option("skip-make-install") OPTION_SKIP_PACKAGING = has_option("skip-packaging") OPTION_RPATH_VALUES = option_value("rpath") +OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix") if OPTION_QT_VERSION is None: OPTION_QT_VERSION = "5" @@ -854,6 +864,17 @@ class pyside_build(_build): if self.build_type.lower() == 'debug': cmake_cmd.append("-DPYTHON_DEBUG_LIBRARY=%s" % self.py_library) + if extension.lower() == "pyside2": + pyside_qt_conf_prefix = '' + if OPTION_QT_CONF_PREFIX: + pyside_qt_conf_prefix = OPTION_QT_CONF_PREFIX + else: + if OPTION_STANDALONE: + pyside_qt_conf_prefix = '"Qt"' + if sys.platform == 'win32': + pyside_qt_conf_prefix = '"."' + cmake_cmd.append("-DPYSIDE_QT_CONF_PREFIX=%s" % pyside_qt_conf_prefix) + if extension.lower() == "shiboken2": cmake_cmd.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes") if sys.version_info[0] > 2: |