that are useful in many situations;
see "File and Directory Nodes," below.
+'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.TP
+.RI env.Dump([ key ])
+Returns a pretty printable representation of the environment.
+.IR key ,
+if not
+.IR None ,
+should be a string containing the name of the variable of interest.
+
+This SConstruct:
+.ES
+env=Environment()
+print env.Dump('CCCOM')
+.EE
+will print:
+.ES
+'$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
+.EE
+
+.ES
+env=Environment()
+print env.Dump()
+.EE
+will print:
+.ES
+{ 'AR': 'ar',
+ 'ARCOM': '$AR $ARFLAGS $TARGET $SOURCES\n$RANLIB $RANLIBFLAGS $TARGET',
+ 'ARFLAGS': ['r'],
+ 'AS': 'as',
+ 'ASCOM': '$AS $ASFLAGS -o $TARGET $SOURCES',
+ 'ASFLAGS': [],
+ ...
+.EE
+
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
.RI EnsurePythonVersion( major ", " minor )
RELEASE 0.97 - XXX
+ From Gary Oberbrunner:
+
+ - Add an Environment.Dump() method to print the contents of a
+ construction environment.
+
+
+
+RELEASE 0.96.1 - XXX
+
From Craig Bachelor:
- Handle white space in the executable Python path name within in MSVS
dlist = dlist[0]
return dlist
+ def Dump(self, key = None):
+ """
+ Using the standard Python pretty printer, dump the contents of the
+ scons build environment to stdout.
+
+ If the key passed in is anything other than None, then that will
+ be used as an index into the build environment dictionary and
+ whatever is found there will be fed into the pretty printer. Note
+ that this key is case sensitive.
+ """
+ import pprint
+ pp = pprint.PrettyPrinter(indent=2)
+ if key:
+ dict = self.Dictionary(key)
+ else:
+ dict = self.Dictionary()
+ return pp.pformat(dict)
+
def FindIxes(self, paths, prefix, suffix):
"""
Search a list of paths for something that matches the prefix and suffix.
d = env.Dir('${BAR}_$BAR')
assert d == 'Dir(bardir_bardir)', d
+ def test_Dump(self):
+ """Test the Dump() method"""
+
+ env = Environment(FOO = 'foo')
+ assert env.Dump('FOO') == "'foo'", env.Dump('FOO')
+ assert len(env.Dump()) > 200, env.Dump() # no args version
+
def test_Environment(self):
"""Test the Environment() method"""
env = Environment(FOO = 'xxx', BAR = 'yyy')