Skip to content

Commit 193a312

Browse files
authored
Merge pull request #412 from Remi-Gau/spm_version_bug
[FIX] update checks on SPM version
2 parents 52e07d0 + d77c17d commit 193a312

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ initCppSpm
6060
```
6161

6262
Please see our
63-
[documentation](https://cpp_spm.readthedocs.io/en/latest/index.html) for
64-
more detailed instructions.
63+
[documentation](https://cpp_spm.readthedocs.io/en/latest/index.html) for more
64+
detailed instructions.
6565

6666
### Dependencies
6767

@@ -76,7 +76,7 @@ For instructions see the following links:
7676
| ---------------------------------------------------------- | ------------ |
7777
| [Matlab](https://www.mathworks.com/products/matlab.html) | 20??? |
7878
| or [octave](https://www.gnu.org/software/octave/) | 4.? |
79-
| [SPM12](https://www.fil.ion.ucl.ac.uk/spm/software/spm12/) | v7487 |
79+
| [SPM12](https://www.fil.ion.ucl.ac.uk/spm/software/spm12/) | >7219 |
8080

8181
<!-- lint enable -->
8282

@@ -109,8 +109,8 @@ This can perform:
109109
The core functions are in the `src` folder.
110110

111111
Please see our
112-
[documentation](https://cpp_spm.readthedocs.io/en/latest/index.html) for
113-
more info.
112+
[documentation](https://cpp_spm.readthedocs.io/en/latest/index.html) for more
113+
info.
114114

115115
## Octave compatibility
116116

@@ -148,12 +148,14 @@ Constant are written in `UPPERCASE`.
148148
There is a [pre-commit hook](https://pre-commit.com/) that you can use to
149149
reformat files as you commit them.
150150

151-
Install pre-commit by using our `requirements.txt` file
151+
Install pre-commit by using our `requirements.txt` file
152+
152153
```bash
153154
pip install -r requirements.txt
154155
```
155156

156157
Install the hook
158+
157159
```bash
158160
pre-commit install
159161
```

src/utils/checkDependencies.m

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,24 @@ function checkDependencies()
1313
fprintf('Checking dependencies\n');
1414

1515
SPM_main = 'SPM12';
16-
SPM_sub = '7487';
16+
SPM_sub = 7219;
1717

1818
%% check spm version
1919
try
2020
[a, b] = spm('ver');
21-
fprintf(' Using %s %s\n', a, b);
22-
if any(~[strcmp(a, SPM_main) strcmp(b, SPM_sub)])
23-
str = sprintf('%s %s %s.\n%s', ...
24-
'The current version SPM version is not', SPM_main, SPM_sub, ...
25-
'In case of problems (e.g json file related) consider updating.');
26-
warning(str); %#ok<*SPWRN>
27-
end
2821
catch
2922
error('Failed to check the SPM version: Are you sure that SPM is in the matlab path?');
3023
end
3124

25+
fprintf(' Using %s %s\n', a, b);
26+
27+
if ~strcmp(a, SPM_main) || str2num(b) < 7219
28+
str = sprintf('%s %s %s.\n%s', ...
29+
'The current version SPM version is less than', SPM_main, SPM_sub, ...
30+
'Update with: spm_update update');
31+
warning(str); %#ok<*SPWRN>
32+
end
33+
3234
spm('defaults', 'fmri');
3335

3436
%% Check the Nifti tools are indeed there.

0 commit comments

Comments
 (0)