# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1332430335 14400 # Node ID f36301ea650f9fdb5908f5be6dcdaa90b711df43 # Parent aa490c112c88e63b054012401990585a5588e3b5# Parent a467f3e04b7ad92a404b05eacd4538c2f158c574 maint: merge in Mike's changes diff --git a/scripts/help/gen_doc_cache.m b/scripts/help/gen_doc_cache.m --- a/scripts/help/gen_doc_cache.m +++ b/scripts/help/gen_doc_cache.m @@ -41,16 +41,23 @@ ## Generate cache if (isempty (directory)) cache = gen_builtin_cache (); + elseif (iscell (directory)) + if all(cellfun (@ischar, directory)) + cache = gen_doc_cache_in_dir (directory); + else + error ("gen_doc_cache: cell must contain only strings"); + end elseif (ischar (directory)) - cache = gen_doc_cache_in_dir (directory); + cache = gen_doc_cache_in_dir (directory); else - error ("gen_doc_cache: second input argument must be a string"); + error ("gen_doc_cache: second input argument must be a string or a cell of strings"); endif ## Save cache if (! isempty (cache)) - save ("-text", out_file, "cache"); + save ("-text", out_file, "cache"); endif + endfunction function [text, first_sentence, status] = handle_function (f, text, format) @@ -108,31 +115,33 @@ endfunction function cache = gen_doc_cache_in_dir (directory) + ## If 'directory' is not in the current path, add it so we search it - dir_in_path = false; - p = path (); - idx = find (p == pathsep ()); - prev_idx = 1; - for n = 1:length (idx) - f = p (prev_idx:idx (n)-1); - if (strcmp (f, directory)) - dir_in_path = true; - break; - endif - prev_idx = idx (n) + 1; - endfor + dir_in_path = ismember (directory, strsplit (path (), pathsep ())); + + # dirs not in path + if !iscell (directory) + directory = {directory}; + end + dirs_notpath = {directory{!dir_in_path}}; + + # add them + if !isempty (dirs_notpath) + cellfun (@addpath, dirs_notpath); + end - if (!dir_in_path) - addpath (directory); - endif + # create cache + func = @(s_) create_cache (__list_functions__ (s_)); + cache = cellfun (func, directory, 'UniformOutput', false); - ## Get list of functions in directory and create cache - list = __list_functions__ (directory); - cache = create_cache (list); + # concatenate results + cache = [cache{:}]; - if (!dir_in_path) - rmpath (directory); - endif + #remove dirs form path + if !isempty (dirs_notpath) + cellfun (@rmpath, dirs_notpath); + end + endfunction function cache = gen_builtin_cache () @@ -148,4 +157,3 @@ %% No true tests desirable for this function. %% Test input validation %!error gen_doc_cache (1) - diff --git a/scripts/pkg/private/create_pkgadddel.m b/scripts/pkg/private/create_pkgadddel.m --- a/scripts/pkg/private/create_pkgadddel.m +++ b/scripts/pkg/private/create_pkgadddel.m @@ -29,8 +29,8 @@ ## architecture dependent directory so that the autoload/mfilename ## commands work as expected. The only part that doesn't is the ## part in the main directory. - archdir = fullfile (getarchprefix (desc), cstrcat (desc.name, "-", - desc.version), getarch ()); + archdir = fullfile (getarchprefix (desc, global_install), cstrcat (desc.name, + "-", desc.version), getarch ()); if (exist (getarchdir (desc, global_install), "dir")) archpkg = fullfile (getarchdir (desc, global_install), nm); archfid = fopen (archpkg, "at");