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.
Merge pull request #326 from grissiom/fix-mdk4

tools/keil: preserve the order of CPPPATH