make some language lists at snap build time
This commit is contained in:
parent
8628cbb0b8
commit
5cb37acefc
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import gzip
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
translations = set()
|
||||||
|
for fname in glob.glob('po/*.po'):
|
||||||
|
translations.add(os.path.splitext(os.path.basename(fname))[0])
|
||||||
|
|
||||||
|
print('found translations', translations)
|
||||||
|
|
||||||
|
console_langs = open('languagelist-console', 'w')
|
||||||
|
ssh_langs = open('languagelist-ssh', 'w')
|
||||||
|
data = gzip.open('/usr/share/localechooser/languagelist.data.gz', mode='rt')
|
||||||
|
|
||||||
|
for line in data:
|
||||||
|
level, code, name, desc = line.strip().split(':')
|
||||||
|
if code not in translations:
|
||||||
|
continue
|
||||||
|
level = int(level)
|
||||||
|
new_line = "{}:{}\n".format(code, desc)
|
||||||
|
ssh_langs.write(new_line)
|
||||||
|
if level <= 2:
|
||||||
|
console_langs.write(new_line)
|
||||||
|
|
||||||
|
console_langs.close()
|
||||||
|
ssh_langs.close()
|
||||||
|
data.close()
|
|
@ -124,6 +124,15 @@ parts:
|
||||||
font/subiquity.psf: subiquity.psf
|
font/subiquity.psf: subiquity.psf
|
||||||
stage:
|
stage:
|
||||||
- subiquity.psf
|
- subiquity.psf
|
||||||
|
languagelists:
|
||||||
|
plugin: nil
|
||||||
|
build-packages:
|
||||||
|
- localechooser-data
|
||||||
|
override-build: |
|
||||||
|
scripts/make-language-lists
|
||||||
|
stage:
|
||||||
|
- languagelist-console
|
||||||
|
- languagelist-ssh
|
||||||
probert:
|
probert:
|
||||||
plugin: python
|
plugin: python
|
||||||
build-packages: [python-setuptools, libnl-3-dev, libnl-genl-3-dev, libnl-route-3-dev]
|
build-packages: [python-setuptools, libnl-3-dev, libnl-genl-3-dev, libnl-route-3-dev]
|
||||||
|
|
Loading…
Reference in New Issue