diff options
Diffstat (limited to 'QMTest')
-rw-r--r-- | QMTest/TestRuntest.py | 6 | ||||
-rw-r--r-- | QMTest/TestSCons.py | 113 |
2 files changed, 101 insertions, 18 deletions
diff --git a/QMTest/TestRuntest.py b/QMTest/TestRuntest.py index ee33b25..e44cd27 100644 --- a/QMTest/TestRuntest.py +++ b/QMTest/TestRuntest.py @@ -121,9 +121,9 @@ class TestRuntest(TestCommon): apply(TestCommon.__init__, [self], kw) if not noqmtest: - qmtest_py = self.where_is('qmtest.py') - if not qmtest_py: - self.skip_test("Could not find 'qmtest.py'; skipping test(s).\n") + qmtest = self.where_is('qmtest') + if not qmtest: + self.skip_test("Could not find 'qmtest'; skipping test(s).\n") things_to_copy = [ 'runtest.py', diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 6b6f5ed..d5aa057 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -42,9 +42,9 @@ from TestCommon import __all__ # here provides some independent verification that what we packaged # conforms to what we expect. -default_version = '0.97.0' +default_version = '0.98.0' -SConsVersion = '__VERSION__' +SConsVersion = '0.98.0' if SConsVersion == '__' + 'VERSION' + '__': SConsVersion = default_version @@ -139,6 +139,40 @@ def re_escape(str): return str + +try: + sys.version_info +except AttributeError: + # Pre-1.6 Python has no sys.version_info + version_string = string.split(sys.version)[0] + version_ints = map(int, string.split(version_string, '.')) + sys.version_info = tuple(version_ints + ['final', 0]) + +def python_version_string(): + return string.split(sys.version)[0] + +def python_minor_version_string(): + return sys.version[:3] + +def unsupported_python_version(version=sys.version_info): + return version < (1, 5, 2) + +def deprecated_python_version(version=sys.version_info): + return version < (2, 2, 0) + +if deprecated_python_version(): + msg = r""" +scons: warning: Support for pre-2.2 Python (%s) is deprecated. + If this will cause hardship, contact dev@scons.tigris.org. +""" + + deprecated_python_expr = re_escape(msg % python_version_string()) + file_expr + del msg +else: + deprecated_python_expr = "" + + + class TestSCons(TestCommon): """Class for testing SCons. @@ -187,6 +221,21 @@ class TestSCons(TestCommon): kw['match'] = match_exact if not kw.has_key('workdir'): kw['workdir'] = '' + + # Term causing test failures due to bogus readline init + # control character output on FC8 + # TERM can cause test failures due to control chars in prompts etc. + os.environ['TERM'] = 'dumb' + + if deprecated_python_version(): + sconsflags = os.environ.get('SCONSFLAGS') + if sconsflags: + sconsflags = [sconsflags] + else: + sconsflags = [] + sconsflags = sconsflags + ['--warn=no-python-version'] + os.environ['SCONSFLAGS'] = string.join(sconsflags) + apply(TestCommon.__init__, [self], kw) import SCons.Node.FS @@ -381,6 +430,16 @@ class TestSCons(TestCommon): return s + def paths(self,patterns): + import glob + result = [] + for p in patterns: + paths = glob.glob(p) + paths.sort() + result.extend(paths) + return result + + def java_ENV(self, version=None): """ Initialize with a default external environment that uses a local @@ -397,31 +456,55 @@ class TestSCons(TestCommon): env = SCons.Environment.Environment() self._java_env[version] = env - def paths(patterns): - import glob - result = [] - for p in patterns: - paths = glob.glob(p) - paths.sort() - result.extend(paths) - return result if version: patterns = [ + '/usr/java/jdk%s*/bin' % version, '/usr/lib/jvm/*-%s*/bin' % version, '/usr/local/j2sdk%s*/bin' % version, ] - java_path = paths(patterns) + [env['ENV']['PATH']] + java_path = self.paths(patterns) + [env['ENV']['PATH']] else: patterns = [ + '/usr/java/latest/bin', '/usr/lib/jvm/*/bin', '/usr/local/j2sdk*/bin', ] - java_path = paths(patterns) + [env['ENV']['PATH']] + java_path = self.paths(patterns) + [env['ENV']['PATH']] env['ENV']['PATH'] = string.join(java_path, os.pathsep) return env['ENV'] + def java_where_includes(self,version=None): + """ + Return java include paths compiling java jni code + """ + import glob + import sys + if not version: + version='' + jni_dirs = ['/usr/lib/jvm/java-*-sun-%s*/include/jni.h'%version, + '/usr/java/jdk%s*/include/jni.h'%version, + ] + dirs = self.paths(jni_dirs) + if not dirs: + return None + d=os.path.dirname(self.paths(jni_dirs)[0]) + result=[d] + + if sys.platform == 'win32': + result.append(os.path.join(d,'win32')) + elif sys.platform == 'linux2': + result.append(os.path.join(d,'linux')) + return result + + + def java_where_java_home(self,version=None): + import os.path + jar=self.java_where_jar(version) + home=os.path.normpath('%s/..'%jar) + return home + def java_where_jar(self, version=None): ENV = self.java_ENV(version) if self.detect_tool('jar', ENV=ENV): @@ -601,7 +684,7 @@ env = Environment(QTDIR = QTDIR, QT_UIC = r'%s', tools=['default','qt']) dup = 1 -if ARGUMENTS.get('build_dir', 0): +if ARGUMENTS.get('variant_dir', 0): if ARGUMENTS.get('chdir', 0): SConscriptChdir(1) else: @@ -612,7 +695,7 @@ if ARGUMENTS.get('build_dir', 0): env['QT_DEBUG'] = 1 else: builddir = 'build' - BuildDir(builddir, '.', duplicate=dup) + VariantDir(builddir, '.', duplicate=dup) print builddir, dup sconscript = Dir(builddir).File('SConscript') else: @@ -849,7 +932,7 @@ print "self._msvs_versions =", str(env['MSVS']['VERSIONS']) hand-code slicing the right number of characters). """ # see also sys.prefix documentation - return sys.version[:3] + return python_minor_version_string() def get_platform_python(self): """ |