Browse Source

Define order of package fields in merged Translations file.

Under python 3.5.3, the dictionary order is undefined. Ensure that
the Package is the first line in its stanza. APT doesn't seem to mind, but it
makes the file much harder to read.
wip/archive
Mark Hindley 3 years ago
parent
commit
5c5731f741
  1. 6
      amprolla_merge_translations.py

6
amprolla_merge_translations.py

@ -64,9 +64,9 @@ def write_translations(translations, filename):
bz2f = bz2_open(filename, 'w')
for pkg, fields in sorted(translations.items()):
for key in fields.keys():
if key != 'Package' and not key.startswith('Description-'):
continue
ordered_keys = ['Package']
ordered_keys.extend([k for k in fields.keys() if k.startswith('Description-')])
for key in ordered_keys:
line = "%s: %s\n" % (key, fields[key])
bz2f.write(line.encode('utf-8'))
bz2f.write(b'\n')

Loading…
Cancel
Save