mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Restore building iso639 in develop as it is needed
This commit is contained in:
parent
509cc82d80
commit
bd4e828668
@ -56,7 +56,7 @@ class Develop(Command):
|
|||||||
short_description = 'Setup a development environment for calibre'
|
short_description = 'Setup a development environment for calibre'
|
||||||
MODE = 0o755
|
MODE = 0o755
|
||||||
|
|
||||||
sub_commands = ['build', 'resources', 'gui',]
|
sub_commands = ['build', 'resources', 'iso639', 'gui',]
|
||||||
|
|
||||||
def add_postinstall_options(self, parser):
|
def add_postinstall_options(self, parser):
|
||||||
parser.add_option('--make-errors-fatal', action='store_true', default=False,
|
parser.add_option('--make-errors-fatal', action='store_true', default=False,
|
||||||
|
39178
setup/iso_639_3.xml
Normal file
39178
setup/iso_639_3.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -322,21 +322,24 @@ class GetTranslations(Translations): # {{{
|
|||||||
|
|
||||||
class ISO639(Command): # {{{
|
class ISO639(Command): # {{{
|
||||||
|
|
||||||
description = 'Compile translations for ISO 639 codes'
|
description = 'Compile language code maps for performance'
|
||||||
DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization',
|
DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization',
|
||||||
'iso639.pickle')
|
'iso639.pickle')
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
src = POT.LP_ISO_PATH
|
src = self.j(self.d(self.SRC), 'setup', 'iso_639_3.xml')
|
||||||
if not os.path.exists(src):
|
if not os.path.exists(src):
|
||||||
raise Exception(src + ' does not exist')
|
raise Exception(src + ' does not exist')
|
||||||
dest = self.DEST
|
dest = self.DEST
|
||||||
|
base = self.d(dest)
|
||||||
|
if not os.path.exists(base):
|
||||||
|
os.makedirs(base)
|
||||||
if not self.newer(dest, [src, __file__]):
|
if not self.newer(dest, [src, __file__]):
|
||||||
self.info('Pickled code is up to date')
|
self.info('Pickled code is up to date')
|
||||||
return
|
return
|
||||||
self.info('Pickling ISO-639 codes to', dest)
|
self.info('Pickling ISO-639 codes to', dest)
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
root = etree.fromstring(open(self.j(src, 'iso_639_3.xml'), 'rb').read())
|
root = etree.fromstring(open(src, 'rb').read())
|
||||||
by_2 = {}
|
by_2 = {}
|
||||||
by_3b = {}
|
by_3b = {}
|
||||||
by_3t = {}
|
by_3t = {}
|
||||||
@ -350,7 +353,7 @@ class ISO639(Command): # {{{
|
|||||||
threet = x.get('id')
|
threet = x.get('id')
|
||||||
threeb = x.get('part2_code', None)
|
threeb = x.get('part2_code', None)
|
||||||
if threeb is None:
|
if threeb is None:
|
||||||
# Only recognize langauges in ISO-639-2
|
# Only recognize languages in ISO-639-2
|
||||||
continue
|
continue
|
||||||
name = x.get('name')
|
name = x.get('name')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user