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
3cb847d9
Commit
3cb847d9
authored
Oct 20, 2021
by
Paul McCarthy
🚵
Browse files
BF: Guard against base package name collisions
parent
2252568b
Changes
1
Hide whitespace changes
Inline
Side-by-side
fslinstaller.py
View file @
3cb847d9
...
...
@@ -1125,9 +1125,14 @@ def download_fsl_environment(ctx):
# 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
=
{}
# Sort base package names from longest to shortest,
# to avoid name conflicts (e.g. 'fsl-sub', and
# 'fsl-sub_plugin_sge')
basepkgnames
=
sorted
(
basepkgnames
,
key
=
len
,
reverse
=
True
)
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,10 +1154,14 @@ def download_fsl_environment(ctx):
channels
.
append
(
line
.
split
()[
-
1
])
continue
# save base package versions, as
# we install them separately
# Save base package versions, as we
# install them separately. Package
# specs in the yml file are of the
# form:
#
# - <package> <version> [<build_variant>]
for
pkg
in
basepkgnames
:
if
line
.
strip
().
startswith
(
'- {}'
.
format
(
pkg
)):
if
line
.
strip
().
startswith
(
'- {}
'
.
format
(
pkg
)):
pkgver
=
line
.
strip
().
split
(
' '
,
2
)[
2
]
basepkgs
[
pkg
]
=
pkgver
.
replace
(
' '
,
'='
)
...
...
Write
Preview
Markdown
is supported
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