diff options
author | Steven Knight <knight@baldmt.com> | 2002-03-22 17:21:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-03-22 17:21:00 (GMT) |
commit | 2b87cbae264462efe494aa7ee07841ffb7ebaa0d (patch) | |
tree | 012844c97585092e3af23aeac926ac2ba8c58712 /src/engine/SCons | |
parent | 8587b92b72c166857467b2f718560148a9549ad3 (diff) | |
download | SCons-2b87cbae264462efe494aa7ee07841ffb7ebaa0d.zip SCons-2b87cbae264462efe494aa7ee07841ffb7ebaa0d.tar.gz SCons-2b87cbae264462efe494aa7ee07841ffb7ebaa0d.tar.bz2 |
Make env['FOO'] by shorthand for env.Dictionary()['FOO'] (Anthony Roach)
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Environment.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index d997d6f..65af179 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -227,6 +227,15 @@ class Environment: dlist = dlist[0] return dlist + def __setitem__(self, key, value): + self._dict[key] = value + + def __getitem__(self, key): + return self._dict[key] + + def __delitem__(self, key): + del self._dict[key] + def Command(self, target, source, action): """Builds the supplied target files from the supplied source files using the supplied action. Action may diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 86f179a..654d432 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -195,6 +195,12 @@ class EnvironmentTestCase(unittest.TestCase): assert env.Dictionary().has_key('CCFLAGS') assert env.Dictionary().has_key('ENV') + assert env['XXX'] == 'x' + env['XXX'] = 'foo' + assert env.Dictionary('XXX') == 'foo' + del env['XXX'] + assert not env.Dictionary().has_key('XXX') + def test_ENV(self): """Test setting the external ENV in Environments """ |