Don’t use global variables to store head and tail of the i18n file

Alexandre Oliva> I see there have been changes since I started the
Alexandre Oliva> review.
Alexandre Oliva>
Alexandre Oliva> The only one that caught my attention was in
Alexandre Oliva> gen-unicode-ctype.py.
Alexandre Oliva>
Alexandre Oliva> I think the single loop in read_input_file would be
Alexandre Oliva> better split into multiple loops, one for head, one
Alexandre Oliva> to skip to tail, one for tail.
Alexandre Oliva>
Alexandre Oliva> Also consider using line.startswith instead of
Alexandre Oliva> regexps for the end-of-head and beginning-of-tail
Alexandre Oliva> markers, unless that risks matching unintended lines.
Alexandre Oliva>
Alexandre Oliva> Finally, consider returning a tuple instead of
Alexandre Oliva> modifying the global variable.
Alexandre Oliva>
Alexandre Oliva> It could end up like this:
Alexandre Oliva>
Alexandre Oliva> def read_input_file(filename):
Alexandre Oliva>   head = tail = ''
Alexandre Oliva>   with open(filename, mode='r') as file:
Alexandre Oliva>     for line in file:
Alexandre Oliva>       match = re.match(
Alexandre Oliva>          r'^(?P<key>date\s+)(?P<value>"[0-9]{4}-[0-9]{2}-[0-9]{2}")',
Alexandre Oliva>          line)
Alexandre Oliva>       if match:
Alexandre Oliva>         line = match.group('key') + '"{:s}"\n'.format(time.strftime('%Y-%m-%d'))
Alexandre Oliva>       head = head + line
Alexandre Oliva>       if (line.startswith('LC_CTYPE'))
Alexandre Oliva>         break
Alexandre Oliva>     for line in file:
Alexandre Oliva>       if (line.startswith('translit_start'))
Alexandre Oliva>         tail = line
Alexandre Oliva>         break
Alexandre Oliva>     for line in file:
Alexandre Oliva>       tail = tail + line
Alexandre Oliva>   return (head, tail)
Alexandre Oliva>
Alexandre Oliva> ...
Alexandre Oliva>
Alexandre Oliva>   (i18n_file_head, i18n_file_tail) = read_input_file(args.input_file)