Commit 0c540eb0 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/user-condarc' into 'master'

RF: Make installer more resilient to existing conda installations

See merge request fsl/conda/installer!15
parents 0853f539 17d3a93f
......@@ -52,7 +52,7 @@ log = logging.getLogger(__name__)
__absfile__ = op.abspath(__file__).rstrip('c')
__version__ = '1.1.1'
__version__ = '1.2.0'
"""Installer script version number. This is automatically updated
whenever a new version of the installer script is released.
"""
......@@ -1172,14 +1172,6 @@ def install_miniconda(ctx):
# Create .condarc config file
condarc = tw.dedent("""
# Putting a .condarc file into the root environment
# directory will override ~/.condarc if it exists,
# but will not override a system condarc (e.g. at
# /etc/condarc/condarc). There is currently no
# workaround for this - see:
# - https://github.com/conda/conda/issues/8599
# - https://github.com/conda/conda/issues/8804
# Try and make package downloads more robust
remote_read_timeout_secs: 240
remote_connect_timeout_secs: 20
......@@ -1193,12 +1185,21 @@ def install_miniconda(ctx):
# ensure that conda-forge versions of e.g. VTK were
# preferred over legacy FSL conda versions).
#
# Use final/top/bottom marks to prevent the channel
# priority order being modified by user ~/.condarc
# configuration files.
#
# https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html
# https://www.anaconda.com/blog/conda-configuration-engine-power-users
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html
channel_priority: strict
channel_priority: strict #!final
""")
condarc +='\nchannels:\n'
for channel in ctx.environment_channels:
channels = list(ctx.environment_channels)
if len(channels) > 0:
channels[0] += ' #!top'
channels[-1] += ' #!bottom'
condarc += '\nchannels: #!final\n'
for channel in channels:
condarc += ' - {}\n'.format(channel)
with open('.condarc', 'wt') as f:
......@@ -1232,11 +1233,11 @@ def install_fsl(ctx):
printmsg('Installing FSL into {}...'.format(ctx.destdir))
# Clear any environment variables that
# refer to an existing FSL installation
# Clear any environment variables that refer
# to existing FSL or conda installations.
env = os.environ.copy()
for v in list(env.keys()):
if 'FSL' in v:
if any(('FSL' in v, 'CONDA' in v)):
env.pop(v)
# post-link scripts call $FSLDIR/share/fsl/sbin/createFSLWrapper
......
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