tools/keil: preserve the order of CPPPATH

The order of CPPPATH is important: some project would use the order of
CPPPATH to override the default configuration headers. This commit also
refine the this piece of code in a more Pythonic way.