コード例 #1
0
_python_ = TestSCons._python_

test = TestSCons.TestSCons()

test.write(
    'myfc.py', r"""
import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
for l in [l for l in infile.readlines() if l != fline]:
    outfile.write(l)
sys.exit(0)
""")

if not TestSCons.case_sensitive_suffixes('.f', '.F'):
    f90pp = 'f90'
else:
    f90pp = 'f90pp'

test.write(
    'SConstruct', """
env = Environment(SHF90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES',
                  SHF90COMSTR = 'Building f90 $TARGET from $SOURCES',
                  SHF90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES',
                  SHF90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES',
                  SHOBJPREFIX='', SHOBJSUFFIX='.shobj')
env.SharedObject(source = 'test01.f90')
env.SharedObject(source = 'test02.F90')
""" % locals())
コード例 #2
0
ファイル: CXX.py プロジェクト: sergey-d-binary/scons
/*link*/
""")

test.run(arguments='.', stderr=None)

test.must_match('test1' + _exe, "This is a .cc file.\n")

test.must_match('test2' + _exe, "This is a .cpp file.\n")

test.must_match('test3' + _exe, "This is a .cxx file.\n")

test.must_match('test4' + _exe, "This is a .c++ file.\n")

test.must_match('test5' + _exe, "This is a .C++ file.\n")

if TestSCons.case_sensitive_suffixes('.c', '.C'):

    test.write(
        'SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
                  LINKFLAGS = [],
                  CXX = r'%(_python_)s myc++.py',
                  CXXFLAGS = [])
env.Program(target = 'test6', source = 'test6.C')
""" % locals())

    test.write('test6.C', r"""This is a .C file.
/*c++*/
/*link*/
""")
コード例 #3
0
ファイル: CPPFLAGS.py プロジェクト: Distrotech/scons
#c++
#link
""")

test.write('test3.F', r"""test3.F
#g77
#link
""")

test.run(arguments = '.', stderr=None)

test.must_match('test1.obj', "test1.c\n#link\n")
test.must_match('test2.obj', "test2.cpp\n#link\n")
test.must_match('test3.obj', "test3.F\n#link\n")
test.must_match('foo.exe',   "test1.c\ntest2.cpp\ntest3.F\n")
if TestSCons.case_sensitive_suffixes('.F', '.f'):
    test.must_match('mygcc.out', "cc\nc++\ng77\n")
else:
    test.must_match('mygcc.out', "cc\nc++\n")   

test.write('SConstruct', """
env = Environment(CPPFLAGS = '-x',
                  SHLINK = r'%(_python_)s mylink.py',
                  SHLINKFLAGS = [],
                  CC = r'%(_python_)s mygcc.py cc',
                  CXX = r'%(_python_)s mygcc.py c++',
                  CXXFLAGS = [],
                  FORTRAN = r'%(_python_)s mygcc.py g77',
                  OBJSUFFIX = '.obj',
                  SHOBJPREFIX = '',
                  SHOBJSUFFIX = '.shobj',
コード例 #4
0
ファイル: F90COMSTR.py プロジェクト: Distrotech/scons
test = TestSCons.TestSCons()



test.write('myfc.py', r"""
import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
for l in [l for l in infile.readlines() if l != fline]:
    outfile.write(l)
sys.exit(0)
""")

if not TestSCons.case_sensitive_suffixes('.f','.F'):
    f90pp = 'f90'
else:
    f90pp = 'f90pp'

test.write('SConstruct', """
env = Environment(F90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES',
                  F90COMSTR = 'Building f90 $TARGET from $SOURCES',
                  F90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES',
                  F90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES',
                  OBJSUFFIX='.obj')
env.Object(source = 'test01.f90')
env.Object(source = 'test02.F90')
""" % locals())

test.write('test01.f90',        "A .f90 file.\n#f90\n")
コード例 #5
0
ファイル: CXX.py プロジェクト: azatoth/scons
/*link*/
""")

test.run(arguments = '.', stderr = None)

test.must_match('test1' + _exe, "This is a .cc file.\n")

test.must_match('test2' + _exe, "This is a .cpp file.\n")

test.must_match('test3' + _exe, "This is a .cxx file.\n")

test.must_match('test4' + _exe, "This is a .c++ file.\n")

test.must_match('test5' + _exe, "This is a .C++ file.\n")

if TestSCons.case_sensitive_suffixes('.c', '.C'):

    test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
                  LINKFLAGS = [],
                  CXX = r'%(_python_)s myc++.py',
                  CXXFLAGS = [])
env.Program(target = 'test6', source = 'test6.C')
""" % locals())

    test.write('test6.C', r"""This is a .C file.
/*c++*/
/*link*/
""")

    test.run(arguments = '.', stderr = None)
