Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
conda
installer
Commits
2252568b
Commit
2252568b
authored
Oct 19, 2021
by
Paul McCarthy
🚵
Browse files
Merge branch 'rf/base_packages' into 'master'
Rf/base packages See merge request fsl/conda/installer!24
parents
78349215
edc70b0b
Changes
2
Show whitespace changes
Inline
Side-by-side
fslinstaller.py
View file @
2252568b
...
...
@@ -29,7 +29,6 @@ import shutil
import
sys
import
tempfile
import
threading
import
time
import
traceback
# TODO check py2/3
...
...
@@ -52,7 +51,7 @@ log = logging.getLogger(__name__)
__absfile__
=
op
.
abspath
(
__file__
).
rstrip
(
'c'
)
__version__
=
'1.
3.7
'
__version__
=
'1.
4.0
'
"""Installer script version number. This must be updated
whenever a new version of the installer script is released.
"""
...
...
@@ -161,11 +160,11 @@ class Context(object):
# The download_fsl_environment function stores
# the path to the FSL conda environment file,
# list of conda channels, and
fsl-base
version
,
# here.
# list of conda channels, and version
s of a
#
small set of "base" packages
here.
self
.
environment_file
=
None
self
.
environment_channels
=
None
self
.
fsl_base_
version
=
None
self
.
fsl_base_
packages
=
None
# The config_logging function stores the path
# to the fslinstaller log file here.
...
...
@@ -1078,11 +1077,13 @@ def download_fsl_environment(ctx):
if
ctx
.
args
.
environment
is
None
:
build
=
ctx
.
build
url
=
build
[
'environment'
]
checksum
=
build
[
'sha256'
]
checksum
=
build
.
get
(
'sha256'
,
None
)
basepkgnames
=
build
.
get
(
'base_packages'
,
[])
else
:
build
=
{}
url
=
ctx
.
args
.
environment
checksum
=
None
basepkgnames
=
[]
printmsg
(
'Downloading FSL environment specification '
'from {}...'
.
format
(
url
))
...
...
@@ -1120,14 +1121,13 @@ def download_fsl_environment(ctx):
# The install_miniconda function will then add the
# channels to $FSLDIR/.condarc.
#
# The fsl-base version is installed before any other
# packages, as other FSL packages require it to be
# present in order to install successfully. So we
# also extract the fsl-base version number from
# the environment file, and store it in the context.
channels
=
[]
basever
=
None
# A collection of "base" packages are installed
# before any other packages. So we also extract the
# version numbers of these base packages from the
# environment file, and store them in the context.
copy
=
'.'
+
op
.
basename
(
ctx
.
environment_file
)
channels
=
[]
basepkgs
=
{}
shutil
.
move
(
ctx
.
environment_file
,
copy
)
with
open
(
copy
,
'rt'
)
as
inf
,
\
open
(
ctx
.
environment_file
,
'wt'
)
as
outf
:
...
...
@@ -1149,15 +1149,17 @@ def download_fsl_environment(ctx):
channels
.
append
(
line
.
split
()[
-
1
])
continue
# save fsl-base version, as
# we install it separately
if
line
.
strip
().
startswith
(
'- fsl-base'
):
basever
=
line
.
split
()[
2
]
# save base package versions, as
# we install them separately
for
pkg
in
basepkgnames
:
if
line
.
strip
().
startswith
(
'- {}'
.
format
(
pkg
)):
pkgver
=
line
.
strip
().
split
(
' '
,
2
)[
2
]
basepkgs
[
pkg
]
=
pkgver
.
replace
(
' '
,
'='
)
outf
.
write
(
line
)
ctx
.
environment_channels
=
channels
ctx
.
fsl_base_
version
=
base
ver
ctx
.
fsl_base_
packages
=
base
pkgs
def
download_miniconda
(
ctx
):
...
...
@@ -1270,18 +1272,23 @@ def install_fsl(ctx):
# We install FSL in two steps:
#
# 1. Install fsl-base. This is installed first, as other
# FSL packages require it to be present during installation,
# (in their post-link.sh scripts), and this is not
# guaranteed if everything is installed simultaneously
# 1. Install base packages. This is installed first, as
# FSL packages require fsl-base to be present during
# installation (in their post-link.sh scripts), and
# this is not guaranteed if everything is installed
# simultaneously. Also done for efficiency, so e.g.
# libopenblas variants don't get swapped back and
# forth.
# 2. Install everything else.
#
# The download_fsl_environment function extracts the
appropriate
#
fsl-bas
e version to install.
# The download_fsl_environment function extracts the
#
appropriate base packag
e version
s
to install.
commands
=
[]
if
ctx
.
fsl_base_version
is
not
None
:
commands
.
append
(
conda
+
' install -y -n base fsl-base='
+
ctx
.
fsl_base_version
)
if
ctx
.
fsl_base_packages
is
not
None
and
len
(
ctx
.
fsl_base_packages
)
>
0
:
basepkgs
=
ctx
.
fsl_base_packages
basepkgs
=
[
'{}={}'
.
format
(
pkg
,
ver
)
for
pkg
,
ver
in
basepkgs
.
items
()]
basepkgs
=
' '
.
join
(
basepkgs
)
commands
.
append
(
conda
+
' install -y -n base '
+
basepkgs
)
commands
.
append
(
conda
+
' env update -n base -f '
+
ctx
.
environment_file
)
printmsg
(
'Installing FSL into {}...'
.
format
(
ctx
.
destdir
))
...
...
test/test_installer.py
View file @
2252568b
...
...
@@ -70,14 +70,16 @@ mock_manifest = """
{{
"platform" : "{platform}",
"environment" : "{url}/env-6.2.0.yml",
"sha256" : "{env620_sha256}"
"sha256" : "{env620_sha256}",
"base_packages" : ["fsl-base", "libopenblas"]
}}
],
"6.1.0" : [
{{
"platform" : "{platform}",
"environment" : "{url}/env-6.1.0.yml",
"sha256" : "{env610_sha256}"
"sha256" : "{env610_sha256}",
"base_packages" : ["fsl-base", "libopenblas"]
}}
]
}}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment