Skip to content

Commit 29a8d37

Browse files
committed
250906.222013.CST archnorma: revise add_save_path and uninstall_prima
1 parent 4ab0e6b commit 29a8d37

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

matlab/setup_tools/uninstall_prima.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function uninstall_prima(path_string_stamp)
99
interfaces = fullfile(matd, 'interfaces'); % Directory of the interfaces
1010
mexdir = fullfile(interfaces, 'private'); % The private subdirectory of the interfaces
1111
tests = fullfile(matd, 'tests'); % Directory containing some tests
12-
tools = fullfile(matd, 'setup_tools'); % Directory containing some tools
1312

1413
% Remove the compiled MEX files.
1514
clean_mex(mexdir);
@@ -18,15 +17,16 @@ function uninstall_prima(path_string_stamp)
1817
orig_warning_state = warning;
1918
warning('off', 'MATLAB:rmpath:DirNotFound'); % Maybe the paths were not added. We do not want to see this warning.
2019
warning('off', 'MATLAB:SavePath:PathNotSaved'); % Maybe we do not have the permission to save path.
21-
rmpath(interfaces, tests, tools);
20+
rmpath(interfaces, tests);
2221
savepath;
2322
warning(orig_warning_state); % Restore the behavior of displaying warnings
2423

2524
% Removing the line possibly added to the user startup script
2625
user_startup = fullfile(userpath,'startup.m');
2726
if exist(user_startup, 'file')
2827
add_path_string = sprintf('addpath(''%s'');', interfaces);
29-
full_add_path_string = sprintf('%s\t%s %s', add_path_string, '%', path_string_stamp);
28+
% full_add_path_string must match the string with the same name defined in the setup script.
29+
full_add_path_string = sprintf('%s %s %s', add_path_string, '%', path_string_stamp);
3030
try
3131
del_str_ln(user_startup, full_add_path_string);
3232
catch

matlab/tests/profile.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@
186186

187187
end
188188

189+
% Uninstall the solvers installed by the test
190+
cd(fullfile(test_dir, 'prima'));
191+
setup('uninstall');
192+
if strcmpi(options.competitor, 'archiva') || strcmpi(options.competitor, 'norma')
193+
cd(fullfile(test_dir, options.competitor));
194+
setup('uninstall');
195+
end
196+
189197
setpath(oldpath); % Restore the path to oldpath.
190198
cd(olddir); % Go back to olddir.
191199
fprintf('\nCurrently in %s\n\n', pwd());

matlab/tests/verify.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ function verify(varargin)
108108

109109
end
110110

111+
% Uninstall the solvers installed by the test
112+
cd(fullfile(test_dir, 'prima'));
113+
setup('uninstall');
114+
cd(fullfile(test_dir, 'norma'));
115+
setup('uninstall');
116+
111117
setpath(oldpath); % Restore the path to oldpath.
112118
cd(olddir); % Go back to olddir.
113119
fprintf('\nCurrently in %s\n\n', pwd());

setup.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function setup(varargin)
116116
% Uninstall the package if requested.
117117
if strcmp(action, 'uninstall')
118118
uninstall_prima(package_name);
119-
% `rmpath(tools)` is not needed, as `uninstall_prima` already does it.
119+
rmpath(tools);
120120
return
121121
end
122122

@@ -281,7 +281,7 @@ function setup(varargin)
281281
if ~path_saved && numel(userpath) > 0
282282
user_startup = fullfile(userpath, 'startup.m');
283283
add_path_string = sprintf('addpath(''%s'');', path_string);
284-
full_add_path_string = sprintf('%s %s %s', add_path_string, '%', path_string_stamp);
284+
full_add_path_string = sprintf('%s %s %s', add_path_string, '%', path_string_stamp);
285285

286286
% First, check whether full_add_path_string already exists in user_startup or not.
287287
if exist(user_startup, 'file')

0 commit comments

Comments
 (0)