Skip to content

Commit

Permalink
change parameter out to outdir
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 committed Jan 18, 2020
1 parent 5b7c02d commit 962a97f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions jill/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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")
Expand Down

0 comments on commit 962a97f

Please sign in to comment.