env.SharedObject(target = 'fff.obj', source = 'fff.for')
.EE
+Note that the source files will be scanned
+according to the suffix mappings in
+.B SourceFileScanner
+object.
+See the section "Scanner Objects,"
+below, for a more information.
+
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.IP StaticLibrary()
.IP env.StaticLibrary()
env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
.EE
+Note that the source files will be scanned
+according to the suffix mappings in
+.B SourceFileScanner
+object.
+See the section "Scanner Objects,"
+below, for a more information.
+
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.IP Tar()
.IP env.Tar()
env.Zip('stuff', 'another')
.EE
+All
+targets of builder methods automatically depend on their sources.
+An explicit dependency can
+be specified using the
+.B Depends
+method of a construction environment (see below).
+
+In addition,
.B scons
automatically scans
-C source files, C++ source files,
+source files for various programming languages,
+so the dependencies do not need to be specified explicitly.
+By default, SCons can
+C source files,
+C++ source files,
Fortran source files with
.B .F
(POSIX systems only),
or
.B .SPP
files extensions
-for C preprocessor dependencies,
-so the dependencies do not need to be specified explicitly.
-In addition, all
-targets of builder methods automatically depend on their sources.
-An explicit dependency can
-be specified using the
-.B Depends
-method of a construction environment (see below).
+for C preprocessor dependencies.
+SCons also has default support
+for scanning D source files,
+You can also write your own Scanners
+to add support for additional source file types.
+These can be added to the default
+Scanner object used by
+the
+.BR Object ()
+.BR StaticObject ()
+and
+.BR SharedObject ()
+Builders by adding them
+to the
+.B SourceFileScanner
+object as follows:
+
+See the section "Scanner Objects,"
+below, for a more information about
+defining your own Scanner objects.
.SS Methods and Functions to Do Things
In addition to Builder methods,
specified by the #include lines
in the file being scanned.
+Note that
+.B scons
+has a global
+.B SourceFileScanner
+object that is used by
+the
+.BR Object (),
+.BR SharedObject (),
+and
+.BR StaticObject ()
+builders to decide
+which scanner should be used
+for different file extensions.
+You can using the
+.BR SourceFileScanner.add_scanner ()
+method to add your own Scanner object
+to the
+.B scons
+infrastructure
+that builds target programs or
+libraries from a list of
+source files of different types:
+
+.ES
+def xyz_scan(node, env, path):
+ contents = node.get_contents()
+ # Scan the contents and return the included files.
+
+XYZScanner = Scanner(xyz_scan)
+
+SourceFileScanner.add_scanner('.xyx', XYZScanner)
+
+env.Program('my_prog', ['file1.c', 'file2.f', 'file3.xyz'])
+.EE
+
.SH SYSTEM-SPECIFIC BEHAVIOR
SCons and its configuration files are very portable,
due largely to its implementation in Python.
- When scanning, don't create Nodes for include files that don't
actually exist on disk.
+ - Make supported global variables CScanner, DScanner, ProgramScanner and
+ SourceFileScanner. Make SourceFileScanner.add_scanner() a supported
+ part of the public interface. Keep the old SCons.Defaults.*Scan names
+ around for a while longer since some people were already using them.
+
From Wayne Lee:
- Avoid "maximum recursion limit" errors when removing $(-$) pairs
changed. This change *only* affects any cases where you explicitly
use UserList objects to initialize or append to a variable.
+ Please note the following planned, future changes:
+
+ - Several internal variable names in SCons.Defaults for various
+ pre-made default Scanner objects have been deprecated and will
+ be removed in a future revision. In their place are several new
+ global variable names that are now part of the publicly-supported
+ interface:
+
+ NEW NAME DEPRECATED NAME
+ -------- ----------------------------
+ CScanner SCons.Defaults.CScan
+ DSCanner SCons.Defaults.DScan
+ SourceFileScanner SCons.Defaults.ObjSourceScan
+ ProgramScanner SCons.Defaults.ProgScan
+
+ Of these, only ObjSourceScan was probably used at all, to add
+ new mappings of file suffixes to other scanners for use by the
+ Object() Builder. This should now be done as follows:
+
+ SourceFileScanner.add_scanner('.x', XScanner)
+
SCons is developed with an extensive regression test suite, and a
rigorous development methodology for continually improving that suite.
Because of this, SCons is of sufficient quality that you can use it
import SCons.Action
import SCons.Builder
import SCons.Environment
-import SCons.Scanner.C
-import SCons.Scanner.D
-import SCons.Scanner.Prog
+import SCons.Tool
import SCons.Sig
# A placeholder for a default Environment (for fetching source files
SharedCheck = SCons.Action.Action(SharedFlagChecker, None)
-# Scanners and suffixes for common languages.
-ObjSourceScan = SCons.Scanner.Scanner({}, name='ObjSrcScanner')
-
-CScan = SCons.Scanner.C.CScan()
-
-CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
- ".h", ".H", ".hxx", ".hpp", ".hh",
- ".F", ".fpp", ".FPP",
- ".S", ".spp", ".SPP"]
-
-for suffix in CSuffixes:
- ObjSourceScan.add_scanner(suffix, CScan)
-
-DScan = SCons.Scanner.D.DScan()
-
-DSuffixes = ['.d']
-
-for suffix in DSuffixes:
- ObjSourceScan.add_scanner(suffix, DScan)
-
-IDLSuffixes = [".idl", ".IDL"]
-
-# cleanup
-del suffix
+# Some people were using these variable name before we made
+# SourceFileScanner part of the public interface. Don't break their
+# SConscript files until we've given them some fair warning and a
+# transition period.
+CScan = SCons.Tool.CScanner
+DScan = SCons.Tool.DScanner
+ObjSourceScan = SCons.Tool.SourceFileScanner
+ProgScan = SCons.Tool.ProgramScanner
# Actions for common languages.
CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR")
LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR")
YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR")
-ProgScan = SCons.Scanner.Prog.ProgScan()
-
def DVI():
"""Common function to generate a DVI file Builder."""
return SCons.Builder.Builder(action = {},
ConstructionEnvironment = {
'BUILDERS' : {},
'SCANNERS' : [],
- 'CPPSUFFIXES' : CSuffixes,
- 'DSUFFIXES' : DSuffixes,
- 'IDLSUFFIXES' : IDLSuffixes,
+ 'CPPSUFFIXES' : SCons.Tool.CSuffixes,
+ 'DSUFFIXES' : SCons.Tool.DSuffixes,
+ 'IDLSUFFIXES' : SCons.Tool.IDLSuffixes,
'PDFPREFIX' : '',
'PDFSUFFIX' : '.pdf',
'PSPREFIX' : '',
import SCons.Node.FS
import SCons.Scanner
-def CScan(fs = SCons.Node.FS.default_fs):
+def CScanner(fs = SCons.Node.FS.default_fs):
"""Return a prototype Scanner instance for scanning source files
that use the C pre-processor"""
- cs = SCons.Scanner.ClassicCPP("CScan",
+ cs = SCons.Scanner.ClassicCPP("CScanner",
"$CPPSUFFIXES",
"CPPPATH",
'^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")',
class CScannerTestCase1(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f1.cpp'), env, path)
headers = ['f1.h', 'f2.h']
class CScannerTestCase2(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[test.workpath("d1")])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f1.cpp'), env, path)
headers = ['f1.h', 'd1/f2.h']
class CScannerTestCase3(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[test.workpath("d1")])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f2.cpp'), env, path)
headers = ['d1/f1.h', 'f1.h', 'd1/d2/f1.h']
class CScannerTestCase4(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[test.workpath("d1"), test.workpath("d1/d2")])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f2.cpp'), env, path)
headers = ['d1/f1.h', 'f1.h', 'd1/d2/f1.h', 'd1/d2/f4.h']
class CScannerTestCase5(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
n = make_node('f3.cpp')
def runTest(self):
env1 = DummyEnvironment(CPPPATH=[test.workpath("d1")])
env2 = DummyEnvironment(CPPPATH=[test.workpath("d1/d2")])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path1 = s.path(env1)
path2 = s.path(env2)
deps1 = s(make_node('f1.cpp'), env1, path1)
def runTest(self):
fs = SCons.Node.FS.FS(test.workpath(''))
env = DummyEnvironment(CPPPATH=["include"])
- s = SCons.Scanner.C.CScan(fs = fs)
+ s = SCons.Scanner.C.CScanner(fs = fs)
path = s.path(env)
deps1 = s(fs.File('fa.cpp'), env, path)
fs.chdir(fs.Dir('subdir'))
test.write('fa.h','\n')
fs = SCons.Node.FS.FS(test.workpath(''))
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan(fs=fs)
+ s = SCons.Scanner.C.CScanner(fs=fs)
path = s.path(env)
deps = s(fs.File('fa.cpp'), env, path)
fs = SCons.Node.FS.FS(test.workpath(''))
fs.chdir(fs.Dir('include'))
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan(fs=fs)
+ s = SCons.Scanner.C.CScanner(fs=fs)
path = s.path(env)
test.write('include/fa.cpp', test.read('fa.cpp'))
fs.chdir(fs.Dir('..'))
f1=fs.File('include2/jjj.h')
f1.builder=1
env = DummyEnvironment(CPPPATH=['include', 'include2'])
- s = SCons.Scanner.C.CScan(fs=fs)
+ s = SCons.Scanner.C.CScanner(fs=fs)
path = s.path(env)
deps = s(fs.File('src/fff.c'), env, path)
deps_match(self, deps, [ test.workpath('repository/include/iii.h'), 'include2/jjj.h' ])
fs.BuildDir('build2', 'src', 0)
fs.Repository(test.workpath('repository'))
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan(fs = fs)
+ s = SCons.Scanner.C.CScanner(fs = fs)
path = s.path(env)
deps1 = s(fs.File('build1/aaa.c'), env, path)
deps_match(self, deps1, [ 'build1/bbb.h' ])
def subst(self, arg, test=test):
return test.workpath("d1")
env = SubstEnvironment(CPPPATH=["blah"])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f1.cpp'), env, path)
headers = ['f1.h', 'd1/f2.h']
class CScannerTestCase14(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(CPPPATH=[])
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
path = s.path(env)
deps = s(make_node('f5.c'), env, path)
headers = ['f5a.h', 'f5b.h']
".F", ".fpp", ".FPP",
".S", ".spp", ".SPP"]
env = DummyEnvironment(CPPSUFFIXES = suffixes)
- s = SCons.Scanner.C.CScan()
+ s = SCons.Scanner.C.CScanner()
for suffix in suffixes:
assert suffix in s.get_skeys(env), "%s not in skeys" % suffix
import SCons.Scanner
-def DScan(fs = SCons.Node.FS.default_fs):
+def DScanner(fs = SCons.Node.FS.default_fs):
"""Return a prototype Scanner instance for scanning D source files"""
- ds = DScanner(name = "DScan",
- suffixes = '$DSUFFIXES',
- path_variable = 'DPATH',
- regex = 'import\s+([^\;]*)\;',
- fs = fs)
+ ds = D(name = "DScanner",
+ suffixes = '$DSUFFIXES',
+ path_variable = 'DPATH',
+ regex = 'import\s+([^\;]*)\;',
+ fs = fs)
return ds
-class DScanner(SCons.Scanner.Classic):
+class D(SCons.Scanner.Classic):
def find_include(self, include, source_dir, path):
if callable(path): path=path()
# translate dots (package separators) to slashes
# global, set by --debug=findlibs
print_find_libs = None
-def ProgScan(fs = SCons.Node.FS.default_fs, **kw):
+def ProgramScanner(fs = SCons.Node.FS.default_fs, **kw):
"""Return a prototype Scanner instance for scanning executable
files for static-lib dependencies"""
kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH', fs)
- ps = apply(SCons.Scanner.Base, [scan, "ProgScan"], kw)
+ ps = apply(SCons.Scanner.Base, [scan, "ProgramScanner"], kw)
return ps
def scan(node, env, libpath = (), fs = SCons.Node.FS.default_fs):
# define some tests:
-class ProgScanTestCase1(unittest.TestCase):
+class ProgramScannerTestCase1(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
LIBS=[ 'l1', 'l2', 'l3' ])
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['l1.lib']), map(str, deps)
env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
LIBS='l1')
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['l1.lib']), map(str, deps)
f1 = SCons.Node.FS.default_fs.File(test.workpath('f1'))
env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
LIBS=[f1])
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps[0] is f1, deps
f2 = SCons.Node.FS.default_fs.File(test.workpath('f1'))
env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
LIBS=f2)
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps[0] is f2, deps
-class ProgScanTestCase2(unittest.TestCase):
+class ProgramScannerTestCase2(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=map(test.workpath,
["", "d1", "d1/d2" ]),
LIBS=[ 'l1', 'l2', 'l3' ])
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['l1.lib', 'd1/l2.lib', 'd1/d2/l3.lib' ]), map(str, deps)
-class ProgScanTestCase3(unittest.TestCase):
+class ProgramScannerTestCase3(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=[test.workpath("d1/d2"),
test.workpath("d1")],
LIBS=string.split('l2 l3'))
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['d1/l2.lib', 'd1/d2/l3.lib']), map(str, deps)
-class ProgScanTestCase5(unittest.TestCase):
+class ProgramScannerTestCase5(unittest.TestCase):
def runTest(self):
class SubstEnvironment(DummyEnvironment):
def subst(self, arg, path=test.workpath("d1")):
return arg
env = SubstEnvironment(LIBPATH=[ "blah" ],
LIBS=string.split('l2 l3'))
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, [ 'd1/l2.lib' ]), map(str, deps)
-class ProgScanTestCase6(unittest.TestCase):
+class ProgramScannerTestCase6(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ],
LIBS=['foo', 'sub/libbar', 'xyz.other'],
LIBPREFIXES=['lib'],
LIBSUFFIXES=['.a'])
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), map(str, deps)
-class ProgScanTestCase7(unittest.TestCase):
+class ProgramScannerTestCase7(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ],
LIBS=['foo', '$LIBBAR', '$XYZ'],
LIBSUFFIXES=['.a'],
LIBBAR='sub/libbar',
XYZ='xyz.other')
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), map(str, deps)
-class ProgScanTestCase8(unittest.TestCase):
+class ProgramScannerTestCase8(unittest.TestCase):
def runTest(self):
n1 = DummyNode('n1')
LIBS=[n1],
LIBPREFIXES=['p1-', 'p2-'],
LIBSUFFIXES=['.1', '2'])
- s = SCons.Scanner.Prog.ProgScan(node_class = DummyNode)
+ s = SCons.Scanner.Prog.ProgramScanner(node_class = DummyNode)
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps == [n1], deps
LIBS=[n1, [n2]],
LIBPREFIXES=['p1-', 'p2-'],
LIBSUFFIXES=['.1', '2'])
- s = SCons.Scanner.Prog.ProgScan(node_class = DummyNode)
+ s = SCons.Scanner.Prog.ProgramScanner(node_class = DummyNode)
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps == [n1, n2], deps
def suite():
suite = unittest.TestSuite()
- suite.addTest(ProgScanTestCase1())
- suite.addTest(ProgScanTestCase2())
- suite.addTest(ProgScanTestCase3())
- suite.addTest(ProgScanTestCase5())
- suite.addTest(ProgScanTestCase6())
- suite.addTest(ProgScanTestCase7())
- suite.addTest(ProgScanTestCase8())
+ suite.addTest(ProgramScannerTestCase1())
+ suite.addTest(ProgramScannerTestCase2())
+ suite.addTest(ProgramScannerTestCase3())
+ suite.addTest(ProgramScannerTestCase5())
+ suite.addTest(ProgramScannerTestCase6())
+ suite.addTest(ProgramScannerTestCase7())
+ suite.addTest(ProgramScannerTestCase8())
if hasattr(types, 'UnicodeType'):
code = """if 1:
- class ProgScanTestCase4(unittest.TestCase):
+ class ProgramScannerTestCase4(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=[test.workpath("d1/d2"),
test.workpath("d1")],
LIBS=string.split(u'l2 l3'))
- s = SCons.Scanner.Prog.ProgScan()
+ s = SCons.Scanner.Prog.ProgramScanner()
path = s.path(env)
deps = s(DummyNode('dummy'), env, path)
assert deps_match(deps, ['d1/l2.lib', 'd1/d2/l3.lib']), map(str, deps)
- suite.addTest(ProgScanTestCase4())
+ suite.addTest(ProgramScannerTestCase4())
\n"""
exec code
return suite
Move = SCons.Defaults.Move
Touch = SCons.Defaults.Touch
+# Pre-made, public scanners.
+CScanner = SCons.Tool.CScanner
+DScanner = SCons.Tool.DScanner
+ProgramScanner = SCons.Tool.ProgramScanner
+SourceFileScanner = SCons.Tool.SourceFileScanner
+
# Functions we might still convert to Environment methods.
CScan = SCons.Defaults.CScan
DefaultEnvironment = SCons.Defaults.DefaultEnvironment
import sys
import SCons.Errors
-import SCons.Defaults
+import SCons.Scanner
+import SCons.Scanner.C
+import SCons.Scanner.D
+import SCons.Scanner.Prog
+
+CScanner = SCons.Scanner.C.CScanner()
+DScanner = SCons.Scanner.D.DScanner()
+ProgramScanner = SCons.Scanner.Prog.ProgramScanner()
+SourceFileScanner = SCons.Scanner.Scanner({}, name='SourceFileScanner')
+
+CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
+ ".h", ".H", ".hxx", ".hpp", ".hh",
+ ".F", ".fpp", ".FPP",
+ ".S", ".spp", ".SPP"]
+
+DSuffixes = ['.d']
+
+IDLSuffixes = [".idl", ".IDL"]
+
+for suffix in CSuffixes:
+ SourceFileScanner.add_scanner(suffix, CScanner)
+
+for suffix in DSuffixes:
+ SourceFileScanner.add_scanner(suffix, DScanner)
class ToolSpec:
def __init__(self, name, **kw):
try:
program = env['BUILDERS']['Program']
except KeyError:
+ import SCons.Defaults
program = SCons.Builder.Builder(action = SCons.Defaults.LinkAction,
emitter = '$PROGEMITTER',
prefix = '$PROGPREFIX',
suffix = '$PROGSUFFIX',
src_suffix = '$OBJSUFFIX',
src_builder = 'Object',
- target_scanner = SCons.Defaults.ProgScan)
+ target_scanner = ProgramScanner)
env['BUILDERS']['Program'] = program
return program
try:
static_lib = env['BUILDERS']['StaticLibrary']
except KeyError:
+ import SCons.Defaults
static_lib = SCons.Builder.Builder(action = SCons.Defaults.ArAction,
emitter = '$LIBEMITTER',
prefix = '$LIBPREFIX',
try:
shared_lib = env['BUILDERS']['SharedLibrary']
except KeyError:
+ import SCons.Defaults
action_list = [ SCons.Defaults.SharedCheck,
SCons.Defaults.ShLinkAction ]
shared_lib = SCons.Builder.Builder(action = action_list,
emitter = "$SHLIBEMITTER",
prefix = '$SHLIBPREFIX',
suffix = '$SHLIBSUFFIX',
- target_scanner = SCons.Defaults.ProgScan,
+ target_scanner = ProgramScanner,
src_suffix = '$SHOBJSUFFIX',
src_builder = 'SharedObject')
env['BUILDERS']['SharedLibrary'] = shared_lib
try:
ld_module = env['BUILDERS']['LoadableModule']
except KeyError:
+ import SCons.Defaults
action_list = [ SCons.Defaults.SharedCheck,
SCons.Defaults.LdModuleLinkAction ]
ld_module = SCons.Builder.Builder(action = action_list,
emitter = "$SHLIBEMITTER",
prefix = '$LDMODULEPREFIX',
suffix = '$LDMODULESUFFIX',
- target_scanner = SCons.Defaults.ProgScan,
+ target_scanner = ProgramScanner,
src_suffix = '$SHOBJSUFFIX',
src_builder = 'SharedObject')
env['BUILDERS']['LoadableModule'] = ld_module
The return is a 2-tuple of (StaticObject, SharedObject)
"""
+
try:
static_obj = env['BUILDERS']['StaticObject']
except KeyError:
prefix = '$OBJPREFIX',
suffix = '$OBJSUFFIX',
src_builder = ['CFile', 'CXXFile'],
- source_scanner = SCons.Defaults.ObjSourceScan, single_source=1)
+ source_scanner = SourceFileScanner,
+ single_source = 1)
env['BUILDERS']['StaticObject'] = static_obj
env['BUILDERS']['Object'] = static_obj
prefix = '$SHOBJPREFIX',
suffix = '$SHOBJSUFFIX',
src_builder = ['CFile', 'CXXFile'],
- source_scanner = SCons.Defaults.ObjSourceScan, single_source=1)
+ source_scanner = SourceFileScanner,
+ single_source = 1)
env['BUILDERS']['SharedObject'] = shared_obj
return (static_obj, shared_obj)
F77Scan = SCons.Scanner.Fortran.FortranScan("F77PATH")
for suffix in F77Suffixes + F77PPSuffixes:
- SCons.Defaults.ObjSourceScan.add_scanner(suffix, F77Scan)
+ SCons.Tool.SourceFileScanner.add_scanner(suffix, F77Scan)
#
fVLG = fortran.VariableListGenerator
F90Scan = SCons.Scanner.Fortran.FortranScan("F90PATH")
for suffix in F90Suffixes + F90PPSuffixes:
- SCons.Defaults.ObjSourceScan.add_scanner(suffix, F90Scan)
+ SCons.Tool.SourceFileScanner.add_scanner(suffix, F90Scan)
#
fVLG = fortran.VariableListGenerator
F95Scan = SCons.Scanner.Fortran.FortranScan("F95PATH")
for suffix in F95Suffixes + F95PPSuffixes:
- SCons.Defaults.ObjSourceScan.add_scanner(suffix, F95Scan)
+ SCons.Tool.SourceFileScanner.add_scanner(suffix, F95Scan)
#
fVLG = fortran.VariableListGenerator
FortranScan = SCons.Scanner.Fortran.FortranScan("FORTRANPATH")
for suffix in FortranSuffixes + FortranPPSuffixes:
- SCons.Defaults.ObjSourceScan.add_scanner(suffix, FortranScan)
+ SCons.Tool.SourceFileScanner.add_scanner(suffix, FortranScan)
#
def _fortranEmitter(target, source, env):
def generate(env):
"""Add Builders and construction variables for ifl to an Environment."""
- SCons.Defaults.ObjSourceScan.add_scanner('.i90', fortran.FortranScan)
+ SCons.Tool.SourceFileScanner.add_scanner('.i90', fortran.FortranScan)
fortran.FortranSuffixes.extend(['.i90'])
fortran.generate(env)
"""Add Builders and construction variables for ifort to an Environment."""
# ifort supports Fortran 90 and Fortran 95
# Additionally, ifort recognizes more file extensions.
- SCons.Defaults.ObjSourceScan.add_scanner('.i', fortran.FortranScan)
- SCons.Defaults.ObjSourceScan.add_scanner('.i90', fortran.FortranScan)
+ SCons.Tool.SourceFileScanner.add_scanner('.i', fortran.FortranScan)
+ SCons.Tool.SourceFileScanner.add_scanner('.i90', fortran.FortranScan)
fortran.FortranSuffixes.extend(['.i', '.i90'])
fortran.generate(env)
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
res_builder = SCons.Builder.Builder(action=res_action, suffix='.o',
- source_scanner=SCons.Defaults.ObjSourceScan)
-SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan)
+ source_scanner=SCons.Tool.SourceFileScanner)
+SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan)
def generate(env):
mingw = find(env)
pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR')
pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch',
emitter=pch_emitter,
- source_scanner=SCons.Defaults.ObjSourceScan)
+ source_scanner=SCons.Tool.SourceFileScanner)
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
res_builder = SCons.Builder.Builder(action=res_action, suffix='.res',
- source_scanner=SCons.Defaults.ObjSourceScan)
-SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan)
+ source_scanner=SCons.Tool.SourceFileScanner)
+SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan)
def generate(env):
"""Add Builders and construction variables for MSVC++ to an Environment."""