diff --git a/python/casa_distro/thirdparty.py b/python/casa_distro/thirdparty.py index 4777ef5e..b3e54672 100644 --- a/python/casa_distro/thirdparty.py +++ b/python/casa_distro/thirdparty.py @@ -187,27 +187,28 @@ def get_spm12_standalone_init(): from brainvisa.configuration import neuroConfig except ImportError: # no axon in the image - pass + neuroConfig = None -conf = list(neuroConfig.readConfiguration(neuroConfig.mainPath, None, '')) -siteOptionFile = conf[0][1] -if siteOptionFile and os.path.exists(siteOptionFile): - neuroConfig.app.configuration.load(siteOptionFile) - -neuroConfig.app.configuration.SPM.spm12_standalone_path = \ - '/usr/local/spm12-standalone' -neuroConfig.app.configuration.SPM.spm12_standalone_command = \ - '/usr/local/spm12-standalone/run_spm12.sh' -mcr_paths = glob.glob('/usr/local/spm12-standalone/mcr/v*') -if len(mcr_paths) != 1: - raise RuntimeError("Cannot find the MATLAB Compiler Runtime in the " - "expected location, please check your " - "install_thirdparty setting.") -neuroConfig.app.configuration.SPM.spm12_standalone_mcr_path = mcr_paths[0] - -from pprint import pprint -pprint(neuroConfig.app.configuration) -neuroConfig.app.configuration.save(siteOptionFile) +if neuroConfig is not None: + conf = list(neuroConfig.readConfiguration(neuroConfig.mainPath, None, '')) + siteOptionFile = conf[0][1] + if siteOptionFile and os.path.exists(siteOptionFile): + neuroConfig.app.configuration.load(siteOptionFile) + + neuroConfig.app.configuration.SPM.spm12_standalone_path = \ + '/usr/local/spm12-standalone' + neuroConfig.app.configuration.SPM.spm12_standalone_command = \ + '/usr/local/spm12-standalone/run_spm12.sh' + mcr_paths = glob.glob('/usr/local/spm12-standalone/mcr/v*') + if len(mcr_paths) != 1: + raise RuntimeError("Cannot find the MATLAB Compiler Runtime in the " + "expected location, please check your " + "install_thirdparty setting.") + neuroConfig.app.configuration.SPM.spm12_standalone_mcr_path = mcr_paths[0] + + from pprint import pprint + pprint(neuroConfig.app.configuration) + neuroConfig.app.configuration.save(siteOptionFile) ''' scripts = {'/casa/install/templates/brainvisa/spm.py': spm_script}