コード例 #6
0
ファイル: ASFLAGS.py プロジェクト: NexMirror/SCons
#link
""")

test.write('test5.spp', r"""This is a .spp file.
#as
#link
""")

test.write('test6.SPP', r"""This is a .SPP file.
#as
#link
""")

test.run(arguments = '.', stderr = None)

if TestSCons.case_sensitive_suffixes('.s', '.S'):
    o_css = o_c
else:
    o_css = o

test.must_match('test1' + _exe, "%s\nThis is a .s file.\n" % o)
test.must_match('test2' + _exe, "%s\nThis is a .S file.\n" % o_css)
test.must_match('test3' + _exe, "%s\nThis is a .asm file.\n" % o)
test.must_match('test4' + _exe, "%s\nThis is a .ASM file.\n" % o)
test.must_match('test5' + _exe, "%s\nThis is a .spp file.\n" % o_c)
test.must_match('test6' + _exe, "%s\nThis is a .SPP file.\n" % o_c)

test.pass_test()

# Local Variables:
# tab-width:4
コード例 #7
0
#c++
#link
""")

test.write('test3.F', r"""test3.F
#g77
#link
""")

test.run(arguments='.', stderr=None)

test.must_match('test1.obj', "test1.c\n#link\n")
test.must_match('test2.obj', "test2.cpp\n#link\n")
test.must_match('test3.obj', "test3.F\n#link\n")
test.must_match('foo.exe', "test1.c\ntest2.cpp\ntest3.F\n")
if TestSCons.case_sensitive_suffixes('.F', '.f'):
    test.must_match('mygcc.out', "cc\nc++\ng77\n")
else:
    test.must_match('mygcc.out', "cc\nc++\n")

test.write(
    'SConstruct', """
env = Environment(CPPFLAGS = '-x',
                  SHLINK = r'%(_python_)s mylink.py',
                  SHLINKFLAGS = [],
                  CC = r'%(_python_)s mygcc.py cc',
                  CXX = r'%(_python_)s mygcc.py c++',
                  CXXFLAGS = [],
                  FORTRAN = r'%(_python_)s mygcc.py g77',
                  OBJSUFFIX = '.obj',
                  SHOBJPREFIX = '',
コード例 #8
0
ファイル: ASFLAGS.py プロジェクト: timj/scons
#link
""")

test.write('test5.spp', r"""This is a .spp file.
#as
#link
""")

test.write('test6.SPP', r"""This is a .SPP file.
#as
#link
""")

test.run(arguments = '.', stderr = None)

if TestSCons.case_sensitive_suffixes('.s', '.S'):
    o_css = o_c
else:
    o_css = o

test.must_match('test1' + _exe, "%s\nThis is a .s file.\n" % o)
test.must_match('test2' + _exe, "%s\nThis is a .S file.\n" % o_css)
test.must_match('test3' + _exe, "%s\nThis is a .asm file.\n" % o)
test.must_match('test4' + _exe, "%s\nThis is a .ASM file.\n" % o)
test.must_match('test5' + _exe, "%s\nThis is a .spp file.\n" % o_c)
test.must_match('test6' + _exe, "%s\nThis is a .SPP file.\n" % o_c)

test.pass_test()

# Local Variables:
# tab-width:4
コード例 #9
0

test.write(
    "myfc.py",
    r"""
import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
for l in [l for l in infile.readlines() if l != fline]:
    outfile.write(l)
sys.exit(0)
""",
)

if not TestSCons.case_sensitive_suffixes(".f", ".F"):
    fortranpp = "fortran"
else:
    fortranpp = "fortranpp"


test.write(
    "SConstruct",
    """
env = Environment(SHFORTRANCOM = r'%(_python_)s myfc.py fortran $TARGET $SOURCES',
                  SHFORTRANCOMSTR = 'Building fortran $TARGET from $SOURCES',
                  SHFORTRANPPCOM = r'%(_python_)s myfc.py fortranpp $TARGET $SOURCES',
                  SHFORTRANPPCOMSTR = 'Building fortranpp $TARGET from $SOURCES',
                  SHOBJPREFIX='', SHOBJSUFFIX='.shobj')
env.SharedObject(source = 'test01.f')
env.SharedObject(source = 'test02.F')