Mercurial > hg > octave-nkf
changeset 14661:dee1452ca601
Load packages with circular dependencies correctly
* scripts/pkg/private/load_package_dirs.m: Fix recursion to handle
circular dependencies correctly.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Sat, 19 May 2012 11:31:37 -0400 |
parents | 97e3d1769be0 |
children | 161d06a52360 |
files | scripts/pkg/private/load_package_dirs.m |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/pkg/private/load_package_dirs.m +++ b/scripts/pkg/private/load_package_dirs.m @@ -28,6 +28,11 @@ && installed_pkgs_lst{i}.loaded) continue; else + ## Insert this package at the front before recursing over dependencies. + if (! any (idx == i)) + idx = [i, idx]; + endif + if (handle_deps) deps = installed_pkgs_lst{i}.depends; if ((length (deps) > 1) @@ -36,8 +41,10 @@ for k = 1 : length (deps) for j = 1 : length (installed_pkgs_lst) if (strcmp (installed_pkgs_lst{j}.name, deps{k}.package)) - tmplidx (end + 1) = j; - break; + if (! any (idx == j)) + tmplidx (end + 1) = j; + break; + endif endif endfor endfor @@ -45,9 +52,6 @@ installed_pkgs_lst); endif endif - if (isempty (find(idx == i))) - idx (end + 1) = i; - endif endif endfor endfunction