forked from robertoostenveld/fieldtrip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_dependencycheck.m
119 lines (90 loc) · 3.39 KB
/
ft_dependencycheck.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
function [funlist, deplist, depmat] = ft_dependencycheck
% FT_DEPENDENCYCHECK checks the dependencies on the backward compatibility functions
% and on the external toolboxes.
% Copyright (C) 2013, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$
ft_defaults
p = fileparts(which(mfilename));
f1 = dir(fullfile(p, '*.m'));
f1 = {f1.name}';
f2 = dir(fullfile(p, 'utilities', '*.m'));
f2 = {f2.name}';
f3 = dir(fullfile(p, 'preproc', '*.m'));
f3 = {f3.name}';
f4 = dir(fullfile(p, 'fileio', '*.m'));
f4 = {f4.name}';
f5 = dir(fullfile(p, 'forward', '*.m'));
f5 = {f5.name}';
f6 = dir(fullfile(p, 'inverse', '*.m'));
f6 = {f6.name}';
f7 = dir(fullfile(p, 'realtime', '*.m'));
f7 = {f7.name}';
f8 = dir(fullfile(p, 'realtime', 'datasource', '*.m'));
f8 = {f8.name}';
f9 = dir(fullfile(p, 'peer', '*.m'));
f9 = {f9.name}';
f10 = dir(fullfile(p, 'plotting', '*.m'));
f10 = {f10.name}';
f11 = dir(fullfile(p, 'statfun', '*.m'));
f11 = {f11.name}';
f12 = dir(fullfile(p, 'specest', '*.m'));
f12 = {f12.name}';
f13 = dir(fullfile(p, 'connectivity', '*.m'));
f13 = {f13.name}';
f14 = dir(fullfile(p, 'contrib', '*.m'));
f14 = {f14.name}';
f15 = dir(fullfile(p, 'qsub', '*.m'));
f15 = {f15.name}';
f16 = dir(fullfile(p, 'contrib', 'spike', '*.m'));
f16 = {f16.name}';
f17 = dir(fullfile(p, 'contrib', 'trentool', '*.m'));
f17 = {f17.name}';
f18 = dir(fullfile(p, 'utility', '*.m'));
f18 = {f18.name}';
funlist = cat(1, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18);
for i=1:length(funlist)
[p, funlist{i}, x] = fileparts(funlist{i});
end
% determine the dependencies, toponly, including matlab
[deplist, depmat] = mydepfun(funlist, true, true);
compatfun = ~cellfun(@isempty, regexp(deplist, [filesep 'compat' filesep]));
if any(compatfun)
fprintf('\nThere is a dependency from function "%s" onto a compat function\n', funlist{any(depmat(:,compatfun),2)});
fprintf('\nThere is a dependency onto the compat function "%s"\n', deplist{compatfun});
error('dependencies on compat functions are not allowed');
end
toolboxfun = find(~cellfun(@isempty, regexp(deplist, matlabroot)));
toolbox = cell(size(toolboxfun));
t0 = length(tokenize(matlabroot, filesep));
for i=1:length(toolboxfun)
t = tokenize(deplist{toolboxfun(i)}, filesep);
toolbox{i} = t{t0+2};
end
toolbox = unique(toolbox);
toolbox = setdiff(toolbox, {'matlab'});
for i=1:length(toolbox)
fprintf('\nThe following functions depend on the Mathworks "%s" toolbox:\n', toolbox{i});
toolboxfun = ~cellfun(@isempty, regexp(deplist, [matlabroot filesep 'toolbox' filesep toolbox{i}]));
fprintf('\t%s\n', funlist{any(depmat(:,toolboxfun),2)});
end
if ~nargout
% do not return anything
clear all
end