Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
aa2a75f2
Commit
aa2a75f2
authored
9 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: fslversion was not being initialised until FSLDIR was set
parent
512228ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/platform.py
+22
-10
22 additions, 10 deletions
fsl/utils/platform.py
with
22 additions
and
10 deletions
fsl/utils/platform.py
+
22
−
10
View file @
aa2a75f2
...
...
@@ -88,6 +88,7 @@ class Platform(notifier.Notifier):
frozen
fsldir
fsldevdir
fslVersion
haveGui
canHaveGui
inSSHSession
...
...
@@ -354,19 +355,13 @@ class Platform(notifier.Notifier):
if
value
is
None
:
os
.
environ
.
pop
(
'
FSLDIR
'
,
None
)
else
:
os
.
environ
[
'
FSLDIR
'
]
=
value
# Set the FSL version field if we can
versionFile
=
op
.
join
(
value
,
'
etc
'
,
'
fslversion
'
)
if
op
.
exists
(
versionFile
):
with
open
(
versionFile
,
'
rt
'
)
as
f
:
# split string at colon for new hash style versions
# first object in list is the non-hashed version string
# (e.g. 6.0.2) if no ":hash:" then standard FSL version
# string is still returned
self
.
__fslVersion
=
f
.
read
().
strip
().
split
(
"
:
"
)[
0
]
# clear fslversion - it will
# be re-read on next access
self
.
__fslVersion
=
None
self
.
notify
(
value
=
value
)
...
...
@@ -396,6 +391,23 @@ class Platform(notifier.Notifier):
"""
Returns the FSL version as a string, e.g. ``
'
5.0.9
'
``. Returns
``None`` if a FSL installation could not be found.
"""
if
self
.
__fslVersion
is
not
None
:
return
self
.
__fslVersion
if
self
.
fsldir
is
None
:
return
None
# Set the FSL version field if we can
versionFile
=
op
.
join
(
self
.
fsldir
,
'
etc
'
,
'
fslversion
'
)
if
op
.
exists
(
versionFile
):
with
open
(
versionFile
,
'
rt
'
)
as
f
:
# split string at colon for new hash style versions
# first object in list is the non-hashed version string
# (e.g. 6.0.2) if no ":hash:" then standard FSL version
# string is still returned
self
.
__fslVersion
=
f
.
read
().
strip
().
split
(
"
:
"
)[
0
]
return
self
.
__fslVersion
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment