aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-02-26 15:48:30 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2018-03-02 20:34:32 +0000
commitb83eb9e389b0b9501c18dcc123d1957bd7246815 (patch)
tree083055d246dc69fe149292fb1aaae7c6eed34b37 /setup.py
parent6c0a0d70305cd6e12260a352099e74d34f3c239e (diff)
Improve QtInfo class
Previously the class would do a qmake process invocation for each qmake -query property, after this change only a single invocation is done to get all the query properties. In addition another new invocation is done to find all mkspecs variable, in order to find what kind of Qt build is being used: a debug build, release build, or debug_and_release build. This information is useful for packaging purposes, to know which files should be copied or ignored. Change-Id: If1ee4d19e0cc550e40dc568d1256030c8928c4e5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/setup.py b/setup.py
index eb7b1646..8bbbd8ea 100644
--- a/setup.py
+++ b/setup.py
@@ -471,6 +471,18 @@ def prepareSubModules():
print("Submodule %s has branch %s checked out" % (module_name, module_version))
os.chdir(script_dir)
+# Single global instance of QtInfo to be used later in multiple code paths.
+qtinfo = QtInfo(QMAKE_COMMAND)
+
+def get_qt_version():
+ qt_version = qtinfo.version
+
+ if not qt_version:
+ log.error("Failed to query the Qt version with qmake %s" % self.qtinfo.qmake_command)
+ sys.exit(1)
+
+ return qt_version
+
def prepareBuild():
if os.path.isdir(".git") and not OPTION_IGNOREGIT and not OPTION_ONLYPACKAGE and not OPTION_REUSE_BUILD:
prepareSubModules()
@@ -490,24 +502,10 @@ def prepareBuild():
pkg_dir = os.path.join(script_dir, pkg)
os.makedirs(pkg_dir)
# locate Qt sources for the documentation
- qmakeOutput = run_process_output([OPTION_QMAKE, '-query', 'QT_INSTALL_PREFIX/src'])
- if qmakeOutput:
+ qt_src_dir = qtinfo.src_dir
+ if qt_src_dir:
global qtSrcDir
- qtSrcDir = qmakeOutput[0].rstrip()
-
-def get_qt_version(computed_qtinfo = None):
- if not computed_qtinfo:
- qtinfo = QtInfo(QMAKE_COMMAND)
- else:
- qtinfo = computed_qtinfo
-
- qt_version = qtinfo.version
-
- if not qt_version:
- log.error("Failed to query the Qt version with qmake %s" % self.qtinfo.qmake_command)
- sys.exit(1)
-
- return qt_version
+ qtSrcDir = qt_src_dir
class pyside_install(_install):
def __init__(self, *args, **kwargs):
@@ -817,9 +815,9 @@ class pyside_build(_build):
log.error("Failed to locate a dynamic Python library, using %s"
% py_library)
- self.qtinfo = QtInfo(QMAKE_COMMAND)
+ self.qtinfo = qtinfo
qt_dir = os.path.dirname(OPTION_QMAKE)
- qt_version = get_qt_version(self.qtinfo)
+ qt_version = get_qt_version()
# Update the PATH environment variable
update_env_path([py_scripts_dir, qt_dir])