summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordirkbaechle <devnull@localhost>2012-09-27 22:35:09 (GMT)
committerdirkbaechle <devnull@localhost>2012-09-27 22:35:09 (GMT)
commita6d1f2c5f7282a4c25bc20059054cbc0a6d9a688 (patch)
tree1781448eb906652d808ea4bf50fdda4312fe23c1
parentedbb8113bf8737e7bc77a4f23d7fd41a44dca5a6 (diff)
downloadSCons-a6d1f2c5f7282a4c25bc20059054cbc0a6d9a688.zip
SCons-a6d1f2c5f7282a4c25bc20059054cbc0a6d9a688.tar.gz
SCons-a6d1f2c5f7282a4c25bc20059054cbc0a6d9a688.tar.bz2
- several smaller fixes to get all tests running under Buildbot again
-rw-r--r--QMTest/TestSCons.py71
-rw-r--r--runtest.py4
-rw-r--r--src/engine/MANIFEST.in1
-rw-r--r--src/engine/SCons/Platform/win32.py54
-rw-r--r--src/engine/SCons/Tool/msvsTests.py2
-rw-r--r--src/engine/SCons/Tool/packaging/rpm.py12
-rw-r--r--src/engine/SCons/Tool/rpmutils.py533
-rw-r--r--src/engine/SCons/Tool/xgettext.py5
-rw-r--r--test/Fortran/FORTRAN.py2
-rw-r--r--test/Subst/TypeError.py2
-rw-r--r--test/VariantDir/VariantDir.py2
-rw-r--r--test/dependency-cycle.py4
-rw-r--r--test/explain/basic.py16
-rw-r--r--test/import.py4
-rw-r--r--test/packaging/rpm/multipackage.py12
-rw-r--r--test/packaging/rpm/package.py8
-rw-r--r--test/packaging/rpm/tagging.py8
17 files changed, 640 insertions, 100 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index de4a39b..296af67 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -6,7 +6,7 @@ A TestSCons environment object is created via the usual invocation:
test = TestSCons()
-TestScons is a subclass of TestCommon, which is in turn is a subclass
+TestScons is a subclass of TestCommon, which in turn is a subclass
of TestCmd), and hence has available all of the methods and attributes
from those classes, as well as any overridden or additional methods or
attributes defined in this subclass.
@@ -26,6 +26,9 @@ import time
from TestCommon import *
from TestCommon import __all__
+from TestCmd import Popen
+from TestCmd import PIPE
+
# Some tests which verify that SCons has been packaged properly need to
# look for specific version file names. Replicating the version number
# here provides some independent verification that what we packaged
@@ -85,35 +88,6 @@ lib_ = lib_prefix
_dll = dll_suffix
dll_ = dll_prefix
-def gccFortranLibs():
- """Test which gcc Fortran startup libraries are required.
- This should probably move into SCons itself, but is kind of hacky.
- """
-
- libs = ['g2c']
- cmd = 'gcc -v'
-
- try:
- import subprocess
- except ImportError:
- try:
- import popen2
- stderr = popen2.popen3(cmd)[2].read()
- except OSError:
- return libs
- else:
- p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
- stderr = p.stderr.read()
- m = re.search('gcc version (\d\.\d)', stderr)
- if m:
- gcc_version = m.group(1)
- if re.match('4.[^0]', gcc_version):
- libs = ['gfortranbegin']
- elif gcc_version in ('3.1', '4.0'):
- libs = ['frtbegin'] + libs
-
- return libs
-
if sys.platform == 'cygwin':
# On Cygwin, os.path.normcase() lies, so just report back the
@@ -125,16 +99,6 @@ else:
return (os.path.normcase(s1) != os.path.normcase(s2))
-if sys.platform == 'win32':
- fortran_lib = gccFortranLibs()
-elif sys.platform == 'cygwin':
- fortran_lib = gccFortranLibs()
-elif sys.platform.find('irix') != -1:
- fortran_lib = ['ftn']
-else:
- fortran_lib = gccFortranLibs()
-
-
file_expr = r"""File "[^"]*", line \d+, in [^\n]+
"""
@@ -958,6 +922,33 @@ SConscript( sconscript )
# to use cygwin compilers on cmd.exe -> uncomment following line
#Configure_lib = 'm'
+ def gccFortranLibs(self):
+ """Test which gcc Fortran startup libraries are required.
+ This should probably move into SCons itself, but is kind of hacky.
+ """
+ if sys.platform.find('irix') != -1:
+ return ['ftn']
+
+ libs = ['g2c']
+ cmd = ['gcc','-v']
+
+ try:
+ p = Popen(cmd, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p.communicate()
+ except:
+ return libs
+
+ m = re.search('(gcc\s+version|gcc-Version)\s+(\d\.\d)', stderr)
+ if m:
+ gcc_version = m.group(2)
+ if re.match('4.[^0]', gcc_version):
+ libs = ['gfortranbegin']
+ elif gcc_version in ('3.1', '4.0'):
+ libs = ['frtbegin'] + libs
+
+ return libs
+
+
def checkLogAndStdout(self, checks, results, cached,
logfile, sconf_dir, sconstruct,
doCheckLog=1, doCheckStdout=1):
diff --git a/runtest.py b/runtest.py
index 9780f1c..a88cfd2 100644
--- a/runtest.py
+++ b/runtest.py
@@ -640,10 +640,6 @@ old_pythonpath = os.environ.get('PYTHONPATH')
# should be able to go away.
pythonpaths = [ pythonpath_dir ]
-for dir in sp:
- q = os.path.join(dir, 'QMTest')
- pythonpaths.append(q)
-
# Add path of the QMTest folder to PYTHONPATH
scriptpath = os.path.dirname(os.path.realpath(__file__))
pythonpaths.append(os.path.join(scriptpath, 'QMTest'))
diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in
index 4f175bd..b12848a 100644
--- a/src/engine/MANIFEST.in
+++ b/src/engine/MANIFEST.in
@@ -154,6 +154,7 @@ SCons/Tool/RCS.py
SCons/Tool/rmic.py
SCons/Tool/rpcgen.py
SCons/Tool/rpm.py
+SCons/Tool/rpmutils.py
SCons/Tool/SCCS.py
SCons/Tool/sgiar.py
SCons/Tool/sgic++.py
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index c81eecf..5f20685 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -36,7 +36,6 @@ import os
import os.path
import sys
import tempfile
-import threading
from SCons.Platform.posix import exitvalmap
from SCons.Platform import TempFileMunge
@@ -82,28 +81,39 @@ else:
builtins.file = _scons_file
builtins.open = _scons_open
-spawn_lock = threading.Lock()
-
-# This locked version of spawnve works around a Windows
-# MSVCRT bug, because its spawnve is not thread-safe.
-# Without this, python can randomly crash while using -jN.
-# See the python bug at http://bugs.python.org/issue6476
-# and SCons issue at
-# http://scons.tigris.org/issues/show_bug.cgi?id=2449
-def spawnve(mode, file, args, env):
- spawn_lock.acquire()
- try:
+try:
+ import threading
+ spawn_lock = threading.Lock()
+
+ # This locked version of spawnve works around a Windows
+ # MSVCRT bug, because its spawnve is not thread-safe.
+ # Without this, python can randomly crash while using -jN.
+ # See the python bug at http://bugs.python.org/issue6476
+ # and SCons issue at
+ # http://scons.tigris.org/issues/show_bug.cgi?id=2449
+ def spawnve(mode, file, args, env):
+ spawn_lock.acquire()
+ try:
+ if mode == os.P_WAIT:
+ ret = os.spawnve(os.P_NOWAIT, file, args, env)
+ else:
+ ret = os.spawnve(mode, file, args, env)
+ finally:
+ spawn_lock.release()
if mode == os.P_WAIT:
- ret = os.spawnve(os.P_NOWAIT, file, args, env)
- else:
- ret = os.spawnve(mode, file, args, env)
- finally:
- spawn_lock.release()
- if mode == os.P_WAIT:
- pid, status = os.waitpid(ret, 0)
- ret = status >> 8
- return ret
-
+ pid, status = os.waitpid(ret, 0)
+ ret = status >> 8
+ return ret
+except ImportError:
+ # Use the unsafe method of spawnve.
+ # Please, don't try to optimize this try-except block
+ # away by assuming that the threading module is always present.
+ # In the test test/option-j.py we intentionally call SCons with
+ # a fake threading.py that raises an import exception right away,
+ # simulating a non-existent package.
+ def spawnve(mode, file, args, env):
+ return os.spawnve(mode, file, args, env)
+
# The upshot of all this is that, if you are using Python 1.5.2,
# you had better have cmd or command.com in your PATH when you run
# scons.
diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py
index 232963c..7d966c1 100644
--- a/src/engine/SCons/Tool/msvsTests.py
+++ b/src/engine/SCons/Tool/msvsTests.py
@@ -701,7 +701,7 @@ class msvs80TestCase(msvsTestCase):
class msvsEmptyTestCase(msvsTestCase):
"""Test Empty Registry"""
registry = DummyRegistry(regdata_none)
- default_version = '10.0'
+ default_version = '11.0'
highest_version = None
number_of_versions = 0
install_locs = {
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py
index 1ea50de..07857d1 100644
--- a/src/engine/SCons/Tool/packaging/rpm.py
+++ b/src/engine/SCons/Tool/packaging/rpm.py
@@ -30,6 +30,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import SCons.Builder
+import SCons.Tool.rpmutils
from SCons.Environment import OverrideEnvironment
from SCons.Tool.packaging import stripinstallbuilder, src_targz
@@ -52,16 +53,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
else:
# This should be overridable from the construction environment,
# which it is by using ARCHITECTURE=.
- # Guessing based on what os.uname() returns at least allows it
- # to work for both i386 and x86_64 Linux systems.
- archmap = {
- 'i686' : 'i386',
- 'i586' : 'i386',
- 'i486' : 'i386',
- }
-
- buildarchitecture = os.uname()[4]
- buildarchitecture = archmap.get(buildarchitecture, buildarchitecture)
+ buildarchitecture = SCons.Tool.rpmutils.defaultMachine()
if 'ARCHITECTURE' in kw:
buildarchitecture = kw['ARCHITECTURE']
diff --git a/src/engine/SCons/Tool/rpmutils.py b/src/engine/SCons/Tool/rpmutils.py
new file mode 100644
index 0000000..90e3d74
--- /dev/null
+++ b/src/engine/SCons/Tool/rpmutils.py
@@ -0,0 +1,533 @@
+"""SCons.Tool.rpmutils.py
+
+RPM specific helper routines for general usage in the test framework
+and SCons core modules.
+
+Since we check for the RPM package target name in several places,
+we have to know which machine/system name RPM will use for the current
+hardware setup. The following dictionaries and functions try to
+mimic the exact naming rules of the RPM source code.
+They were directly derived from the file "rpmrc.in" of the version
+rpm-4.9.1.3. For updating to a more recent version of RPM, this Python
+script can be used standalone. The usage() function below shows the
+exact syntax.
+
+"""
+
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+
+import platform
+
+# Start of rpmrc dictionaries (Marker, don't change or remove!)
+os_canon = {
+ 'AIX' : ['AIX','5'],
+ 'AmigaOS' : ['AmigaOS','5'],
+ 'BSD_OS' : ['bsdi','12'],
+ 'CYGWIN32_95' : ['cygwin32','15'],
+ 'CYGWIN32_NT' : ['cygwin32','14'],
+ 'Darwin' : ['darwin','21'],
+ 'FreeBSD' : ['FreeBSD','8'],
+ 'HP-UX' : ['hpux10','6'],
+ 'IRIX' : ['Irix','2'],
+ 'IRIX64' : ['Irix64','10'],
+ 'Linux' : ['Linux','1'],
+ 'Linux/390' : ['OS/390','20'],
+ 'Linux/ESA' : ['VM/ESA','20'],
+ 'MacOSX' : ['macosx','21'],
+ 'MiNT' : ['FreeMiNT','17'],
+ 'NEXTSTEP' : ['NextStep','11'],
+ 'OS/390' : ['OS/390','18'],
+ 'OSF1' : ['osf1','7'],
+ 'SCO_SV' : ['SCO_SV3.2v5.0.2','9'],
+ 'SunOS4' : ['SunOS','4'],
+ 'SunOS5' : ['solaris','3'],
+ 'UNIX_SV' : ['MP_RAS','16'],
+ 'VM/ESA' : ['VM/ESA','19'],
+ 'machten' : ['machten','13'],
+ 'osf3.2' : ['osf1','7'],
+ 'osf4.0' : ['osf1','7'],
+}
+
+buildarch_compat = {
+ 'alpha' : ['noarch'],
+ 'alphaev5' : ['alpha'],
+ 'alphaev56' : ['alphaev5'],
+ 'alphaev6' : ['alphapca56'],
+ 'alphaev67' : ['alphaev6'],
+ 'alphapca56' : ['alphaev56'],
+ 'amd64' : ['x86_64'],
+ 'armv3l' : ['noarch'],
+ 'armv4b' : ['noarch'],
+ 'armv4l' : ['armv3l'],
+ 'armv4tl' : ['armv4l'],
+ 'armv5tejl' : ['armv5tel'],
+ 'armv5tel' : ['armv4tl'],
+ 'armv6l' : ['armv5tejl'],
+ 'armv7l' : ['armv6l'],
+ 'atariclone' : ['m68kmint','noarch'],
+ 'atarist' : ['m68kmint','noarch'],
+ 'atariste' : ['m68kmint','noarch'],
+ 'ataritt' : ['m68kmint','noarch'],
+ 'athlon' : ['i686'],
+ 'falcon' : ['m68kmint','noarch'],
+ 'geode' : ['i586'],
+ 'hades' : ['m68kmint','noarch'],
+ 'hppa1.0' : ['parisc'],
+ 'hppa1.1' : ['hppa1.0'],
+ 'hppa1.2' : ['hppa1.1'],
+ 'hppa2.0' : ['hppa1.2'],
+ 'i386' : ['noarch','fat'],
+ 'i486' : ['i386'],
+ 'i586' : ['i486'],
+ 'i686' : ['i586'],
+ 'ia32e' : ['x86_64'],
+ 'ia64' : ['noarch'],
+ 'm68k' : ['noarch'],
+ 'milan' : ['m68kmint','noarch'],
+ 'mips' : ['noarch'],
+ 'mipsel' : ['noarch'],
+ 'parisc' : ['noarch'],
+ 'pentium3' : ['i686'],
+ 'pentium4' : ['pentium3'],
+ 'ppc' : ['noarch','fat'],
+ 'ppc32dy4' : ['noarch'],
+ 'ppc64' : ['noarch','fat'],
+ 'ppc64iseries' : ['ppc64'],
+ 'ppc64pseries' : ['ppc64'],
+ 'ppc8260' : ['noarch'],
+ 'ppc8560' : ['noarch'],
+ 'ppciseries' : ['noarch'],
+ 'ppcpseries' : ['noarch'],
+ 's390' : ['noarch'],
+ 's390x' : ['noarch'],
+ 'sh3' : ['noarch'],
+ 'sh4' : ['noarch'],
+ 'sh4a' : ['sh4'],
+ 'sparc' : ['noarch'],
+ 'sparc64' : ['sparcv9v'],
+ 'sparc64v' : ['sparc64'],
+ 'sparcv8' : ['sparc'],
+ 'sparcv9' : ['sparcv8'],
+ 'sparcv9v' : ['sparcv9'],
+ 'sun4c' : ['noarch'],
+ 'sun4d' : ['noarch'],
+ 'sun4m' : ['noarch'],
+ 'sun4u' : ['noarch'],
+ 'x86_64' : ['noarch'],
+}
+
+os_compat = {
+ 'BSD_OS' : ['bsdi'],
+ 'Darwin' : ['MacOSX'],
+ 'FreeMiNT' : ['mint','MiNT','TOS'],
+ 'IRIX64' : ['IRIX'],
+ 'MiNT' : ['FreeMiNT','mint','TOS'],
+ 'TOS' : ['FreeMiNT','MiNT','mint'],
+ 'bsdi4.0' : ['bsdi'],
+ 'hpux10.00' : ['hpux9.07'],
+ 'hpux10.01' : ['hpux10.00'],
+ 'hpux10.10' : ['hpux10.01'],
+ 'hpux10.20' : ['hpux10.10'],
+ 'hpux10.30' : ['hpux10.20'],
+ 'hpux11.00' : ['hpux10.30'],
+ 'hpux9.05' : ['hpux9.04'],
+ 'hpux9.07' : ['hpux9.05'],
+ 'mint' : ['FreeMiNT','MiNT','TOS'],
+ 'ncr-sysv4.3' : ['ncr-sysv4.2'],
+ 'osf4.0' : ['osf3.2','osf1'],
+ 'solaris2.4' : ['solaris2.3'],
+ 'solaris2.5' : ['solaris2.3','solaris2.4'],
+ 'solaris2.6' : ['solaris2.3','solaris2.4','solaris2.5'],
+ 'solaris2.7' : ['solaris2.3','solaris2.4','solaris2.5','solaris2.6'],
+}
+
+arch_compat = {
+ 'alpha' : ['axp','noarch'],
+ 'alphaev5' : ['alpha'],
+ 'alphaev56' : ['alphaev5'],
+ 'alphaev6' : ['alphapca56'],
+ 'alphaev67' : ['alphaev6'],
+ 'alphapca56' : ['alphaev56'],
+ 'amd64' : ['x86_64','athlon','noarch'],
+ 'armv3l' : ['noarch'],
+ 'armv4b' : ['noarch'],
+ 'armv4l' : ['armv3l'],
+ 'armv4tl' : ['armv4l'],
+ 'armv5tejl' : ['armv5tel'],
+ 'armv5tel' : ['armv4tl'],
+ 'armv6l' : ['armv5tejl'],
+ 'armv7l' : ['armv6l'],
+ 'atariclone' : ['m68kmint','noarch'],
+ 'atarist' : ['m68kmint','noarch'],
+ 'atariste' : ['m68kmint','noarch'],
+ 'ataritt' : ['m68kmint','noarch'],
+ 'athlon' : ['i686'],
+ 'falcon' : ['m68kmint','noarch'],
+ 'geode' : ['i586'],
+ 'hades' : ['m68kmint','noarch'],
+ 'hppa1.0' : ['parisc'],
+ 'hppa1.1' : ['hppa1.0'],
+ 'hppa1.2' : ['hppa1.1'],
+ 'hppa2.0' : ['hppa1.2'],
+ 'i370' : ['noarch'],
+ 'i386' : ['noarch','fat'],
+ 'i486' : ['i386'],
+ 'i586' : ['i486'],
+ 'i686' : ['i586'],
+ 'ia32e' : ['x86_64','athlon','noarch'],
+ 'ia64' : ['noarch'],
+ 'milan' : ['m68kmint','noarch'],
+ 'mips' : ['noarch'],
+ 'mipsel' : ['noarch'],
+ 'osfmach3_i386' : ['i486'],
+ 'osfmach3_i486' : ['i486','osfmach3_i386'],
+ 'osfmach3_i586' : ['i586','osfmach3_i486'],
+ 'osfmach3_i686' : ['i686','osfmach3_i586'],
+ 'osfmach3_ppc' : ['ppc'],
+ 'parisc' : ['noarch'],
+ 'pentium3' : ['i686'],
+ 'pentium4' : ['pentium3'],
+ 'powerpc' : ['ppc'],
+ 'powerppc' : ['ppc'],
+ 'ppc' : ['rs6000'],
+ 'ppc32dy4' : ['ppc'],
+ 'ppc64' : ['ppc'],
+ 'ppc64iseries' : ['ppc64'],
+ 'ppc64pseries' : ['ppc64'],
+ 'ppc8260' : ['ppc'],
+ 'ppc8560' : ['ppc'],
+ 'ppciseries' : ['ppc'],
+ 'ppcpseries' : ['ppc'],
+ 'rs6000' : ['noarch','fat'],
+ 's390' : ['noarch'],
+ 's390x' : ['s390','noarch'],
+ 'sh3' : ['noarch'],
+ 'sh4' : ['noarch'],
+ 'sh4a' : ['sh4'],
+ 'sparc' : ['noarch'],
+ 'sparc64' : ['sparcv9'],
+ 'sparc64v' : ['sparc64'],
+ 'sparcv8' : ['sparc'],
+ 'sparcv9' : ['sparcv8'],
+ 'sparcv9v' : ['sparcv9'],
+ 'sun4c' : ['sparc'],
+ 'sun4d' : ['sparc'],
+ 'sun4m' : ['sparc'],
+ 'sun4u' : ['sparc64'],
+ 'x86_64' : ['amd64','athlon','noarch'],
+}
+
+buildarchtranslate = {
+ 'alphaev5' : ['alpha'],
+ 'alphaev56' : ['alpha'],
+ 'alphaev6' : ['alpha'],
+ 'alphaev67' : ['alpha'],
+ 'alphapca56' : ['alpha'],
+ 'amd64' : ['x86_64'],
+ 'armv3l' : ['armv3l'],
+ 'armv4b' : ['armv4b'],
+ 'armv4l' : ['armv4l'],
+ 'armv4tl' : ['armv4tl'],
+ 'armv5tejl' : ['armv5tejl'],
+ 'armv5tel' : ['armv5tel'],
+ 'armv6l' : ['armv6l'],
+ 'armv7l' : ['armv7l'],
+ 'atariclone' : ['m68kmint'],
+ 'atarist' : ['m68kmint'],
+ 'atariste' : ['m68kmint'],
+ 'ataritt' : ['m68kmint'],
+ 'athlon' : ['i386'],
+ 'falcon' : ['m68kmint'],
+ 'geode' : ['i386'],
+ 'hades' : ['m68kmint'],
+ 'i386' : ['i386'],
+ 'i486' : ['i386'],
+ 'i586' : ['i386'],
+ 'i686' : ['i386'],
+ 'ia32e' : ['x86_64'],
+ 'ia64' : ['ia64'],
+ 'milan' : ['m68kmint'],
+ 'osfmach3_i386' : ['i386'],
+ 'osfmach3_i486' : ['i386'],
+ 'osfmach3_i586' : ['i386'],
+ 'osfmach3_i686' : ['i386'],
+ 'osfmach3_ppc' : ['ppc'],
+ 'pentium3' : ['i386'],
+ 'pentium4' : ['i386'],
+ 'powerpc' : ['ppc'],
+ 'powerppc' : ['ppc'],
+ 'ppc32dy4' : ['ppc'],
+ 'ppc64iseries' : ['ppc64'],
+ 'ppc64pseries' : ['ppc64'],
+ 'ppc8260' : ['ppc'],
+ 'ppc8560' : ['ppc'],
+ 'ppciseries' : ['ppc'],
+ 'ppcpseries' : ['ppc'],
+ 's390' : ['s390'],
+ 's390x' : ['s390x'],
+ 'sh3' : ['sh3'],
+ 'sh4' : ['sh4'],
+ 'sh4a' : ['sh4'],
+ 'sparc64v' : ['sparc64'],
+ 'sparcv8' : ['sparc'],
+ 'sparcv9' : ['sparc'],
+ 'sparcv9v' : ['sparc'],
+ 'sun4c' : ['sparc'],
+ 'sun4d' : ['sparc'],
+ 'sun4m' : ['sparc'],
+ 'sun4u' : ['sparc64'],
+ 'x86_64' : ['x86_64'],
+}
+
+optflags = {
+ 'alpha' : ['-O2','-g','-mieee'],
+ 'alphaev5' : ['-O2','-g','-mieee','-mtune=ev5'],
+ 'alphaev56' : ['-O2','-g','-mieee','-mtune=ev56'],
+ 'alphaev6' : ['-O2','-g','-mieee','-mtune=ev6'],
+ 'alphaev67' : ['-O2','-g','-mieee','-mtune=ev67'],
+ 'alphapca56' : ['-O2','-g','-mieee','-mtune=pca56'],
+ 'amd64' : ['-O2','-g'],
+ 'armv3l' : ['-O2','-g','-march=armv3'],
+ 'armv4b' : ['-O2','-g','-march=armv4'],
+ 'armv4l' : ['-O2','-g','-march=armv4'],
+ 'armv4tl' : ['-O2','-g','-march=armv4t'],
+ 'armv5tejl' : ['-O2','-g','-march=armv5te'],
+ 'armv5tel' : ['-O2','-g','-march=armv5te'],
+ 'armv6l' : ['-O2','-g','-march=armv6'],
+ 'armv7l' : ['-O2','-g','-march=armv7'],
+ 'atariclone' : ['-O2','-g','-fomit-frame-pointer'],
+ 'atarist' : ['-O2','-g','-fomit-frame-pointer'],
+ 'atariste' : ['-O2','-g','-fomit-frame-pointer'],
+ 'ataritt' : ['-O2','-g','-fomit-frame-pointer'],
+ 'athlon' : ['-O2','-g','-march=athlon'],
+ 'falcon' : ['-O2','-g','-fomit-frame-pointer'],
+ 'fat' : ['-O2','-g','-arch','i386','-arch','ppc'],
+ 'geode' : ['-Os','-g','-m32','-march=geode'],
+ 'hades' : ['-O2','-g','-fomit-frame-pointer'],
+ 'hppa1.0' : ['-O2','-g','-mpa-risc-1-0'],
+ 'hppa1.1' : ['-O2','-g','-mpa-risc-1-0'],
+ 'hppa1.2' : ['-O2','-g','-mpa-risc-1-0'],
+ 'hppa2.0' : ['-O2','-g','-mpa-risc-1-0'],
+ 'i386' : ['-O2','-g','-march=i386','-mtune=i686'],
+ 'i486' : ['-O2','-g','-march=i486'],
+ 'i586' : ['-O2','-g','-march=i586'],
+ 'i686' : ['-O2','-g','-march=i686'],
+ 'ia32e' : ['-O2','-g'],
+ 'ia64' : ['-O2','-g'],
+ 'm68k' : ['-O2','-g','-fomit-frame-pointer'],
+ 'milan' : ['-O2','-g','-fomit-frame-pointer'],
+ 'mips' : ['-O2','-g'],
+ 'mipsel' : ['-O2','-g'],
+ 'parisc' : ['-O2','-g','-mpa-risc-1-0'],
+ 'pentium3' : ['-O2','-g','-march=pentium3'],
+ 'pentium4' : ['-O2','-g','-march=pentium4'],
+ 'ppc' : ['-O2','-g','-fsigned-char'],
+ 'ppc32dy4' : ['-O2','-g','-fsigned-char'],
+ 'ppc64' : ['-O2','-g','-fsigned-char'],
+ 'ppc8260' : ['-O2','-g','-fsigned-char'],
+ 'ppc8560' : ['-O2','-g','-fsigned-char'],
+ 'ppciseries' : ['-O2','-g','-fsigned-char'],
+ 'ppcpseries' : ['-O2','-g','-fsigned-char'],
+ 's390' : ['-O2','-g'],
+ 's390x' : ['-O2','-g'],
+ 'sh3' : ['-O2','-g'],
+ 'sh4' : ['-O2','-g','-mieee'],
+ 'sh4a' : ['-O2','-g','-mieee'],
+ 'sparc' : ['-O2','-g','-m32','-mtune=ultrasparc'],
+ 'sparc64' : ['-O2','-g','-m64','-mtune=ultrasparc'],
+ 'sparc64v' : ['-O2','-g','-m64','-mtune=niagara'],
+ 'sparcv8' : ['-O2','-g','-m32','-mtune=ultrasparc','-mv8'],
+ 'sparcv9' : ['-O2','-g','-m32','-mtune=ultrasparc'],
+ 'sparcv9v' : ['-O2','-g','-m32','-mtune=niagara'],
+ 'x86_64' : ['-O2','-g'],
+}
+
+arch_canon = {
+ 'IP' : ['sgi','7'],
+ 'alpha' : ['alpha','2'],
+ 'alphaev5' : ['alphaev5','2'],
+ 'alphaev56' : ['alphaev56','2'],
+ 'alphaev6' : ['alphaev6','2'],
+ 'alphaev67' : ['alphaev67','2'],
+ 'alphapca56' : ['alphapca56','2'],
+ 'amd64' : ['amd64','1'],
+ 'armv3l' : ['armv3l','12'],
+ 'armv4b' : ['armv4b','12'],
+ 'armv4l' : ['armv4l','12'],
+ 'armv5tejl' : ['armv5tejl','12'],
+ 'armv5tel' : ['armv5tel','12'],
+ 'armv6l' : ['armv6l','12'],
+ 'armv7l' : ['armv7l','12'],
+ 'atariclone' : ['m68kmint','13'],
+ 'atarist' : ['m68kmint','13'],
+ 'atariste' : ['m68kmint','13'],
+ 'ataritt' : ['m68kmint','13'],
+ 'athlon' : ['athlon','1'],
+ 'falcon' : ['m68kmint','13'],
+ 'geode' : ['geode','1'],
+ 'hades' : ['m68kmint','13'],
+ 'i370' : ['i370','14'],
+ 'i386' : ['i386','1'],
+ 'i486' : ['i486','1'],
+ 'i586' : ['i586','1'],
+ 'i686' : ['i686','1'],
+ 'ia32e' : ['ia32e','1'],
+ 'ia64' : ['ia64','9'],
+ 'm68k' : ['m68k','6'],
+ 'm68kmint' : ['m68kmint','13'],
+ 'milan' : ['m68kmint','13'],
+ 'mips' : ['mips','4'],
+ 'mipsel' : ['mipsel','11'],
+ 'pentium3' : ['pentium3','1'],
+ 'pentium4' : ['pentium4','1'],
+ 'ppc' : ['ppc','5'],
+ 'ppc32dy4' : ['ppc32dy4','5'],
+ 'ppc64' : ['ppc64','16'],
+ 'ppc64iseries' : ['ppc64iseries','16'],
+ 'ppc64pseries' : ['ppc64pseries','16'],
+ 'ppc8260' : ['ppc8260','5'],
+ 'ppc8560' : ['ppc8560','5'],
+ 'ppciseries' : ['ppciseries','5'],
+ 'ppcpseries' : ['ppcpseries','5'],
+ 'rs6000' : ['rs6000','8'],
+ 's390' : ['s390','14'],
+ 's390x' : ['s390x','15'],
+ 'sh' : ['sh','17'],
+ 'sh3' : ['sh3','17'],
+ 'sh4' : ['sh4','17'],
+ 'sh4a' : ['sh4a','17'],
+ 'sparc' : ['sparc','3'],
+ 'sparc64' : ['sparc64','2'],
+ 'sparc64v' : ['sparc64v','2'],
+ 'sparcv8' : ['sparcv8','3'],
+ 'sparcv9' : ['sparcv9','3'],
+ 'sparcv9v' : ['sparcv9v','3'],
+ 'sun4' : ['sparc','3'],
+ 'sun4c' : ['sparc','3'],
+ 'sun4d' : ['sparc','3'],
+ 'sun4m' : ['sparc','3'],
+ 'sun4u' : ['sparc64','2'],
+ 'x86_64' : ['x86_64','1'],
+ 'xtensa' : ['xtensa','18'],
+}
+
+# End of rpmrc dictionaries (Marker, don't change or remove!)
+
+def defaultMachine():
+ """ Return the canonicalized machine name. """
+ rmachine = platform.machine()
+
+ # Try to lookup the string in the canon table
+ if rmachine in arch_canon:
+ rmachine = arch_canon[rmachine][0]
+
+ return rmachine
+
+def defaultSystem():
+ """ Return the canonicalized system name. """
+ rsystem = platform.system()
+
+ # Try to lookup the string in the canon tables
+ if rsystem in os_canon:
+ rsystem = os_canon[rsystem][0]
+
+ return rsystem
+
+def defaultNames():
+ """ Return the canonicalized machine and system name. """
+ return defaultMachine(), defaultSystem()
+
+def updateRpmDicts(rpmrc, pyfile):
+ """ Read the given rpmrc file with RPM definitions and update the
+ info dictionaries in the file pyfile with it.
+ The arguments will usually be 'rpmrc.in' from a recent RPM source
+ tree, and 'rpmutils.py' referring to this script itself.
+ See also usage() below.
+ """
+ try:
+ # Read old rpmutils.py file
+ oldpy = open(pyfile,"r").readlines()
+ # Read current rpmrc.in file
+ rpm = open(rpmrc,"r").readlines()
+ # Parse for data
+ data = {}
+ # Allowed section names that get parsed
+ sections = ['optflags',
+ 'arch_canon',
+ 'os_canon',
+ 'buildarchtranslate',
+ 'arch_compat',
+ 'os_compat',
+ 'buildarch_compat']
+ for l in rpm:
+ l = l.rstrip('\n').replace(':',' ')
+ # Skip comments
+ if l.lstrip().startswith('#'):
+ continue
+ tokens = l.strip().split()
+ if len(tokens):
+ key = tokens[0]
+ if key in sections:
+ # Have we met this section before?
+ if not data.has_key(tokens[0]):
+ # No, so insert it
+ data[key] = {}
+ # Insert data
+ data[key][tokens[1]] = tokens[2:]
+ # Write new rpmutils.py file
+ out = open(pyfile,"w")
+ pm = 0
+ for l in oldpy:
+ if pm:
+ if l.startswith('# End of rpmrc dictionaries'):
+ pm = 0
+ out.write(l)
+ else:
+ out.write(l)
+ if l.startswith('# Start of rpmrc dictionaries'):
+ pm = 1
+ # Write data sections to single dictionaries
+ for key, entries in data.iteritems():
+ out.write("%s = {\n" % key)
+ for arch in sorted(entries.keys()):
+ out.write(" '%s' : ['%s'],\n" % (arch, "','".join(entries[arch])))
+ out.write("}\n\n")
+ out.close()
+ except:
+ pass
+
+def usage():
+ print "rpmutils.py rpmrc.in rpmutils.py"
+
+def main():
+ import sys
+
+ if len(sys.argv) < 3:
+ usage()
+ sys.exit(0)
+ updateRpmDicts(sys.argv[1], sys.argv[2])
+
+if __name__ == "__main__":
+ main()
diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py
index f2f542b..17e055f 100644
--- a/src/engine/SCons/Tool/xgettext.py
+++ b/src/engine/SCons/Tool/xgettext.py
@@ -323,7 +323,10 @@ def generate(env,**kw):
def exists(env):
""" Check, whether the tool exists """
from SCons.Tool.GettextCommon import _xgettext_exists
- return _xgettext_exists(env)
+ try:
+ return _xgettext_exists(env)
+ except:
+ return False
#############################################################################
# Local Variables:
diff --git a/test/Fortran/FORTRAN.py b/test/Fortran/FORTRAN.py
index df73ea6..4a2529c 100644
--- a/test/Fortran/FORTRAN.py
+++ b/test/Fortran/FORTRAN.py
@@ -87,7 +87,7 @@ test.must_match('test08' + _exe, "This is a .FPP file.\n")
fc = 'f77'
f77 = test.detect_tool(fc)
-FTN_LIB = TestSCons.fortran_lib
+FTN_LIB = test.gccFortranLibs()
if f77:
diff --git a/test/Subst/TypeError.py b/test/Subst/TypeError.py
index a996a77..371ceff 100644
--- a/test/Subst/TypeError.py
+++ b/test/Subst/TypeError.py
@@ -35,7 +35,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
-expect_build = r"""scons: \*\*\*%s TypeError `(unsubscriptable object|'NoneType' object is (not |un)subscriptable)' trying to evaluate `%s'
+expect_build = r"""scons: \*\*\*%s TypeError `(unsubscriptable object|'NoneType' object is (not |un)subscriptable|'NoneType' object has no attribute '__getitem__')' trying to evaluate `%s'
"""
expect_read = "\n" + expect_build + TestSCons.file_expr
diff --git a/test/VariantDir/VariantDir.py b/test/VariantDir/VariantDir.py
index a294d6b..0092692 100644
--- a/test/VariantDir/VariantDir.py
+++ b/test/VariantDir/VariantDir.py
@@ -26,9 +26,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
_exe = TestSCons._exe
-fortran_runtime = TestSCons.fortran_lib
test = TestSCons.TestSCons()
+fortran_runtime = test.gccFortranLibs()
fortran = test.detect('FORTRAN')
diff --git a/test/dependency-cycle.py b/test/dependency-cycle.py
index 42c9392..a555d76 100644
--- a/test/dependency-cycle.py
+++ b/test/dependency-cycle.py
@@ -50,8 +50,8 @@ f1(void)
test.run(arguments = ".", stderr=r"""
scons: \*\*\* Found dependency cycle\(s\):
- .*foo1.* -> .*foo3.* -> .*foo2.* -> .*foo1.*
- .*foo3.* -> .*foo2.* -> .*foo1.* -> .*foo3.*
+ .*foo(1|3|2).* -> .*foo(3|2|1).* -> .*foo(2|1|3).* -> .*foo(1|3|2).*
+ .*foo(3|1|2).* -> .*foo(2|3|1).* -> .*foo(1|2|3).* -> .*foo(3|1|2).*
.*
""", status=2)
diff --git a/test/explain/basic.py b/test/explain/basic.py
index 1f0a16c..5e31cfd 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -169,11 +169,9 @@ test.write(['src', 'file6.in'], "file6.in 1\n")
test.write(['src', 'subdir', 'file7.in'], "subdir/file7.in 1\n")
-
args = '--debug=explain .'
-
expect = test.wrap_stdout("""\
scons: building `file1' because it doesn't exist
%(_python_)s %(cat_py)s file1 file1.in
@@ -203,7 +201,9 @@ scons: building `%(subdir_file9)s' because it doesn't exist
%(_python_)s %(cat_py)s %(subdir_file9)s %(subdir_file7_in)s
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file1'], "file1.in 1\n")
test.must_match(['src', 'file2'], """\
@@ -259,7 +259,9 @@ scons: rebuilding `%(subdir_file8)s' because:
%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file1'], "file1.in 2\n")
test.must_match(['src', 'file2'], """\
@@ -289,7 +291,9 @@ scons: rebuilding `file3' because `zzz' is no longer a dependency
%(_python_)s %(cat_py)s file3 xxx yyy
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file3'], "xxx 1\nyyy 2\n")
@@ -327,7 +331,9 @@ scons: rebuilding `file3' because the dependency order changed:
%(_python_)s %(cat_py)s file3 zzz yyy xxx
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
@@ -352,7 +358,9 @@ scons: rebuilding `file3' because the build action changed:
%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx yyy
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n")
@@ -381,7 +389,9 @@ scons: rebuilding `file3' because the build action changed:
%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx xxx
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n")
@@ -402,7 +412,9 @@ scons: rebuilding `file4' because the contents of the build action changed
%(_python_)s %(cat_py)s file4 file4.in
""" % locals())
+test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src',arguments=args, stdout=expect)
+test.set_match_function(TestSCons.match_exact)
test.must_match(['src', 'file4'], "file4.in 1\n")
diff --git a/test/import.py b/test/import.py
index 5bb4fcd..ef5ee61 100644
--- a/test/import.py
+++ b/test/import.py
@@ -39,7 +39,7 @@ tooldir = os.path.join(os.getcwd(), 'src', 'engine', 'SCons', 'Tool')
import TestSCons
test = TestSCons.TestSCons()
-# Before executing the any of the platform or tool modules, add some
+# Before executing any of the platform or tool modules, add some
# null entries to the environment $PATH variable to make sure there's
# no code that tries to index elements from the list before making sure
# they're non-null.
@@ -77,6 +77,8 @@ ignore = ('__init__.py',
'MSCommon',
# Sun pkgchk and pkginfo common stuff
'sun_pkg.py',
+ # RPM utilities
+ 'rpmutils.py',
)
tools = []
for name in os.listdir(tooldir):
diff --git a/test/packaging/rpm/multipackage.py b/test/packaging/rpm/multipackage.py
index 4807a20..ab8734d 100644
--- a/test/packaging/rpm/multipackage.py
+++ b/test/packaging/rpm/multipackage.py
@@ -30,7 +30,7 @@ from one SCons environment.
"""
import os
-import glob
+import SCons.Tool.rpmutils
import TestSCons
_python_ = TestSCons._python_
@@ -98,18 +98,18 @@ env.Alias( 'install', prog )
test.run(arguments='', stderr = None)
src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
src_rpm2 = 'foo2-1.2.3-0.src.rpm'
-machine_rpm2 = 'foo2-1.2.3-0.*.rpm'
+machine_rpm2 = 'foo2-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
test.must_exist( src_rpm )
-test.must_exist_one_of( [machine_rpm2] )
+test.must_exist( machine_rpm2 )
test.must_exist( src_rpm2 )
test.must_not_exist( 'bin/main' )
-test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n')
+test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
test.pass_test()
diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py
index b1abaab..d8c2785 100644
--- a/test/packaging/rpm/package.py
+++ b/test/packaging/rpm/package.py
@@ -29,7 +29,7 @@ Test the ability to create a really simple rpm package.
"""
import os
-import glob
+import SCons.Tool.rpmutils
import TestSCons
_python_ = TestSCons._python_
@@ -83,12 +83,12 @@ env.Alias( 'install', prog )
test.run(arguments='', stderr = None)
src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
test.must_exist( src_rpm )
test.must_not_exist( 'bin/main' )
-test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n')
+test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
test.pass_test()
diff --git a/test/packaging/rpm/tagging.py b/test/packaging/rpm/tagging.py
index 4d6c76e..3016274 100644
--- a/test/packaging/rpm/tagging.py
+++ b/test/packaging/rpm/tagging.py
@@ -29,7 +29,7 @@ Test the ability to add file tags
"""
import os
-import glob
+import SCons.Tool.rpmutils
import TestSCons
@@ -88,11 +88,11 @@ env.Package( NAME = 'foo',
test.run(arguments='', stderr = None)
src_rpm = 'foo-1.2.3-0.src.rpm'
-machine_rpm = 'foo-1.2.3-0.*.rpm'
+machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine()
-test.must_exist_one_of( [machine_rpm] )
+test.must_exist( machine_rpm )
test.must_exist( src_rpm )
-test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n')
+test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n')
test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n')
expect = '(0755, root, users) /bin/main'