From 342d9f69008e583f7c95d992907960dc34a0934c Mon Sep 17 00:00:00 2001 From: wrvsrx Date: Mon, 17 Jun 2024 00:06:11 +0800 Subject: [PATCH] Avoid reordering subcommands --- setup/install.py | 2 +- setup/iso_codes.py | 4 ++++ setup/resources.py | 2 +- setup/translations.py | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/setup/install.py b/setup/install.py index 2074abb337..2afcb58750 100644 --- a/setup/install.py +++ b/setup/install.py @@ -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' 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): parser.add_option('--ephemeral', default=False, action='store_true', diff --git a/setup/iso_codes.py b/setup/iso_codes.py index b50e8497db..114fc5f832 100644 --- a/setup/iso_codes.py +++ b/setup/iso_codes.py @@ -16,7 +16,10 @@ class ISOData(Command): URL = f'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip' def add_options(self, parser): + if self.option_added: + return parser.add_option('--path-to-isocodes', help='Path to iso-codes.zip') + self.option_added = True def run(self, opts): if self._zip_data is None: @@ -34,6 +37,7 @@ class ISOData(Command): super().__init__() self._zip_data = None self.top_level = 'iso-codes-main' + self.option_added = False @property def zip_data(self): diff --git a/setup/resources.py b/setup/resources.py index 9f9a198aaa..5507779684 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -213,7 +213,7 @@ class RapydScript(Command): # {{{ class Resources(Command): # {{{ 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): from calibre.utils.serialize import msgpack_dumps diff --git a/setup/translations.py b/setup/translations.py index 81fd3da758..8f19527684 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -763,6 +763,7 @@ class GetTranslations(Translations): # {{{ class ISO639(Command): # {{{ description = 'Compile language code maps for performance' + sub_commands = ['iso_data'] DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization', 'iso639.calibre_msgpack') @@ -823,6 +824,7 @@ class ISO639(Command): # {{{ class ISO3166(ISO639): # {{{ description = 'Compile country code maps for performance' + sub_commands = ['iso_data'] DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization', 'iso3166.calibre_msgpack')