mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanup previous PR
This commit is contained in:
parent
42556d3f23
commit
d10c85ba5d
@ -360,7 +360,8 @@ class Bootstrap(Command):
|
|||||||
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',
|
||||||
help='Do not download all history for the translations. Speeds up first time download but subsequent downloads will be slower.')
|
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):
|
def pre_sub_commands(self, opts):
|
||||||
tdir = self.j(self.d(self.SRC), 'translations')
|
tdir = self.j(self.d(self.SRC), 'translations')
|
||||||
@ -373,12 +374,12 @@ class Bootstrap(Command):
|
|||||||
# Change permissions for the top-level folder
|
# Change permissions for the top-level folder
|
||||||
os.chmod(tdir, 0o755)
|
os.chmod(tdir, 0o755)
|
||||||
for root, dirs, files in os.walk(tdir):
|
for root, dirs, files in os.walk(tdir):
|
||||||
# set perms on sub-directories
|
# set perms on sub-directories
|
||||||
for momo in dirs:
|
for momo in dirs:
|
||||||
os.chmod(os.path.join(root, momo), 0o755)
|
os.chmod(os.path.join(root, momo), 0o755)
|
||||||
# set perms on files
|
# set perms on files
|
||||||
for momo in files:
|
for momo in files:
|
||||||
os.chmod(os.path.join(root, momo), 0o644)
|
os.chmod(os.path.join(root, momo), 0o644)
|
||||||
|
|
||||||
elif opts.ephemeral:
|
elif opts.ephemeral:
|
||||||
if os.path.exists(tdir):
|
if os.path.exists(tdir):
|
||||||
|
@ -2,24 +2,24 @@
|
|||||||
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import optparse
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from contextlib import suppress
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from setup import download_securely, Command
|
from setup import Command, download_securely
|
||||||
|
|
||||||
|
|
||||||
class ISOData(Command):
|
class ISOData(Command):
|
||||||
description = 'Get iso-codes data'
|
description = 'Get ISO codes name localization data'
|
||||||
URL = f'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip'
|
URL = '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:
|
with suppress(optparse.OptionConflictError): # ignore if option already added
|
||||||
return
|
parser.add_option('--path-to-isocodes', help='Path to previously downloaded iso-codes-main.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:
|
||||||
@ -37,7 +37,6 @@ 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):
|
||||||
|
@ -142,7 +142,7 @@ class CACerts(Command): # {{{
|
|||||||
CA_PATH = os.path.join(Command.RESOURCES, 'mozilla-ca-certs.pem')
|
CA_PATH = os.path.join(Command.RESOURCES, 'mozilla-ca-certs.pem')
|
||||||
|
|
||||||
def add_options(self, parser):
|
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):
|
def run(self, opts):
|
||||||
if opts.path_to_cacerts:
|
if opts.path_to_cacerts:
|
||||||
@ -177,7 +177,7 @@ class RecentUAs(Command): # {{{
|
|||||||
UA_PATH = os.path.join(Command.RESOURCES, 'user-agent-data.json')
|
UA_PATH = os.path.join(Command.RESOURCES, 'user-agent-data.json')
|
||||||
|
|
||||||
def add_options(self, parser):
|
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):
|
def run(self, opts):
|
||||||
from setup.browser_data import get_data
|
from setup.browser_data import get_data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user