assert s == "['n3', 'n2', 'n1']", s
r = repr(nl)
- r = re.sub('at (0x)?[0-9a-z]+', 'at 0x', repr(nl))
+ r = re.sub('at (0x)?[0-9A-Fa-f]+', 'at 0x', repr(nl))
l = string.join(["<__main__.MyNode instance at 0x>"]*3, ", ")
assert r == '[%s]' % l, r
env['AS'] = '386asm'
env['ASFLAGS'] = SCons.Util.CLVar('')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES -o $TARGET'
addPharLapPaths(env)
versions=[]
if is_win32:
keyname = 'Software\\Intel\\Compilers\\C++'
- k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
- keyname)
+ try:
+ k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
+ keyname)
+ except WindowsError:
+ return []
i = 0
versions = []
try:
if abi is None:
abi = "ia32" # or ia64, I believe
- if topdir is None:
+ if topdir is None and version:
try:
topdir = get_intel_compiler_top(version, abi)
except (SCons.Util.RegError, SCons.Errors.InternalError):
env['AS'] = 'ml'
env['ASFLAGS'] = SCons.Util.CLVar('/nologo')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS /c /Fo$TARGET $SOURCES'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES'
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
def exists(env):
env['AS'] = 'nasm'
env['ASFLAGS'] = SCons.Util.CLVar('')
+ env['ASPPFLAGS'] = '$ASFLAGS'
env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES'
- env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
+ env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
def exists(env):
return env.Detect('nasm')
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
OBJSUFFIX='.obj')
-env.Object(target = 'test1', source = 'test1.cc')
-env.Object(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.Object(target = 'test1', source = 'test1.cpp')
+env.Object(target = 'test2', source = 'test2.cc')
+env.Object(target = 'test3', source = 'test3.cxx')
+env.Object(target = 'test4', source = 'test4.c++')
+env.Object(target = 'test5', source = 'test5.C++')
+env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*c++*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*c++*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run()
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
outfile.write(l)
sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(CXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
CXXCOMSTR = 'Building $TARGET from $SOURCE',
OBJSUFFIX='.obj')
-env.Object(target = 'test1', source = 'test1.cc')
-env.Object(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.Object(target = 'test1', source = 'test1.cpp')
+env.Object(target = 'test2', source = 'test2.cc')
+env.Object(target = 'test3', source = 'test3.cxx')
+env.Object(target = 'test4', source = 'test4.c++')
+env.Object(target = 'test5', source = 'test5.C++')
+env.Object(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*cc*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*cc*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run(stdout = test.wrap_stdout("""\
-Building test1.obj from test1.cc
-Building test2.obj from test2%(alt_cc_suffix)s
+Building test1.obj from test1.cpp
+Building test2.obj from test2.cc
+Building test3.obj from test3.cxx
+Building test4.obj from test4.c++
+Building test5.obj from test5.C++
+Building test6.obj from test6%(alt_cpp_suffix)s
""" % locals()))
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
SHOBJSUFFIX='.obj')
-env.SharedObject(target = 'test1', source = 'test1.cc')
-env.SharedObject(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.SharedObject(target = 'test1', source = 'test1.cpp')
+env.SharedObject(target = 'test2', source = 'test2.cc')
+env.SharedObject(target = 'test3', source = 'test3.cxx')
+env.SharedObject(target = 'test4', source = 'test4.c++')
+env.SharedObject(target = 'test5', source = 'test5.C++')
+env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*c++*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*c++*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run()
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
-
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
test.pass_test()
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
outfile.write(l)
sys.exit(0)
""")
if os.path.normcase('.c') == os.path.normcase('.C'):
- alt_cc_suffix = '.CC'
+ alt_cpp_suffix = '.cpp'
else:
- alt_cc_suffix = '.cc'
+ alt_cpp_suffix = '.C'
test.write('SConstruct', """
env = Environment(SHCXXCOM = r'%(python)s mycc.py $TARGET $SOURCE',
SHCXXCOMSTR = 'Building shared object $TARGET from $SOURCE',
SHOBJSUFFIX='.obj')
-env.SharedObject(target = 'test1', source = 'test1.cc')
-env.SharedObject(target = 'test2', source = 'test2%(alt_cc_suffix)s')
+env.SharedObject(target = 'test1', source = 'test1.cpp')
+env.SharedObject(target = 'test2', source = 'test2.cc')
+env.SharedObject(target = 'test3', source = 'test3.cxx')
+env.SharedObject(target = 'test4', source = 'test4.c++')
+env.SharedObject(target = 'test5', source = 'test5.C++')
+env.SharedObject(target = 'test6', source = 'test6%(alt_cpp_suffix)s')
""" % locals())
-test.write('test1.cc', """\
-test1.cc
-/*cc*/
-""")
-
-test.write('test2'+alt_cc_suffix, """\
-test2.CC
-/*cc*/
-""")
+test.write('test1.cpp', "test1.cpp\n/*c++*/\n")
+test.write('test2.cc', "test2.cc\n/*c++*/\n")
+test.write('test3.cxx', "test3.cxx\n/*c++*/\n")
+test.write('test4.c++', "test4.c++\n/*c++*/\n")
+test.write('test5.C++', "test5.C++\n/*c++*/\n")
+test.write('test6'+alt_cpp_suffix, "test6.C\n/*c++*/\n")
test.run(stdout = test.wrap_stdout("""\
-Building shared object test1.obj from test1.cc
-Building shared object test2.obj from test2%(alt_cc_suffix)s
+Building shared object test1.obj from test1.cpp
+Building shared object test2.obj from test2.cc
+Building shared object test3.obj from test3.cxx
+Building shared object test4.obj from test4.c++
+Building shared object test5.obj from test5.C++
+Building shared object test6.obj from test6%(alt_cpp_suffix)s
""" % locals()))
-test.must_match('test1.obj', "test1.cc\n")
-test.must_match('test2.obj', "test2.CC\n")
+test.must_match('test1.obj', "test1.cpp\n")
+test.must_match('test2.obj', "test2.cc\n")
+test.must_match('test3.obj', "test3.cxx\n")
+test.must_match('test4.obj', "test4.c++\n")
+test.must_match('test5.obj', "test5.C++\n")
+test.must_match('test6.obj', "test6.C\n")
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment(M4FLAGS='-DFFF=fff')
+foo = Environment(M4=r'%(m4)s', M4FLAGS='-DFFF=fff')
m4 = foo.Dictionary('M4')
-bar = Environment(M4 = r'%s wrapper.py ' + m4, M4FLAGS='-DBBB=bbb')
+bar = Environment(M4 = r'%(python)s wrapper.py ' + m4, M4FLAGS='-DBBB=bbb')
foo.M4(target = 'foo.x', source = 'foo.x.m4')
bar.M4(target = 'bar', source = 'bar.m4')
-""" % python)
+""" % locals())
test.write('foo.x.m4', "line 1\n"
"FFF\n"
Test based on bug #1055521 filed by Gary Oberbrunner.
"""
+import os.path
+import re
+
import TestSCons
test = TestSCons.TestSCons()
python = TestSCons.python
+re_python = re.escape(python)
test.write("mycc.py", """
print 'Compile'
cpppath = 'dir1/dir2' # note, no leading '#'
test.write('SConstruct', sconstruct % locals() )
+targets = re.escape(os.path.join('dir1', 'dir2'))
+INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2', 'dir1', 'dir2_CNI'))
+
+# The .* after mycc\\.py below handles /nologo flags from Visual C/C++.
test.run(arguments = '',
stdout=test.wrap_stdout("""\
-scons: building associated BuildDir targets: dir1/dir2
-%(python)s mycc.py INC_dir1/dir2/dir1/dir2_CNI .+
+scons: building associated BuildDir targets: %(targets)s
+%(re_python)s mycc\\.py.* %(INC_CNI)s .+
Compile
-%(python)s mylink.py .+
+%(re_python)s mylink\\.py .+
Link
""" % locals()),
match=TestSCons.match_re,
cpppath = '#dir1/dir2' # note leading '#'
test.write('SConstruct', sconstruct % locals() )
+INC_CNI = re.escape(os.path.join('INC_dir1', 'dir2_CNI'))
+
+# The .* after mycc\\.py below handles /nologo flags from Visual C/C++.
test.run(arguments = '',
stdout=test.wrap_stdout("""\
-scons: building associated BuildDir targets: dir1/dir2
-%(python)s mycc.py INC_dir1/dir2_CNI .+
+scons: building associated BuildDir targets: %(targets)s
+%(re_python)s mycc\\.py.* %(INC_CNI)s .+
Compile
-%(python)s mylink.py .+
+%(re_python)s mylink\\.py .+
Link
""" % locals()),
match=TestSCons.match_re,
import os.path
import string
def cat(target, source, env):
- fp = open(str(target[0]), 'w')
+ fp = open(str(target[0]), 'wb')
for s in map(str, source):
- fp.write(open(s).read())
+ fp.write(open(s, 'rb').read())
Cat = Builder(action=cat)
def Wrapper(env, target, source):
if not target:
'zip',
]
-error_output = {
- 'icl' : """
+intel_license_warning = """
scons: warning: Intel license dir was not found. Tried using the INTEL_LICENSE_FILE environment variable (), the registry () and the default path (C:\Program Files\Common Files\Intel\Licenses). Using the default path as a last resort.
File "SConstruct", line 1, in ?
-""",
+"""
+
+error_output = {
+ 'icl' : intel_license_warning,
+ 'intelc' : intel_license_warning,
'qt' : """
scons: warning: Could not detect qt, using empty QTDIR
File "SConstruct", line 1, in ?
import os.path
import os
-env = Environment(CCFLAGS = ' -nologo ', CPPPATH='${TARGET.dir}')
+env = Environment(CCFLAGS = ' -nologo ',
+ CPPPATH = '${TARGET.dir}',
+ MSVS_USE_MFC_DIRS = 1)
Export('env')
BuildDir('build', 'src')
def after(env, target, source):
t = str(target[0])
- a = "after_" + os.path.splitext(t)[0]
+ a = "after_" + t
fin = open(t, "rb")
fout = open(a, "wb")
fout.write(fin.read())
test.write(['work2', 'SConstruct'], """\
def b(target, source, env):
- open(str(target[0]), 'w').write(env['X'] + '\\n')
+ open(str(target[0]), 'wb').write(env['X'] + '\\n')
env1 = Environment(X='111')
env2 = Environment(X='222')
B = Builder(action = b, env = env1, multi=1)