0.5.9
This commit is contained in:
parent
77ca1949fa
commit
e236ce2ac7
18
build.xsh
18
build.xsh
@ -4,11 +4,16 @@
|
|||||||
# Build script is needed to create `build` directory with all files needed to run portable shell on the host
|
# Build script is needed to create `build` directory with all files needed to run portable shell on the host
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys, argparse
|
||||||
from shutil import which
|
from shutil import which
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='build')
|
||||||
|
parser.add_argument('-q', '--quiet', action='store_true', help=f"Quiet mode")
|
||||||
|
opt = parser.parse_args()
|
||||||
|
|
||||||
def eprint(*args, **kwargs):
|
def eprint(*args, **kwargs):
|
||||||
print(*args, file=sys.stderr, **kwargs)
|
if not opt.quiet:
|
||||||
|
print(*args, file=sys.stderr, **kwargs)
|
||||||
|
|
||||||
script_dir = pf"{__file__}".absolute().parent
|
script_dir = pf"{__file__}".absolute().parent
|
||||||
build_dir = script_dir / 'build'
|
build_dir = script_dir / 'build'
|
||||||
@ -23,13 +28,16 @@ if p'your_portable_shell'.exists():
|
|||||||
else:
|
else:
|
||||||
shell_url='...'
|
shell_url='...'
|
||||||
eprint(f'Download <your_portable_shell> from {shell_url}')
|
eprint(f'Download <your_portable_shell> from {shell_url}')
|
||||||
|
arg_q = ['-q'] if opt.quiet else []
|
||||||
|
arg_s = ['-s'] if opt.quiet else []
|
||||||
|
arg_progress = [] if opt.quiet else ['--show-progress']
|
||||||
if which('wget'):
|
if which('wget'):
|
||||||
r =![wget -q --show-progress @(shell_url) -O your_portable_shell]
|
r =![wget @(arg_q) @(arg_progress) @(shell_url) -O your_portable_shell]
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
eprint(f'Error while download using wget: {r}')
|
eprint(f'Error while download using wget: {r}')
|
||||||
exit(1)
|
exit(1)
|
||||||
elif which('curl'):
|
elif which('curl'):
|
||||||
r =![curl -L @(shell_url) -o your_portable_shell]
|
r =![curl @(arg_s) -L @(shell_url) -o your_portable_shell]
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
eprint(f'Error while download using curl: {r}')
|
eprint(f'Error while download using curl: {r}')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user