diff --git a/setup/install.py b/setup/install.py index 2afcb58750..38930b5595 100644 --- a/setup/install.py +++ b/setup/install.py @@ -360,7 +360,8 @@ class Bootstrap(Command): def add_options(self, parser): parser.add_option('--ephemeral', default=False, action='store_true', help='Do not download all history for the translations. Speeds up first time download but subsequent downloads will be slower.') - parser.add_option('--path-to-translations', help='Path to sources of translations') + parser.add_option('--path-to-translations', + help='Path to existing out-of-tree translations checkout. Use this to avoid downloading translations at all.') def pre_sub_commands(self, opts): tdir = self.j(self.d(self.SRC), 'translations') @@ -373,12 +374,12 @@ class Bootstrap(Command): # Change permissions for the top-level folder os.chmod(tdir, 0o755) for root, dirs, files in os.walk(tdir): - # set perms on sub-directories - for momo in dirs: - os.chmod(os.path.join(root, momo), 0o755) - # set perms on files - for momo in files: - os.chmod(os.path.join(root, momo), 0o644) + # set perms on sub-directories + for momo in dirs: + os.chmod(os.path.join(root, momo), 0o755) + # set perms on files + for momo in files: + os.chmod(os.path.join(root, momo), 0o644) elif opts.ephemeral: if os.path.exists(tdir): diff --git a/setup/iso_codes.py b/setup/iso_codes.py index 114fc5f832..f9ebbdef88 100644 --- a/setup/iso_codes.py +++ b/setup/iso_codes.py @@ -2,24 +2,24 @@ # License: GPLv3 Copyright: 2023, Kovid Goyal import fnmatch +import optparse import os import shutil import time import zipfile +from contextlib import suppress from io import BytesIO -from setup import download_securely, Command +from setup import Command, download_securely class ISOData(Command): - description = 'Get iso-codes data' - URL = f'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip' + description = 'Get ISO codes name localization data' + URL = '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 + with suppress(optparse.OptionConflictError): # ignore if option already added + parser.add_option('--path-to-isocodes', help='Path to previously downloaded iso-codes-main.zip') def run(self, opts): if self._zip_data is None: @@ -37,7 +37,6 @@ 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 5507779684..62af4882ed 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -142,7 +142,7 @@ class CACerts(Command): # {{{ CA_PATH = os.path.join(Command.RESOURCES, 'mozilla-ca-certs.pem') def add_options(self, parser): - parser.add_option('--path-to-cacerts', help='Path to mozilla-ca-certs.pem') + parser.add_option('--path-to-cacerts', help='Path to previously downloaded mozilla-ca-certs.pem') def run(self, opts): if opts.path_to_cacerts: @@ -177,7 +177,7 @@ class RecentUAs(Command): # {{{ UA_PATH = os.path.join(Command.RESOURCES, 'user-agent-data.json') def add_options(self, parser): - parser.add_option('--path-to-user-agent-data', help='Path to user-agent-data.json') + parser.add_option('--path-to-user-agent-data', help='Path to previously downloaded user-agent-data.json') def run(self, opts): from setup.browser_data import get_data