aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-05-14 11:21:46 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-05-14 12:13:06 +0000
commit8689054da961be4cede5cfae7c6a6f9d6efc36a4 (patch)
tree55b9bf05e77066199ab335fde4a1890aee1f956b
parentde29b5ddca038393256a1cdc4a3e7c1eee129d2d (diff)
Fix pyi generation on Windows
When trying to generate the pyi files on Windows, the python modules failed to be imported due to Qt dlls not being in PATH. This happened because we overrode PATH instead of prepending to it. When generating pyi files on Windows, make sure to prepend new values to PATH while also keeping the old values. Amends 97df448edbc035a2f531508a5cfe5739fb2de18d Change-Id: I74c374c3a9687169dd4af0ed232bda76a0267fc4 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index cbf401102..77dc8c8ac 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -169,6 +169,19 @@ macro(create_pyside_module)
set(ld_prefix "LD_LIBRARY_PATH=")
endif()
set(ld_prefix "${ld_prefix}${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}")
+
+ # On Windows we also need to propagate the whole environment PATH value, because pyside modules
+ # import Qt, and the Qt modules are found from PATH.
+ if(WIN32)
+ # Get the value of PATH with CMake separators.
+ file(TO_CMAKE_PATH "$ENV{PATH}" path_value)
+
+ # Replace the CMake list separators with "\;"s, to avoid the PATH values being
+ # interpreted as CMake list elements, we actually want to pass the whole string separated
+ # by ";" to the command line.
+ make_path(path_value "${path_value}")
+ string(APPEND ld_prefix "${PATH_SEP}${path_value}")
+ endif()
set(generate_pyi_options run --skip --sys-path
"${pysidebindings_BINARY_DIR}"
"${SHIBOKEN_PYTHON_MODULE_DIR}")