From a4c586aaf7d453c6f202ec1c026fdacb4f9eb9c8 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 1 Mar 2023 07:51:25 -0700 Subject: Update PR 4305: failing stub qt tool Proposed addition of code to cause stub qt to fail, and test/import.py to detect this situation. Unfortunately, it doesn't seem to work... needs adjustment. Doc updates to record rename version. Signed-off-by: Mats Wichmann --- SCons/Tool/qt.py | 9 ++++-- SCons/Tool/qt3.xml | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++- test/import.py | 27 ++++++++++-------- 3 files changed, 102 insertions(+), 16 deletions(-) diff --git a/SCons/Tool/qt.py b/SCons/Tool/qt.py index 8e34eb7..607b58d 100644 --- a/SCons/Tool/qt.py +++ b/SCons/Tool/qt.py @@ -25,11 +25,14 @@ This is a fake tool to instruct any builds still referencing 'qt' instead of the new 'qt3' or a newer QT builder how to fix their now broken build. """ -import SCons.Warnings +import SCons.Errors def generate(env): - pass + raise SCons.Errors.UserError( + "Deprecated tool 'qt' renamed to 'qt3'. " + "Please update your build accordingly. " + "'qt3' will be removed entirely in a future release." + ) def exists(env): return False - diff --git a/SCons/Tool/qt3.xml b/SCons/Tool/qt3.xml index 306b53c..445751b 100644 --- a/SCons/Tool/qt3.xml +++ b/SCons/Tool/qt3.xml @@ -32,7 +32,9 @@ Sets &consvars; for building Qt3 applications. This tool is only suitable for building targeted to Qt3, which is obsolete -(the tool is deprecated since 4.3). +(the tool is deprecated since 4.3, +and was renamed to qt3 in 4.5.0. +). There are contributed tools for Qt4 and Qt5, see https://github.com/SCons/scons-contrib. @@ -195,6 +197,9 @@ If not already set, os.environ; if not found there, it tries to make a guess. + +Changed in 4.5.0: renamed from QTDIR. + @@ -204,6 +209,9 @@ if not found there, it tries to make a guess. Turn off scanning for mocable files. Use the &b-link-Moc; Builder to explicitly specify files to run moc on. + +Changed in 4.5.0: renamed from QT_AUTOSCAN. + @@ -213,6 +221,9 @@ specify files to run moc on. The path where the Qt binaries are installed. The default value is '&cv-link-QT3DIR;/bin'. + +Changed in 4.5.0: renamed from QT_BINPATH. + @@ -225,6 +236,9 @@ Note: If you set this variable to None, the tool won't change the &cv-link-CPPPATH; construction variable. + +Changed in 4.5.0: renamed from QT_CPPPATH. + @@ -233,6 +247,9 @@ construction variable. Prints lots of debugging information while scanning for moc files. + +Changed in 4.5.0: renamed from QT_DEBUG. + @@ -244,6 +261,9 @@ You may want to set this to 'qt-mt'. Note: If you set this variable to None, the tool won't change the &cv-link-LIBS; variable. + +Changed in 4.5.0: renamed from QT_LIB. + @@ -256,6 +276,9 @@ Note: If you set this variable to None, the tool won't change the &cv-link-LIBPATH; construction variable. + +Changed in 4.5.0: renamed from QT_LIBPATH. + @@ -282,6 +305,9 @@ Prefix for moc output files when source is a C++ file. Default value is '.moc'. Suffix for moc output files when source is a C++ file. + +Changed in 4.5.0: renamed from QT_MOCCXXSUFFIX. + @@ -291,6 +317,9 @@ Suffix for moc output files when source is a C++ file. Default value is '-i'. These flags are passed to moc when moccing a C++ file. + +Changed in 4.5.0: renamed from QT_MOCFROMCXXFLAGS. + @@ -299,6 +328,9 @@ These flags are passed to moc when moccing a C++ file. Command to generate a moc file from a C++ file. + +Changed in 4.5.0: renamed from QT_MOCFROMCXXCOM. + @@ -308,6 +340,9 @@ Command to generate a moc file from a C++ file. The string displayed when generating a moc file from a C++ file. If this is not set, then &cv-link-QT3_MOCFROMCXXCOM; (the command line) is displayed. + +Changed in 4.5.0: renamed from QT_MOCFROMCXXCOMSTR. + @@ -316,6 +351,9 @@ If this is not set, then &cv-link-QT3_MOCFROMCXXCOM; (the command line) is displ Command to generate a moc file from a header. + +Changed in 4.5.0: renamed from QT_MOCFROMSHCOM. + @@ -325,6 +363,9 @@ Command to generate a moc file from a header. The string displayed when generating a moc file from a C++ file. If this is not set, then &cv-link-QT3_MOCFROMHCOM; (the command line) is displayed. + +Changed in 4.5.0: renamed from QT_MOCFROMSHCOMSTR. + @@ -334,6 +375,9 @@ If this is not set, then &cv-link-QT3_MOCFROMHCOM; (the command line) is display Default value is ''. These flags are passed to moc when moccing a header file. + +Changed in 4.5.0: renamed from QT_MOCFROMSHFLAGS. + @@ -343,6 +387,9 @@ when moccing a header file. Default value is 'moc_'. Prefix for moc output files when source is a header. + +Changed in 4.5.0: renamed from QT_MOCHPREFIX. + @@ -352,6 +399,9 @@ Prefix for moc output files when source is a header. Default value is '&cv-link-CXXFILESUFFIX;'. Suffix for moc output files when source is a header. + +Changed in 4.5.0: renamed from QT_MOCHSUFFIX. + @@ -360,6 +410,9 @@ Suffix for moc output files when source is a header. Default value is '&cv-link-QT3_BINPATH;/uic'. + +Changed in 4.5.0: renamed from QT_UIC. + @@ -368,6 +421,9 @@ Default value is '&cv-link-QT3_BINPATH;/uic'. Command to generate header files from .ui files. + +Changed in 4.5.0: renamed from QT_UICCOM. + @@ -377,6 +433,9 @@ Command to generate header files from .ui files. The string displayed when generating header files from .ui files. If this is not set, then &cv-link-QT3_UICCOM; (the command line) is displayed. + +Changed in 4.5.0: renamed from QT_UICCOMSTR. + @@ -386,6 +445,9 @@ If this is not set, then &cv-link-QT3_UICCOM; (the command line) is displayed. Default value is ''. These flags are passed to uic when creating a header file from a .ui file. + +Changed in 4.5.0: renamed from QT_UICDECLFLAGS. + @@ -395,6 +457,9 @@ when creating a header file from a .ui file. Default value is ''. Prefix for uic generated header files. + +Changed in 4.5.0: renamed from QT_UICDECLPREFIX. + @@ -404,6 +469,9 @@ Prefix for uic generated header files. Default value is '.h'. Suffix for uic generated header files. + +Changed in 4.5.0: renamed from QT_UICDECLSUFFIX. + @@ -414,6 +482,9 @@ Default value is ''. These flags are passed to uic when creating a C++ file from a .ui file. + +Changed in 4.5.0: renamed from QT_UICIMPFLAGS. + @@ -423,6 +494,9 @@ file from a .ui file. Default value is 'uic_'. Prefix for uic generated implementation files. + +Changed in 4.5.0: renamed from QT_UICIMPLPREFIX. + @@ -432,6 +506,9 @@ Prefix for uic generated implementation files. Default value is '&cv-link-CXXFILESUFFIX;'. Suffix for uic generated implementation files. + +Changed in 4.5.0: renamed from QT_UICIMPLSUFFIX. + @@ -441,6 +518,9 @@ files. Default value is '.ui'. Suffix of designer input files. + +Changed in 4.5.0: renamed from QT_UISUFFIX. + diff --git a/test/import.py b/test/import.py index 997e6c4..037508d 100644 --- a/test/import.py +++ b/test/import.py @@ -128,23 +128,26 @@ if moc: import os.path qtdir = os.path.dirname(os.path.dirname(moc)) - - qt_err = r""" -scons: warning: Could not detect qt3, using moc executable as a hint \(QT3DIR=%(qtdir)s\) -""" % locals() - + qt3_err = fr""" +scons: warning: Could not detect qt3, using moc executable as a hint \(QT3DIR={qtdir}\) +""" else: - - qt_err = """ + qt3_err = r""" scons: warning: Could not detect qt3, using empty QT3DIR """ -qt_warnings = [ re.compile(qt_err + TestSCons.file_expr) ] +qt_moved = r""" +scons: \*\*\* Deprecated tool 'qt' has moved to 'qt3'. Please update your build accordingly. 'qt3' will be removed entirely in a future release. +""" + +qt3_warnings = [re.compile(qt3_err + TestSCons.file_expr)] +qt_error = [re.compile(qt_moved + TestSCons.file_expr)] error_output = { - 'icl' : intel_warnings, - 'intelc' : intel_warnings, - 'qt3' : qt_warnings, + 'icl': intel_warnings, + 'intelc': intel_warnings, + 'qt3': qt3_warnings, + 'qt': qt_error, } # An SConstruct for importing Tool names that have illegal characters @@ -187,7 +190,7 @@ for tool in tools: matched = 1 break if not matched: - print("Failed importing '%s', stderr:" % tool) + print(f"Failed importing '{tool}', stderr:") print(stderr) failures.append(tool) -- cgit v0.12 From 5e9e2eb6fced85e8cc59d1fcaa9ecb10b2d8f5aa Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 1 Mar 2023 14:00:43 -0700 Subject: test/import works on dummy qt tool now Signed-off-by: Mats Wichmann --- test/import.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/import.py b/test/import.py index 037508d..50d7b21 100644 --- a/test/import.py +++ b/test/import.py @@ -137,7 +137,7 @@ scons: warning: Could not detect qt3, using empty QT3DIR """ qt_moved = r""" -scons: \*\*\* Deprecated tool 'qt' has moved to 'qt3'. Please update your build accordingly. 'qt3' will be removed entirely in a future release. +scons: \*\*\* Deprecated tool 'qt' renamed to 'qt3'. Please update your build accordingly. 'qt3' will be removed entirely in a future release. """ qt3_warnings = [re.compile(qt3_err + TestSCons.file_expr)] @@ -181,9 +181,9 @@ for tool in tools: test.write('SConstruct', indirect_import % locals()) else: test.write('SConstruct', direct_import % locals()) - test.run(stderr=None) + test.run(stderr=None, status=None) stderr = test.stderr() - if stderr: + if stderr or test.status: matched = None for expression in error_output.get(tool, []): if expression.match(stderr): -- cgit v0.12