mkenums: Change ordering for template file and arguments
commit77a3a962189df86a48c28a3c35d46575f35f7b95
authorEmmanuele Bassi <ebassi@gnome.org>
Mon, 17 Jul 2017 08:36:13 +0000 (17 09:36 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 17 Jul 2017 08:37:21 +0000 (17 09:37 +0100)
treeec7fe53b636c56962adabeb82c522f88d45c491c
parent5ba3b4022ebda9e1756d568b7baac7f285bfc0b4
mkenums: Change ordering for template file and arguments

This is a bit of a hack to maintain some semblance of backward
compatibility with the old, Perl-based glib-mkenums. The old tool had an
implicit ordering on the arguments and templates; each argument was
parsed in order, and all the strings appended. This allowed developers
to write:

  glib-mkenums \
    --fhead ... \
    --template a-template-file.c.in \
    --ftail ...

And have the fhead be prepended to the file-head stanza in the template,
as well as the ftail be appended to the file-tail stanza in the
template.  Short of throwing away ArgumentParser and going over
sys.argv[] element by element, we can simulate that behaviour by
ensuring some ordering in how we build the template strings:

  - the head stanzas are always prepended to the template
  - the prod stanzas are always appended to the template
  - the tail stanzas are always appended to the template

Within each instance of the command line argument, we append each value
to the array in the order in which it appears on the command line.

This change fixes the libqmi build.
gobject/glib-mkenums.in