diff options
author | Gaurav Juvekar <gauravjuvekar@gmail.com> | 2017-04-07 08:22:06 (GMT) |
---|---|---|
committer | Gaurav Juvekar <gauravjuvekar@gmail.com> | 2017-04-07 08:22:06 (GMT) |
commit | 16891265ea2e81e03b8bb3d6e30bbc2a2a642ebe (patch) | |
tree | c046a5230994b994e17ec68f34a8f8c76e3d4121 /test/CPPDEFINES | |
parent | ec5cfb99fa60afc33a52bf231f16d44d1f9a0074 (diff) | |
download | SCons-16891265ea2e81e03b8bb3d6e30bbc2a2a642ebe.zip SCons-16891265ea2e81e03b8bb3d6e30bbc2a2a642ebe.tar.gz SCons-16891265ea2e81e03b8bb3d6e30bbc2a2a642ebe.tar.bz2 |
Make __str__ and __repr__ same
Diffstat (limited to 'test/CPPDEFINES')
-rw-r--r-- | test/CPPDEFINES/append.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/CPPDEFINES/append.py b/test/CPPDEFINES/append.py index 04a2d7b..7973f22 100644 --- a/test/CPPDEFINES/append.py +++ b/test/CPPDEFINES/append.py @@ -52,24 +52,22 @@ env_2300_2 = Environment(CPPDEFINES = ['foo'], CPPDEFPREFIX='-D') # note the lis env_2300_2.Append(CPPDEFINES='bar') print(env_2300_2.subst('$_CPPDEFFLAGS')) - +# http://scons.tigris.org/issues/show_bug.cgi?id=1152 +# http://scons.tigris.org/issues/show_bug.cgi?id=2900 # Python3 dicts dont preserve order. Hence we supply subclass of OrderedDict # whose __str__ and __repr__ act like a normal dict. from collections import OrderedDict class OrderedPrintingDict(OrderedDict): - def __str__(self): - return '{' + ', '.join(['%r: %r'%(k, v) for (k, v) in self.items()]) + '}' - def __repr__(self): return '{' + ', '.join(['%r: %r'%(k, v) for (k, v) in self.items()]) + '}' + __str__ = __repr__ + + # Because dict-like objects (except dict and UserDict) are not deep copied + # directly when constructing Environment(CPPDEFINES = OrderedPrintingDict(...)) def __semi_deepcopy__(self): - # Because a dict subclass is not deep copied directly when constructing - # Environment(CPPDEFINES = OrderedPrintingDict(...)) return self.copy() -# http://scons.tigris.org/issues/show_bug.cgi?id=1152 -# http://scons.tigris.org/issues/show_bug.cgi?id=2900 cases=[('string', 'FOO'), ('list', ['NAME1', 'NAME2']), ('list-of-2lists', [('NAME1','VAL1'), ['NAME2','VAL2']]), |