summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-04-25 19:44:24 (GMT)
committerMats Wichmann <mats@linux.com>2019-04-25 19:44:24 (GMT)
commit0e84c296d686e4384c8e6f5137a7c15e51dcb167 (patch)
treec4e043cd046190eaa7d2d6a72a5f87cc85aa23cf
parentf3c5ac37a96adc91d688d17a9ad462a95d32587c (diff)
downloadSCons-0e84c296d686e4384c8e6f5137a7c15e51dcb167.zip
SCons-0e84c296d686e4384c8e6f5137a7c15e51dcb167.tar.gz
SCons-0e84c296d686e4384c8e6f5137a7c15e51dcb167.tar.bz2
[PR #3345] fix a few more Py3.8 problems
Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r--src/engine/SCons/Conftest.py4
-rw-r--r--src/engine/SCons/Tool/qt.py13
-rw-r--r--test/QT/qt_warnings.py4
-rw-r--r--test/packaging/rpm/package.py2
-rw-r--r--testing/framework/TestSCons.py24
5 files changed, 27 insertions, 20 deletions
diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py
index 84aa992..67a5a67 100644
--- a/src/engine/SCons/Conftest.py
+++ b/src/engine/SCons/Conftest.py
@@ -704,7 +704,7 @@ def CheckProg(context, prog_name):
#
def _YesNoResult(context, ret, key, text, comment = None):
- """
+ r"""
Handle the result of a test with a "yes" or "no" result.
:Parameters:
@@ -723,7 +723,7 @@ def _YesNoResult(context, ret, key, text, comment = None):
def _Have(context, key, have, comment = None):
- """
+ r"""
Store result of a test in context.havedict and context.headerfilename.
:Parameters:
diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py
index b8cf77a..685a9a0 100644
--- a/src/engine/SCons/Tool/qt.py
+++ b/src/engine/SCons/Tool/qt.py
@@ -66,11 +66,17 @@ if SCons.Util.case_sensitive_suffixes('.h', '.H'):
cxx_suffixes = cplusplus.CXXSuffixes
-#
def find_platform_specific_qt_paths():
"""
- If the platform has non-standard paths which it installs QT in,return the likely default path
- :return:
+ find non-standard QT paths
+
+ If the platform does not put QT tools in standard search paths,
+ the path is expected to be set using QTDIR. SCons violates
+ the normal rule of not pulling from the user's environment
+ in this case. However, some test cases try to validate what
+ happens when QTDIR is unset, so we need to try to make a guess.
+
+ :return: a guess at a path
"""
# qt_bin_dirs = []
@@ -83,6 +89,7 @@ def find_platform_specific_qt_paths():
# Centos installs QT under /usr/{lib,lib64}/qt{4,5,-3.3}/bin
# so we need to handle this differently
# qt_bin_dirs = glob.glob('/usr/lib64/qt*/bin')
+ # TODO: all current Fedoras do the same, need to look deeper here.
qt_bin_dir = '/usr/lib64/qt-3.3/bin'
return qt_bin_dir
diff --git a/test/QT/qt_warnings.py b/test/QT/qt_warnings.py
index 23612de..020333e 100644
--- a/test/QT/qt_warnings.py
+++ b/test/QT/qt_warnings.py
@@ -84,8 +84,8 @@ if moc:
qtdir = os.path.dirname(os.path.dirname(moc))
qtdir = qtdir.replace('\\', '\\\\' )
- expect = \
-r"""scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%s\)
+ expect = r"""
+scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%s\)
File "%s", line \d+, in (\?|<module>)
""" % (qtdir, re.escape(SConstruct_path))
else:
diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py
index ddd3c89..23ebe05 100644
--- a/test/packaging/rpm/package.py
+++ b/test/packaging/rpm/package.py
@@ -86,7 +86,7 @@ test.must_not_exist( 'bin/main' )
with os.popen('rpm -qpl %s' % machine_rpm) as p:
out = p.read()
test.must_contain_all_lines(out, '/bin/main')
-with os.popen('rpm -qpl %s' % machine_rpm) as p:
+with os.popen('rpm -qpl %s' % src_rpm) as p:
out = p.read()
test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py
index 23b3416..907eac7 100644
--- a/testing/framework/TestSCons.py
+++ b/testing/framework/TestSCons.py
@@ -949,7 +949,7 @@ class TestSCons(TestCommon):
def Qt_dummy_installation(self, dir='qt'):
# create a dummy qt installation
- self.subdir( dir, [dir, 'bin'], [dir, 'include'], [dir, 'lib'] )
+ self.subdir(dir, [dir, 'bin'], [dir, 'include'], [dir, 'lib'])
self.write([dir, 'bin', 'mymoc.py'], """\
import getopt
@@ -960,11 +960,11 @@ cmd_opts, args = getopt.getopt(sys.argv[1:], 'io:wz', [])
impl = 0
opt_string = ''
for opt, arg in cmd_opts:
- if opt == '-o': out = arg
+ if opt == '-o': outfile = arg
elif opt == '-i': impl = 1
else: opt_string = opt_string + ' ' + opt
-with open(out, 'w') as ofp:
+with open(outfile, 'w') as ofp:
ofp.write("/* mymoc.py%s */\\n" % opt_string)
for a in args:
with open(a, 'r') as ifp:
@@ -972,7 +972,7 @@ with open(out, 'w') as ofp:
a = a.replace('\\\\', '\\\\\\\\')
subst = r'{ my_qt_symbol( "' + a + '\\\\n" ); }'
if impl:
- contents = re.sub( r'#include.*', '', contents )
+ contents = re.sub(r'#include.*', '', contents)
ofp.write(contents.replace('Q_OBJECT', subst))
sys.exit(0)
""")
@@ -988,7 +988,7 @@ source = None
opt_string = ''
for arg in sys.argv[1:]:
if output_arg:
- out = arg
+ outfile = arg
output_arg = 0
elif impl_arg:
impl = arg
@@ -1004,17 +1004,17 @@ for arg in sys.argv[1:]:
sys.exit(1)
source = sourceFile = arg
-with open(out, 'w') as ofp, open(source, 'r') as ifp:
+with open(outfile, 'w') as ofp, open(source, 'r') as ifp:
ofp.write("/* myuic.py%s */\\n" % opt_string)
if impl:
- ofp.write( '#include "' + impl + '"\\n' )
+ ofp.write('#include "' + impl + '"\\n')
includes = re.findall('<include.*?>(.*?)</include>', ifp.read())
for incFile in includes:
# this is valid for ui.h files, at least
if os.path.exists(incFile):
ofp.write('#include "' + incFile + '"\\n')
else:
- ofp.write( '#include "my_qobject.h"\\n' + ifp.read() + " Q_OBJECT \\n" )
+ ofp.write('#include "my_qobject.h"\\n' + ifp.read() + " Q_OBJECT \\n")
sys.exit(0)
""" )
@@ -1027,7 +1027,7 @@ void my_qt_symbol(const char *arg);
#include "../include/my_qobject.h"
#include <stdio.h>
void my_qt_symbol(const char *arg) {
- fputs( arg, stdout );
+ fputs(arg, stdout);
}
""")
@@ -1035,9 +1035,9 @@ void my_qt_symbol(const char *arg) {
env = Environment()
import sys
if sys.platform == 'win32':
- env.StaticLibrary( 'myqt', 'my_qobject.cpp' )
+ env.StaticLibrary('myqt', 'my_qobject.cpp')
else:
- env.SharedLibrary( 'myqt', 'my_qobject.cpp' )
+ env.SharedLibrary('myqt', 'my_qobject.cpp')
""")
self.run(chdir = self.workpath(dir, 'lib'),
@@ -1080,7 +1080,7 @@ if ARGUMENTS.get('variant_dir', 0):
else:
sconscript = File('SConscript')
Export("env dup")
-SConscript( sconscript )
+SConscript(sconscript)
""" % (self.QT, self.QT_LIB, self.QT_MOC, self.QT_UIC))