diff --git a/share/fsl/sbin/update_fsl_package b/share/fsl/sbin/update_fsl_package index 141d40230fc0b6caf83b07e1af0d50ce95a75914..5ff0899bd4c9a38885c9b692d8800332bf6477b2 100755 --- a/share/fsl/sbin/update_fsl_package +++ b/share/fsl/sbin/update_fsl_package @@ -88,9 +88,24 @@ def conda(cmd : str, capture_output=True, **kwargs) -> str: Keyword arguments are passed through to subprocess.run. """ + fsldir = os.environ['FSLDIR'] condabin = op.join(fsldir, 'bin', 'conda') + # If FSLDIR is a child env, we won't be able + # to find the conda executable. In this case, + # we have to assume that we can call "conda". + candidates = [ + op.join(fsldir, 'bin', 'conda'), + op.join(fsldir, 'condabin', 'conda'), + ] + + for condabin in candidates: + if op.exists(condabin): + break + else: + condabin = 'conda' + log.debug(f'Running {condabin} {cmd}') kwargs['check'] = False