Mercurial > hg > octave-lyh
comparison scripts/pkg/pkg.m @ 7208:a730e47fda4d
[project @ 2007-11-28 02:32:41 by jwe]
author | jwe |
---|---|
date | Wed, 28 Nov 2007 02:32:42 +0000 |
parents | 10b8361ff085 |
children | bf3fb3477d2a |
comparison
equal
deleted
inserted
replaced
7207:71c03c7239fb | 7208:a730e47fda4d |
---|---|
1854 ## unload package_name1 ... | 1854 ## unload package_name1 ... |
1855 else | 1855 else |
1856 dirs = {}; | 1856 dirs = {}; |
1857 desc = {}; | 1857 desc = {}; |
1858 for i = 1:length (files) | 1858 for i = 1:length (files) |
1859 idx = strcmp (pnames, files {i}); | 1859 idx = strcmp (pnames, files{i}); |
1860 if (! any (idx)) | 1860 if (! any (idx)) |
1861 error ("package %s is not installed", files{i}); | 1861 error ("package %s is not installed", files{i}); |
1862 endif | 1862 endif |
1863 dirs {end + 1} = pdirs {idx}; | 1863 dirs{end+1} = pdirs{idx}; |
1864 desc {end + 1} = installed_pkgs_lst {idx}; | 1864 desc{end+1} = installed_pkgs_lst{idx}; |
1865 endfor | 1865 endfor |
1866 endif | 1866 endif |
1867 | 1867 |
1868 ## Check for architecture dependent directories | 1868 ## Check for architecture dependent directories |
1869 archdirs = {}; | 1869 archdirs = {}; |
1870 for i = 1:length (dirs) | 1870 for i = 1:length (dirs) |
1871 tmpdir = getarchdir (desc {i}); | 1871 tmpdir = getarchdir (desc{i}); |
1872 if (exist (tmpdir, "dir")) | 1872 if (exist (tmpdir, "dir")) |
1873 archdirs{end + 1} = dirs{i}; | 1873 archdirs{end+1} = dirs{i}; |
1874 archdirs{end + 1} = tmpdir; | 1874 archdirs{end+1} = tmpdir; |
1875 else | 1875 else |
1876 archdirs{end+ 1} = dirs {i}; | 1876 archdirs{end+1} = dirs{i}; |
1877 endif | 1877 endif |
1878 endfor | 1878 endfor |
1879 | 1879 |
1880 ## Unload the packages | 1880 ## Unload the packages |
1881 for i = 1:length (archdirs) | 1881 for i = 1:length (archdirs) |
1995 else | 1995 else |
1996 tmpdesc = {}; | 1996 tmpdesc = {}; |
1997 for k = 1 : length (deps) | 1997 for k = 1 : length (deps) |
1998 for j = 1 : length (desc) | 1998 for j = 1 : length (desc) |
1999 if (strcmp (desc{j}.name, deps{k}.package)) | 1999 if (strcmp (desc{j}.name, deps{k}.package)) |
2000 tmpdesc {end + 1} = desc{j}; | 2000 tmpdesc{end+1} = desc{j}; |
2001 break; | 2001 break; |
2002 endif | 2002 endif |
2003 endfor | 2003 endfor |
2004 endfor | 2004 endfor |
2005 if (! isempty (tmpdesc)) | 2005 if (! isempty (tmpdesc)) |
2006 newdesc = {newdesc{:}, save_order(tmpdesc){:}, desc{i}}; | 2006 newdesc = {newdesc{:}, save_order(tmpdesc){:}, desc{i}}; |
2007 else | 2007 else |
2008 newdesc {end + 1} = desc{i}; | 2008 newdesc{end+1} = desc{i}; |
2009 endif | 2009 endif |
2010 endif | 2010 endif |
2011 endfor | 2011 endfor |
2012 ## Eliminate the duplicates | 2012 ## Eliminate the duplicates |
2013 idx = []; | 2013 idx = []; |
2026 idx = load_package_dirs (idx, [], handle_deps, installed_pkgs_lst); | 2026 idx = load_package_dirs (idx, [], handle_deps, installed_pkgs_lst); |
2027 dirs = {}; | 2027 dirs = {}; |
2028 execpath = EXEC_PATH (); | 2028 execpath = EXEC_PATH (); |
2029 for i = idx; | 2029 for i = idx; |
2030 ndir = installed_pkgs_lst{i}.dir; | 2030 ndir = installed_pkgs_lst{i}.dir; |
2031 dirs {end + 1} = ndir; | 2031 dirs{end+1} = ndir; |
2032 if (exist (fullfile (dirs{end}, "bin"), "dir")) | 2032 if (exist (fullfile (dirs{end}, "bin"), "dir")) |
2033 execpath = strcat (fullfile(dirs{end}, "bin"), ":", execpath); | 2033 execpath = strcat (fullfile(dirs{end}, "bin"), ":", execpath); |
2034 endif | 2034 endif |
2035 tmpdir = getarchdir (installed_pkgs_lst {i}); | 2035 tmpdir = getarchdir (installed_pkgs_lst{i}); |
2036 if (exist (tmpdir, "dir")) | 2036 if (exist (tmpdir, "dir")) |
2037 dirs{end + 1} = tmpdir; | 2037 dirs{end + 1} = tmpdir; |
2038 if (exist (fullfile (dirs{end}, "bin"), "dir")) | 2038 if (exist (fullfile (dirs{end}, "bin"), "dir")) |
2039 execpath = strcat (fullfile(dirs{end}, "bin"), ":", execpath); | 2039 execpath = strcat (fullfile(dirs{end}, "bin"), ":", execpath); |
2040 endif | 2040 endif |
2085 function dep = is_architecture_dependent (nm) | 2085 function dep = is_architecture_dependent (nm) |
2086 persistent archdepsuffix = {".oct",".mex",".a",".so",".so.*",".dll","dylib"}; | 2086 persistent archdepsuffix = {".oct",".mex",".a",".so",".so.*",".dll","dylib"}; |
2087 | 2087 |
2088 dep = false; | 2088 dep = false; |
2089 for i = 1 : length (archdepsuffix) | 2089 for i = 1 : length (archdepsuffix) |
2090 ext = archdepsuffix {i}; | 2090 ext = archdepsuffix{i}; |
2091 if (ext(end) == "*") | 2091 if (ext(end) == "*") |
2092 isglob = true; | 2092 isglob = true; |
2093 ext(end) = []; | 2093 ext(end) = []; |
2094 else | 2094 else |
2095 isglob = false; | 2095 isglob = false; |
2096 endif | 2096 endif |
2097 pos = findstr (nm, ext); | 2097 pos = findstr (nm, ext); |
2098 if (pos) | 2098 if (pos) |
2099 if (! isglob && (length(nm) - pos(end) != length(ext) - 1)) | 2099 if (! isglob && (length(nm) - pos(end) != length(ext) - 1)) |
2100 continue; | 2100 continue; |
2101 endif | 2101 endif |
2102 dep = true; | 2102 dep = true; |
2103 break; | 2103 break; |
2104 endif | 2104 endif |