Avoid reordering subcommands

This commit is contained in:
wrvsrx 2024-06-17 00:06:11 +08:00
parent 80ff907bfd
commit 342d9f6900
No known key found for this signature in database
4 changed files with 8 additions and 2 deletions

View File

@ -355,7 +355,7 @@ class Bootstrap(Command):
description = 'Bootstrap a fresh checkout of calibre from git to a state where it can be installed. Requires various development tools/libraries/headers' description = 'Bootstrap a fresh checkout of calibre from git to a state where it can be installed. Requires various development tools/libraries/headers'
TRANSLATIONS_REPO = 'kovidgoyal/calibre-translations' TRANSLATIONS_REPO = 'kovidgoyal/calibre-translations'
sub_commands = 'build resources iso639 iso3166 translations gui cacerts recent_uas'.split() sub_commands = 'build iso639 iso3166 translations gui resources cacerts recent_uas'.split()
def add_options(self, parser): def add_options(self, parser):
parser.add_option('--ephemeral', default=False, action='store_true', parser.add_option('--ephemeral', default=False, action='store_true',

View File

@ -16,7 +16,10 @@ class ISOData(Command):
URL = f'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip' URL = f'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip'
def add_options(self, parser): def add_options(self, parser):
if self.option_added:
return
parser.add_option('--path-to-isocodes', help='Path to iso-codes.zip') parser.add_option('--path-to-isocodes', help='Path to iso-codes.zip')
self.option_added = True
def run(self, opts): def run(self, opts):
if self._zip_data is None: if self._zip_data is None:
@ -34,6 +37,7 @@ class ISOData(Command):
super().__init__() super().__init__()
self._zip_data = None self._zip_data = None
self.top_level = 'iso-codes-main' self.top_level = 'iso-codes-main'
self.option_added = False
@property @property
def zip_data(self): def zip_data(self):

View File

@ -213,7 +213,7 @@ class RapydScript(Command): # {{{
class Resources(Command): # {{{ class Resources(Command): # {{{
description = 'Compile various needed calibre resources' description = 'Compile various needed calibre resources'
sub_commands = ['kakasi', 'liberation_fonts', 'mathjax', 'rapydscript', 'hyphenation', 'iso_data'] sub_commands = ['kakasi', 'liberation_fonts', 'mathjax', 'rapydscript', 'hyphenation']
def run(self, opts): def run(self, opts):
from calibre.utils.serialize import msgpack_dumps from calibre.utils.serialize import msgpack_dumps

View File

@ -763,6 +763,7 @@ class GetTranslations(Translations): # {{{
class ISO639(Command): # {{{ class ISO639(Command): # {{{
description = 'Compile language code maps for performance' description = 'Compile language code maps for performance'
sub_commands = ['iso_data']
DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization', DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization',
'iso639.calibre_msgpack') 'iso639.calibre_msgpack')
@ -823,6 +824,7 @@ class ISO639(Command): # {{{
class ISO3166(ISO639): # {{{ class ISO3166(ISO639): # {{{
description = 'Compile country code maps for performance' description = 'Compile country code maps for performance'
sub_commands = ['iso_data']
DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization', DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization',
'iso3166.calibre_msgpack') 'iso3166.calibre_msgpack')