help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why global_install is assumed to be 'true' in 'load_packages' and why it


From: Sergei Steshenko
Subject: why global_install is assumed to be 'true' in 'load_packages' and why it doesn't matter ?
Date: Sat, 19 May 2012 18:40:57 -0700 (PDT)

Hello,

trying to debug some problems in package installation (I'm talking about 
octave-3.6.1/scripts/pkg/pkg.m file in the source tree) I've noticed a couple 
functions.

The first of them is 'load_packages':

   2105 function load_packages (files, handle_deps, local_list, global_list)
   2106   installed_pkgs_lst = installed_packages (local_list, global_list);
   2107   num_packages = length (installed_pkgs_lst);
   2108
   2109   ## Read package names and installdirs into a more convenient format.
   2110   pnames = pdirs = cell (1, num_packages);
   2111   for i = 1:num_packages
   2112     pnames{i} = installed_pkgs_lst{i}.name;
   2113     pdirs{i} = installed_pkgs_lst{i}.dir;
   2114   endfor
   2115
   2116   ## Load all.
   2117   if (length (files) == 1 && strcmp (files{1}, "all"))
   2118     idx = [1:length(installed_pkgs_lst)];
   2119   ## Load auto.
   2120   elseif (length (files) == 1 && strcmp (files{1}, "auto"))
   2121     idx = [];
   2122     for i = 1:length (installed_pkgs_lst)
   2123       if (exist (fullfile (pdirs{i}, "packinfo", ".autoload"), "file"))
   2124         idx (end + 1) = i;
   2125       endif
   2126     endfor
   2127   ## Load package_name1 ...
   2128   else
   2129     idx = [];
   2130     for i = 1:length (files)
   2131       idx2 = find (strcmp (pnames, files{i}));
   2132       if (! any (idx2))
   2133           error ("package %s is not installed", files{i});
   2134       endif
   2135       idx (end + 1) = idx2;
   2136     endfor
   2137   endif
   2138
   2139   ## Load the packages, but take care of the ordering of dependencies.
   2140   load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst, 
true);
   2141 endfunction
.

As one can see, on line #2140 'load_packages_and_dependencies' function is 
called, and its last argument is set to 'true'.


The 'load_packages_and_dependencies' function looks this way:


   2328 function load_packages_and_dependencies (idx, handle_deps, 
installed_pkgs_lst,
   2329                                          global_install)
   2330   idx = load_package_dirs (idx, [], handle_deps, installed_pkgs_lst);
   2331   dirs = {};
   2332   execpath = EXEC_PATH ();
   2333   for i = idx;
   2334     ndir = installed_pkgs_lst{i}.dir;
   2335     dirs{end+1} = ndir;
   2336     if (exist (fullfile (dirs{end}, "bin"), "dir"))
   2337       execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, 
"bin"));
   2338     endif
   2339     tmpdir = getarchdir (installed_pkgs_lst{i});
   2340     if (exist (tmpdir, "dir"))
   2341       dirs{end + 1} = tmpdir;
   2342       if (exist (fullfile (dirs{end}, "bin"), "dir"))
   2343         execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, 
"bin"));
   2344       endif
   2345     endif
   2346   endfor
   2347
   2348   ## Load the packages.
   2349   if (length (dirs) > 0)
   2350     addpath (dirs{:});
   2351   endif
   2352
   2353   ## Add the binaries to exec_path.
   2354   if (! strcmp (EXEC_PATH, execpath))
   2355     EXEC_PATH (execpath);
   2356   endif
   2357 endfunction

.

In the body of 'load_packages_and_dependencies' I see that the last argument is 
called 'global_install'.

Which means that 'load_packages' calls 'load_packages_and_dependencies' with 
global_install == true.

So, my first question is: "Why ?".

Looking more carefully at 'load_packages_and_dependencies' body, I see 
'global_install' _nowhere_. Am I missing it ?

If not, my second question is: "Why 'global_install' is not used ?".


Thanks,
  Sergei.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]