diff options
Diffstat (limited to 'sources/pyside6/libpyside')
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 10 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysideinit.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 34c4e3955..1ab5e337e 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -827,12 +827,20 @@ bool registerInternalQtConf() maybeQtConfPath = QDir::toNativeSeparators(maybeQtConfPath); bool executableQtConfAvailable = QFileInfo::exists(maybeQtConfPath); + QString maybeQt6ConfPath = QDir(appDirPath).filePath(u"qt6.conf"_s); + maybeQt6ConfPath = QDir::toNativeSeparators(maybeQt6ConfPath); + bool executableQt6ConfAvailable = QFileInfo::exists(maybeQt6ConfPath); + // Allow disabling the usage of the internal qt.conf. This is necessary for tests to work, // because tests are executed before the package is installed, and thus the Prefix specified // in qt.conf would point to a not yet existing location. bool disableInternalQtConf = qEnvironmentVariableIntValue("PYSIDE_DISABLE_INTERNAL_QT_CONF") > 0; - if (disableInternalQtConf || executableQtConfAvailable) { + bool runsInConda = + qEnvironmentVariableIsSet("CONDA_DEFAULT_ENV") || qEnvironmentVariableIsSet("CONDA_PREFIX"); + + if (!runsInConda && (disableInternalQtConf || executableQtConfAvailable) || + runsInConda && executableQt6ConfAvailable) { registrationAttempted = true; return false; } diff --git a/sources/pyside6/libpyside/pysideinit.h b/sources/pyside6/libpyside/pysideinit.h index 3a8f20158..c623a0d27 100644 --- a/sources/pyside6/libpyside/pysideinit.h +++ b/sources/pyside6/libpyside/pysideinit.h @@ -17,6 +17,9 @@ PYSIDE_API void init(PyObject *module); /// /// This is used in a standalone build, to inform QLibraryInfo of the Qt prefix /// (where Qt libraries are installed) so that plugins can be successfully loaded. +/// +/// This is also used if PySide runs from inside a conda environment to solve +/// conflicts with the qt.conf installed by Anaconda Qt packages. PYSIDE_API bool registerInternalQtConf(); } //namespace PySide |
