Skip to content

Commit

Permalink
sync new capsul matlab config option: mcr_directory (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisri committed Mar 1, 2022
1 parent befeec6 commit 39eccca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions python/populse_mia/software_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ def get_capsul_config(self, sync_from_engine=True):
sconf.pop('spm_directory', None)
sconf.pop('matlab_exec', None)

if matlab_standalone_path:
econf = capsul_config.setdefault('engine', {})
eeconf = econf.setdefault('global', {})
eeconf.setdefault('capsul.engine.module.matlab',
{})['mcr_directory'] = matlab_standalone_path

if sync_from_engine and self.capsul_engine:
econf = capsul_config.setdefault('engine', {})
for environment in (self.capsul_engine.settings.
Expand Down Expand Up @@ -899,7 +905,6 @@ def set_capsul_config(self, capsul_config_dict):
'engine_modules': [...]}
"""
self.config['capsul_config'] = capsul_config_dict
self.update_capsul_config() # store into capsul engine

# update MIA values
engine_config = capsul_config_dict.get('engine')
Expand All @@ -915,6 +920,10 @@ def set_capsul_config(self, capsul_config_dict):
# matlab
matlab_path = capsul_config.get('matlab_exec')
use_matlab = capsul_config.get('use_matlab', None)
mcr_dir = engine_config.get(
'global', {}).get('capsul.engine.module.matlab',
{}).get('mcr_directory')
self.set_matlab_standalone_path(mcr_dir)
if use_matlab and matlab_path:
self.set_matlab_path(matlab_path)
self.set_use_matlab(True)
Expand All @@ -927,10 +936,11 @@ def set_capsul_config(self, capsul_config_dict):
spm_standalone = capsul_config.get('spm_standalone')
#TODO: I thing the following is wrong
if spm_standalone:
mcr = os.path.join(spm_dir, 'mcr', 'v713')
if os.path.isdir(mcr) and os.path.isdir(spm_dir):
if not mcr_dir:
mcr_dir = os.path.join(spm_dir, 'mcr', 'v713')
self.set_matlab_standalone_path(mcr_dir)
if os.path.isdir(mcr_dir) and os.path.isdir(spm_dir):
self.set_spm_standalone_path(spm_dir)
self.set_matlab_standalone_path(mcr)
self.set_use_spm_standalone(True)
self.set_use_matlab_standalone(True)
self.set_use_matlab(False)
Expand All @@ -956,6 +966,8 @@ def set_capsul_config(self, capsul_config_dict):
elif use_fsl is False:
self.set_use_fsl(False)

self.update_capsul_config() # store into capsul engine

def setChainCursors(self, chain_cursors):
"""Set the value of the checkbox 'chain cursor' in the miniviewer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,7 @@ def init_pipeline(self, pipeline=None, pipeline_name=""):
try:

print('Completion / workflow...')
print('pipeline:', pipeline)
self.workflow = workflow_from_pipeline(pipeline,
complete_parameters=True)
print('\nWorkflow done.\n')
Expand Down

0 comments on commit 39eccca

Please sign in to comment.