From b4b53735454798b6d32842e65d119bbb8588fc7c Mon Sep 17 00:00:00 2001 From: Alexander Magola Date: Mon, 31 Jan 2022 19:22:25 +0700 Subject: [PATCH] enable env vars QT5_ROOT, QT5_BINDIR, QT5_LIBDIR, QT5_INCLUDES #31 --- src/zenmake/zm/features/qt5.py | 30 ++++++++++++++++++++++++++---- src/zenmake/zm/features/test.py | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/zenmake/zm/features/qt5.py b/src/zenmake/zm/features/qt5.py index 07b182b8..d0c29bbc 100644 --- a/src/zenmake/zm/features/qt5.py +++ b/src/zenmake/zm/features/qt5.py @@ -17,22 +17,22 @@ import os -from waflib import Errors as waferror, Options +from waflib import Errors as waferror from waflib.Task import Task from waflib.TaskGen import feature, before, after from waflib.Tools import qt5 from zm.constants import PLATFORM -from zm import error, utils, cli +from zm import error, utils from zm.features import precmd, postcmd from zm.pathutils import getNativePath, getNodesFromPathsConf -from zm.waf.assist import allowTGenAttrs +from zm.waf import assist from zm.waf.taskgen import isolateExtHandler _relpath = os.path.relpath _commonpath = os.path.commonpath # Allow the 'moc' param for Waf taskgen instances -allowTGenAttrs(['moc']) +assist.allowTGenAttrs(['moc']) # Isolate existing extension handlers to avoid conflicts with other tools # and to avoid use of tools in tasks where these tools are inappropriate. @@ -50,6 +50,28 @@ QRC_LINE_TEMPL = """ %s""" +QT5_SYSENV_VARS = ('QT5_ROOT', 'QT5_BINDIR', 'QT5_LIBDIR', 'QT5_INCLUDES') + +def _wrapMonEnvVarGetter(origFunc): + def execute(): + return origFunc() + QT5_SYSENV_VARS + execute.__doc__ = origFunc.__doc__ + return execute + +assist.getMonitoredEnvVarNames = _wrapMonEnvVarGetter(assist.getMonitoredEnvVarNames) + +@postcmd('init') +def postInit(_): + """ Extra init after wscript.init """ + + # Prevent impact on Waf code: ZenMake uses QT5_BINDIR instead of QT5_BIN + os.environ.pop('QT5_BIN', None) + + # adjust QT5_BINDIR to Waf code + qtbindir = os.environ.get('QT5_BINDIR') + if qtbindir: + os.environ['QT5_BIN'] = qtbindir + def _configureQt5(conf): """ Alternative version of 'configure' from waflib.Tools.qt5 diff --git a/src/zenmake/zm/features/test.py b/src/zenmake/zm/features/test.py index 9c435a24..dfa36083 100644 --- a/src/zenmake/zm/features/test.py +++ b/src/zenmake/zm/features/test.py @@ -60,6 +60,7 @@ def execute(*args, **kwargs): testsConfigured = zmMetaConf.attrs.get('tests-configured', False) return not testsConfigured + execute.__doc__ = _needToConfigure.__doc__ return execute assist.needToConfigure = _wrapNeedToConfigure(assist.needToConfigure)