From 962a97f39c60616b507d0f1198bba41e0be2dc60 Mon Sep 17 00:00:00 2001 From: JohnnyChen Date: Sat, 18 Jan 2020 22:21:46 +0800 Subject: [PATCH] change parameter out to outdir --- README.md | 19 +++++++++++++------ jill/download.py | 10 +++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d828869..0f152f2 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,29 @@ The Python fork of [JILL](https://github.com/abelsiqueira/jill) - Julia Installer 4 Linux (and MacOS) - Light +## Features + +* download Julia release from nearest mirror server. Check [sources](jill/config/sources.json) for the list of all registered mirrors. +* install julia for Linux and MacOS (including nightly build: `latest`) +* easily set up a new release mirror 🚧 + ## Usage examples * download: - - download Julia for current system: `jill download v1.3.0` - - download Julia for 32-bit linux: `jill download v1.3.0 linux i686` + - download Julia for current system: `jill download 1.3.0` + - download Julia for 32-bit linux: `jill download 1.3.0 linux i686` + - download Julia to specific dir: `jill download 1.3.0 --outdir OUTDIR` * install Julia for current system: - - system-wide: `sudo jill install v1.3.0` - - only for current user: `jill install v1.3.0` + - system-wide: `sudo jill install 1.3.0` + - only for current user: `jill install 1.3.0` ## Register new mirror -add an entry to `jill/sources.json`: +add an entry to `jill/config/sources.json`: * `name`: a distinguishable mirror name * `url`: URL template to retrive Julia release -* `filename`: filename template, by default it's `julia-$patch_version-$osarch.$extension` +* `filename` (optional): filename template. The default value is `julia-$patch_version-$osarch.$extension` There're several predefined placeholders for various systems and architectures: diff --git a/jill/download.py b/jill/download.py index a4dd67a..6b56ebf 100644 --- a/jill/download.py +++ b/jill/download.py @@ -41,7 +41,7 @@ def _download_package(url: str, out: str): def download_package(version, system=None, architecture=None, - out=None, overwrite=False, max_try=3): + outdir=None, overwrite=False, max_try=3): """ download julia release from nearest servers. """ @@ -53,10 +53,10 @@ def download_package(version, system=None, architecture=None, url_list = chain.from_iterable(repeat(url_list, max_try)) for url in url_list: - # make sure out is always a filepath - outpath = out if out else os.path.split(urlparse(url).path)[1] - outpath = os.path.abspath(outpath) - outdir, outname = os.path.split(outpath) + outdir = outdir if outdir else '.' + outdir = os.path.abspath(outdir) + outname = os.path.split(urlparse(url).path)[1] + outpath = os.path.join(outdir, outname) if os.path.isfile(outpath) and not overwrite: logging.info(f"{outname} already exists, skip downloading")