diff options
| author | Mats Wichmann <mats@linux.com> | 2022-11-01 15:44:54 (GMT) |
|---|---|---|
| committer | Mats Wichmann <mats@linux.com> | 2023-01-30 19:17:23 (GMT) |
| commit | b28e86d47635d1ae4ae63eac603f166ec7c95221 (patch) | |
| tree | e8ed0f6abd4a1022a0bc7302c652e1dcf7f7b11d /test/Java/java_version_image/src1/Example7.java | |
| parent | 440728dd1d9fee6a8e010b4d9871737686cb3afb (diff) | |
| download | SCons-b28e86d47635d1ae4ae63eac603f166ec7c95221.zip SCons-b28e86d47635d1ae4ae63eac603f166ec7c95221.tar.gz SCons-b28e86d47635d1ae4ae63eac603f166ec7c95221.tar.bz2 | |
Split out CPPDEFINES handling in Append methods
Rather than having lots of special-case code for CPPDEFINES in
four separate routines, add a new _add_cppdefines function to
handle it, paying attention to append/prepend, unique/duplicating,
and keep-original/replace-original. The existing special case handing
was then removed from Append and AppendUnique (it was never present in
Prepend and PrependUnique anyway - see #3876, but these now get it due
to a call to the new function).
Tuple handling is now consistent with list handling: a single tuple is
treated as macro names to add, not as a name=value pair. A tuple or list
has to be a member of a containing tuple or list to get the macro=value
treatment. This *may* affect some existing usage. macro=value tuples
without a value can now be entered either in (macro,) form or (macro,
None) form.
Internally, whenever append/prepend is done, existing contents are
forced to a deque, which allows efficient adding at either end without
resorting to the tricks the Prepend functions currently do (they still
do these tricks, but only in non-CPPDEFINES cases). As a result, values
from a dict are not stored as a dict, which has some effect on ordering:
values will be *consistently* ordered, but the ones from the dict are
no longer necessarily sorted.
In SCons/Defaults.py, processDefines no longer sorts a dict it is
passed, since Python now preserves dict order. This does not affect
the E2E test for CPPDEFINES - since those all call an Append routine,
CPPDEFINES will always be a deque, and so processDefines never sees a
dict in that case. It could well affect real-life usage - if setup of
CPPDEFINES was such that it used to contain a dict with multiple entries,
the order might change (sorting would have presented the keys from that
dict in alphabetical order). This would lead to a one-time rebuild for
actions that change (after that it will remain consistent).
In the E2E test CPPDEFINES/append.py some bits were reformatted, and the
handler routine now accounts for the type being a deque - since the test
does a text comparison of internally produced output, it failed if the
word "deque" appeared. Some new test cases were added to also exercise
strings with spaces embedded in them.
Changes were made to the expected output of the E2E test. These reflect
changes in the way data is now stored in CPPDEFINES, and in some cases
in order. Most of these do not change the meaning (i.e. "result" changes,
but "final" output is the same). These are the exceptions:
- "appending a dict to a list-of-2lists", AppendUnique case: order now
preserved as entered (previously took the order of the appended dict)
- "appending a string to a dict", Append case: not stored as a dict,
so ordering is as originally entered.
- "appending a dict to a dict", Append case: no longer merge into a
dict, so this is now an actual append rather than a merge of dicts which
caused the uniquing effect even without calling AppendUnique (arguably
the old way was incorrect).
A new test/CPPDEFINES/prepend.py is added to test Prepend* cases.
append.py and prepend.py are structured to fetch the SConstruct from a
fixture file.
append.py got an added test in the main text matrix, a string of the
macro=value form. The same 5x5 maxtrix is used in the new prepend.py
test as well ("expected" values for these had to be added as well).
Cosmetically, append and prepend now print their test summary so
strings have quotation marks - the "orig" lines in the expected output
was adjusted. This change looks like:
- orig = FOO, append = FOO
+ orig = 'FOO', append = 'FOO'
The other tests in test/CPPDEFINES got copyright updating and
reformatting, but otherwise do not change.
Documentation updated to clarify behavior.
Fixes #4254
Fixes #3876
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/Java/java_version_image/src1/Example7.java')
0 files changed, 0 insertions, 0 deletions
