Commit 42798154 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'mnt/local_environment' into 'master'

ENH: Allow environment file to be specified at command line

See merge request fsl/conda/installer!2
parents cbb906c0 e5319b90
...@@ -1042,6 +1042,9 @@ def download_fsl_environment(ctx): ...@@ -1042,6 +1042,9 @@ def download_fsl_environment(ctx):
"""Downloads the environment specification file for the selected FSL """Downloads the environment specification file for the selected FSL
version. version.
If the (hidden) --environment option is provided, the specified file
is used instead.
Internal/development FSL versions may source packages from the internal Internal/development FSL versions may source packages from the internal
FSL conda channel, which requires a username+password to authenticate. FSL conda channel, which requires a username+password to authenticate.
...@@ -1052,17 +1055,22 @@ def download_fsl_environment(ctx): ...@@ -1052,17 +1055,22 @@ def download_fsl_environment(ctx):
are prompted for them. are prompted for them.
""" """
build = ctx.build if ctx.args.environment is None:
url = build['environment'] build = ctx.build
checksum = build['sha256'] url = build['environment']
checksum = build['sha256']
else:
build = {}
url = ctx.args.environment
checksum = None
printmsg('Downloading FSL environment specification ' printmsg('Downloading FSL environment specification '
'from {}...'.format(url)) 'from {}...'.format(url))
fname = url.split('/')[-1] fname = url.split('/')[-1]
download_file(url, fname) download_file(url, fname)
ctx.environment_file = op.abspath(fname) ctx.environment_file = op.abspath(fname)
if not ctx.args.no_checksum: if (checksum is not None) and (not ctx.args.no_checksum):
sha256(fname, build['sha256']) sha256(fname, checksum)
# Environment files for internal/dev FSL versions # Environment files for internal/dev FSL versions
# will list the internal FSL conda channel with # will list the internal FSL conda channel with
...@@ -1599,9 +1607,17 @@ def parse_args(argv=None): ...@@ -1599,9 +1607,17 @@ def parse_args(argv=None):
# Do not automatically update the installer script, # Do not automatically update the installer script,
'no_self_update' : argparse.SUPPRESS, 'no_self_update' : argparse.SUPPRESS,
# Path to local installer manifest file # Path to alternative FSL release manifest.
'manifest' : argparse.SUPPRESS, 'manifest' : argparse.SUPPRESS,
# Path to FSL conda environment.yml file.
# Using this option will cause the
# --fslversion and --cuda options to be
# ignored. It is assumed that the
# environment file is compatible with the
# host platform.
'environment' : argparse.SUPPRESS,
# Print debugging messages # Print debugging messages
'debug' : argparse.SUPPRESS, 'debug' : argparse.SUPPRESS,
...@@ -1651,6 +1667,7 @@ def parse_args(argv=None): ...@@ -1651,6 +1667,7 @@ def parse_args(argv=None):
default=op.expanduser('~')) default=op.expanduser('~'))
parser.add_argument('--manifest', default=FSL_INSTALLER_MANIFEST, parser.add_argument('--manifest', default=FSL_INSTALLER_MANIFEST,
help=helps['manifest']) help=helps['manifest'])
parser.add_argument('--environment', help=helps['environment'])
parser.add_argument('--no_self_update', action='store_true', parser.add_argument('--no_self_update', action='store_true',
help=helps['no_self_update']) help=helps['no_self_update'])
...@@ -1681,9 +1698,11 @@ def parse_args(argv=None): ...@@ -1681,9 +1698,11 @@ def parse_args(argv=None):
if not op.exists(args.workdir): if not op.exists(args.workdir):
os.mkdir(args.workdir) os.mkdir(args.workdir)
# accept local path for manifest # accept local path for manifest and environment
if args.manifest is not None and op.exists(args.manifest): if args.manifest is not None and op.exists(args.manifest):
args.manifest = op.abspath(args.manifest) args.manifest = op.abspath(args.manifest)
if args.environment is not None and op.exists(args.environment):
args.environment = op.abspath(args.environment)
return args return args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment