Skip to content

Commit

Permalink
Cleanup previous PR
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jun 17, 2024
1 parent 42556d3 commit d10c85b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
15 changes: 8 additions & 7 deletions setup/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -373,12 +374,12 @@ def pre_sub_commands(self, opts):
# 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):
Expand Down
15 changes: 7 additions & 8 deletions setup/iso_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>

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:
Expand All @@ -37,7 +37,6 @@ def __init__(self):
super().__init__()
self._zip_data = None
self.top_level = 'iso-codes-main'
self.option_added = False

@property
def zip_data(self):
Expand Down
4 changes: 2 additions & 2 deletions setup/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d10c85b

Please sign in to comment.