build-and-test: Allow flags to be read from files

Use the built-in support from the argparse module to allow our
subcommand to read flags from configuration files.

This is achieved by specifying a prefix (in our case '@') that indicates
to argparse that it should read arguments from the file ('@filepath'),
one per line.

They are then processed as if they had been given on the command line in
the position where the filename is. This makes it possible for flags in
the file to override or be overriden by flags given on the command line,
depending on their position relative to the filename. Flags that
accumulate all the values that they receive cannot be overriden, but
will instead accumulate everything regardless of whether it came from
the command line or the file.

Change-Id: I22a9a92a0f5ba49dd085ef5860c37bd4fc1009e1
2 files changed