Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyfeeds-tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
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
pyfeeds-tests
Merge requests
!71
MNT: Adjust `fslStartup` test to support micromamba-based installations
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
MNT: Adjust `fslStartup` test to support micromamba-based installations
mnt/fslstartup
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Paul McCarthy
requested to merge
mnt/fslstartup
into
master
2 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
4004ee9b
1 commit,
2 months ago
1 file
+
36
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
unit_tests/utils/feedsRun.fslStartup
+
36
−
13
Options
#!/usr/bin/env fslpython
#Note this script requires a conda activate script to be on the PATH
# Note this script attempts to activate the $FSLDIR conda environment in
# order to compile the test_fslStartup.cc program. Therefore this script
# expects one of the following to be true:
#
# - A $FSLDIR/bin/activate script to be present
# - A $FSLDIR/bin/micromamba executable to be present
#
import os
import os.path as op
import shlex
import sys
import tempfile
@@ -35,22 +42,38 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None):
return result.stdout.strip().split('\n')[-1]
def main():
env = os.environ.copy()
activatePath = Path(f'''{env['FSLDIR']}/bin/activate''')
if not activatePath.is_file():
activatePath='activate'
def genActivateCommand():
fsldir = os.environ['FSLDIR']
mmbin = f'{fsldir}/bin/micromamba'
activate = f'{fsldir}/bin/activate'
if op.exists(mmbin):
return '; '.join([
f'eval $({mmbin} shell hook --shell posix)',
f'micromamba activate {fsldir}'])
outdir = Path(sys.argv[1])
elif op.exists(activate):
return f'source {activate} {fsldir}'
buildcmds = [f'''source {activatePath} $FSLDIR''',
'source $FSLDIR/etc/fslconf/fsl-devel.sh',
f'''cp Makefile test_fslStartup.cc {outdir}''',
f'''cd {outdir}''',
'make']
# hope that there's an activate script/func available
else:
return f'source activate {fsldir}'
def main():
fsldir = os.environ['FSLDIR']
outdir = Path(sys.argv[1])
buildcmds = [
genActivateCommand(),
f'source {fsldir}/etc/fslconf/fsl-devel.sh',
f'cp Makefile test_fslStartup.cc {outdir}',
f'cd {outdir}',
'make']
sp.run('; '.join(buildcmds), check=True, shell=True)
os.chdir(outdir)
os.chdir(outdir)
# Default behaviour should be: OMP multi-threaded, BLAS single threaded.
assert run('./test_fslStartup', 8, 8) == '8 1 8'
Loading