Mercurial > octave-nkf
comparison scripts/pkg/pkg.m @ 5974:51684d05b4bf
[project @ 2006-08-26 09:36:44 by dbateman]
author | dbateman |
---|---|
date | Sat, 26 Aug 2006 09:38:53 +0000 |
parents | 9cc8149f81b0 |
children | b1a1c10bf2fd |
comparison
equal
deleted
inserted
replaced
5973:3cbefe88edc6 | 5974:51684d05b4bf |
---|---|
83 | 83 |
84 function install(files, handle_deps) | 84 function install(files, handle_deps) |
85 ## Set parameters depending on wether or not the installation | 85 ## Set parameters depending on wether or not the installation |
86 ## is system-wide (global) or local. | 86 ## is system-wide (global) or local. |
87 local_list = tilde_expand("~/.octave_packages"); | 87 local_list = tilde_expand("~/.octave_packages"); |
88 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | 88 if (strcmp(OCTAVE_HOME()(end),"/")) |
89 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | |
90 else | |
91 global_list = [OCTAVE_HOME "/share/octave/octave_packages"]; | |
92 endif | |
89 global OCTAVE_PACKAGE_PREFIX; | 93 global OCTAVE_PACKAGE_PREFIX; |
90 prefix_exist = (length(OCTAVE_PACKAGE_PREFIX) != 0 && ischar(OCTAVE_PACKAGE_PREFIX)); | 94 prefix_exist = (length(OCTAVE_PACKAGE_PREFIX) != 0 && ischar(OCTAVE_PACKAGE_PREFIX)); |
91 | 95 |
92 if (issuperuser()) | 96 if (issuperuser()) |
93 global_install = true; | 97 global_install = true; |
327 endif | 331 endif |
328 endfunction | 332 endfunction |
329 | 333 |
330 function uninstall(pkgnames, handle_deps) | 334 function uninstall(pkgnames, handle_deps) |
331 local_list = tilde_expand("~/.octave_packages"); | 335 local_list = tilde_expand("~/.octave_packages"); |
332 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | 336 if (strcmp(OCTAVE_HOME()(end),"/")) |
337 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | |
338 else | |
339 global_list = [OCTAVE_HOME "/share/octave/octave_packages"]; | |
340 endif | |
333 ## Get the list of installed packages | 341 ## Get the list of installed packages |
334 [local_packages, global_packages] = installed_packages(); | 342 [local_packages, global_packages] = installed_packages(); |
335 if (issuperuser()) | 343 if (issuperuser()) |
336 installed_packages = global_packages; | 344 installed_packages = global_packages; |
337 else | 345 else |
946 endif | 954 endif |
947 endfunction | 955 endfunction |
948 | 956 |
949 function [out1, out2] = installed_packages() | 957 function [out1, out2] = installed_packages() |
950 local_list = tilde_expand("~/.octave_packages"); | 958 local_list = tilde_expand("~/.octave_packages"); |
951 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | 959 if (strcmp(OCTAVE_HOME()(end),"/")) |
960 global_list = [OCTAVE_HOME "share/octave/octave_packages"]; | |
961 else | |
962 global_list = [OCTAVE_HOME "/share/octave/octave_packages"]; | |
963 endif | |
952 ## Get the list of installed packages | 964 ## Get the list of installed packages |
953 try | 965 try |
954 local_packages = load(local_list).local_packages; | 966 local_packages = load(local_list).local_packages; |
955 catch | 967 catch |
956 local_packages = {}; | 968 local_packages = {}; |