aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-01-03 18:32:07 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-05 13:10:48 +0000
commit0258f4d277edbaf9e790fca9b79085a41e18c036 (patch)
tree440582bea04d1c67f005aa48e9153f80d3c2cbfb
parent4ac0760d66d5e59aec688a4f96b3b1e4bd89769f (diff)
build_scripts: Avoid a racing condition in install
On macOS and a custom Python built, the "install" option crashes with an import error. This is a timing problem, because an import is triggered when it is already being processed. The problem is hidden by the use of virtualenv. [ChangeLog][PySide6] The move from distutils to setuptools caused a racing condition with certain Python builds. Change-Id: I4dcda2b083234e88c272a1794388f6d0e7b8f0e5 Fixes: PYSIDE-1760 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 981ffb345928cf740a5b751aaef43a266d077d13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--build_scripts/main.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 82b0f31aa..a69b4fa69 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -62,6 +62,11 @@ from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
from setuptools.command.develop import develop as _develop
from setuptools.command.build_py import build_py as _build_py
+# PYSIDE-1760: Although not used here, pre-load this module early to avoid
+# a racing condition with the import order. Note that this problem
+# happens only with custom builds of Python without virtual environment.
+import setuptools.command.install_scripts
+
from sysconfig import get_config_var
# Use the distutils implementation within setuptools
from setuptools._distutils.errors import DistutilsSetupError