diff --git a/install_texlive/__init__.py b/install_texlive/__init__.py index e98c85f..dcb77fd 100644 --- a/install_texlive/__init__.py +++ b/install_texlive/__init__.py @@ -29,11 +29,12 @@ def is_current(version): return current_version == version -def download(version=None, outdir='.'): +def download(version=None, outdir='.', url=None): os.makedirs(outdir, exist_ok=True) if version is None or is_current(version): - url = URL + 'install-tl-unx.tar.gz' + url = url or URL + url = url.rstrip("/") + '/install-tl-unx.tar.gz' else: url = OLDURL.format(v=version) + 'install-tl-unx.tar.gz' diff --git a/install_texlive/__main__.py b/install_texlive/__main__.py index 043a745..1cc5495 100644 --- a/install_texlive/__main__.py +++ b/install_texlive/__main__.py @@ -7,7 +7,7 @@ import re import subprocess as sp -from . import command, download, URL, OLDURL, get_size, is_current +from . import command, download, OLDURL, get_size, is_current from .parser import parser @@ -28,6 +28,7 @@ def main(): os.environ['TEXLIVE_INSTALL_PREFIX'] = args.prefix os.makedirs(args.prefix, exist_ok=True) + os.environ["TEXLIVE_INSTALL_ENV_NOCHECK"] = "1" log.info('Installing texlive to {}'.format(args.prefix or '/usr/local/texlive')) if args.install_tl: @@ -37,7 +38,7 @@ def main(): directory = os.path.join( tempfile.gettempdir(), 'texlive-{}'.format(args.version or 'current') ) - download(version=args.version, outdir=directory) + download(version=args.version, outdir=directory, url=args.repository) install_script = glob(os.path.join(directory, 'install-tl-*/install-tl'))[-1] if args.version is None or is_current(args.version): @@ -108,9 +109,12 @@ def main(): env = os.environ env['PATH'] = os.path.abspath(bindir) + ':' + env['PATH'] + repo = args.repository if args.version is not None and not is_current(args.version): repo = OLDURL.format(v=version) + if repo is not None: + log.info("Setting repository to %s", repo) sp.run( ['tlmgr', 'option', 'repository', repo], env=env, diff --git a/install_texlive/parser.py b/install_texlive/parser.py index d388096..1689869 100644 --- a/install_texlive/parser.py +++ b/install_texlive/parser.py @@ -66,3 +66,8 @@ '--docs', action='store_true', help='Install the docs tree', ) + +parser.add_argument( + "-r", "--repository", + help="If given, set ctan mirror to this URL.", +)