diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-09-29 19:01:51 +0200 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-11-26 20:41:46 +0100 |
| commit | 99e49333432ab2ca7c185f2504e09480ae8de880 (patch) | |
| tree | a666c1eecafe26c741853a724dcaf567584411c4 /build_scripts/main.py | |
| parent | 39f47bc8f61e8986a729a153cba619761bacc280 (diff) | |
setup.py: Don't add the Qt prefix dir to PATH env var before building
Modifying PATH influences which packages are found by CMake's
find_package, as well as which binaries are available to execute
during the CMake build phase.
Instead of relying on PATH, we should rely on passing the detected Qt
prefix dir to CMAKE_PREFIX_PATH.
This makes the build process more robust against differences
in environment variables, as well as ensuring reproducibility
when incrementally rebuilding a project manually without going
through setup.py.
Pick-to: 6.2
Task-number: PYSIDE-1033
Change-Id: I9c36d9924b82cb1133c44f4ef44ca785bbf7e862
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts/main.py')
| -rw-r--r-- | build_scripts/main.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 94ef2b903..dc9e40d6e 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -478,13 +478,12 @@ class PysideBuild(_build, DistUtilsCommandMixin): self.py_scripts_dir = py_scripts_dir self.qtinfo = QtInfo() - qt_dir = os.path.dirname(OPTION["QTPATHS"]) - if OPTION['HAS_QMAKE_OPTION']: - qt_dir = os.path.dirname(OPTION["QMAKE"]) qt_version = get_qt_version() - # Update the PATH environment variable - additional_paths = [self.py_scripts_dir, qt_dir] + # Don't add Qt to PATH env var, we don't want it to interfere + # with CMake's find_package calls which will use + # CMAKE_PREFIX_PATH. + additional_paths = [self.py_scripts_dir] # Add Clang to path for Windows. # Revisit once Clang is bundled with Qt. @@ -876,6 +875,9 @@ class PysideBuild(_build, DistUtilsCommandMixin): if OPTION["PYSIDE_NUMPY_SUPPORT"]: cmake_cmd.append("-DPYSIDE_NUMPY_SUPPORT=1") + target_qt_prefix_path = self.qtinfo.prefix_dir + cmake_cmd.append(f"-DCMAKE_PREFIX_PATH={target_qt_prefix_path}") + if not OPTION["SKIP_CMAKE"]: log.info(f"Configuring module {extension} ({module_src_dir})...") if run_process(cmake_cmd) != 0: |
