Mercurial > octave-nkf
comparison scripts/pkg/pkg.m @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 8a8a7bc2a09d be7ac98fab43 |
children | db92e7e28e1f |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
151 ## @example | 151 ## @example |
152 ## [user_packages, system_packages] = pkg ("list") | 152 ## [user_packages, system_packages] = pkg ("list") |
153 ## @end example | 153 ## @end example |
154 ## | 154 ## |
155 ## The @qcode{"-forge"} option lists packages available at the Octave-Forge | 155 ## The @qcode{"-forge"} option lists packages available at the Octave-Forge |
156 ## repository. This requires an internet connection and the cURL library. | 156 ## repository. This requires an internet connection and the cURL library. |
157 ## For example: | 157 ## For example: |
158 ## | 158 ## |
159 ## @example | 159 ## @example |
160 ## oct_forge_pkgs = pkg ("list", "-forge") | 160 ## oct_forge_pkgs = pkg ("list", "-forge") |
161 ## @end example | 161 ## @end example |
454 endif | 454 endif |
455 endif | 455 endif |
456 else | 456 else |
457 error ("you must specify a prefix directory, or request an output argument"); | 457 error ("you must specify a prefix directory, or request an output argument"); |
458 endif | 458 endif |
459 | 459 |
460 case "local_list" | 460 case "local_list" |
461 if (isempty (files) && nargout == 0) | 461 if (isempty (files) && nargout == 0) |
462 disp (local_list); | 462 disp (local_list); |
463 elseif (isempty (files) && nargout == 1) | 463 elseif (isempty (files) && nargout == 1) |
464 local_packages = local_list; | 464 local_packages = local_list; |
465 elseif (numel (files) == 1 && nargout == 0 && ischar (files{1})) | 465 elseif (numel (files) == 1 && nargout == 0 && ischar (files{1})) |
466 local_list = files{1}; | 466 local_list = files{1}; |
467 if (! exist (local_list, "file")) | 467 if (! exist (local_list, "file")) |
468 try | 468 try |
469 ## Force file to be created | 469 ## Force file to be created |
470 fclose (fopen (local_list, "wt")); | 470 fclose (fopen (local_list, "wt")); |
471 catch | 471 catch |
472 error ("cannot create file %s", local_list); | 472 error ("cannot create file %s", local_list); |
482 disp (global_list); | 482 disp (global_list); |
483 elseif (isempty (files) && nargout == 1) | 483 elseif (isempty (files) && nargout == 1) |
484 local_packages = global_list; | 484 local_packages = global_list; |
485 elseif (numel (files) == 1 && nargout == 0 && ischar (files{1})) | 485 elseif (numel (files) == 1 && nargout == 0 && ischar (files{1})) |
486 global_list = files{1}; | 486 global_list = files{1}; |
487 if (! exist (global_list, "file")) | 487 if (! exist (global_list, "file")) |
488 try | 488 try |
489 ## Force file to be created | 489 ## Force file to be created |
490 fclose (fopen (files{1}, "wt")); | 490 fclose (fopen (files{1}, "wt")); |
491 catch | 491 catch |
492 error ("cannot create file %s", global_list); | 492 error ("cannot create file %s", global_list); |
544 | 544 |
545 case "update" | 545 case "update" |
546 if (nargout == 0) | 546 if (nargout == 0) |
547 installed_pkgs_lst = installed_packages (local_list, global_list); | 547 installed_pkgs_lst = installed_packages (local_list, global_list); |
548 if (numel (files) > 0) | 548 if (numel (files) > 0) |
549 update_lst = {}; | 549 update_lst = {}; |
550 installed_names = {installed_pkgs_list.name}'; | 550 installed_names = {installed_pkgs_list.name}'; |
551 for i = 1:numel (files) | 551 for i = 1:numel (files) |
552 idx = find (strcmp (files{i}, installed_names), 1); | 552 idx = find (strcmp (files{i}, installed_names), 1); |
553 if (isempty (idx)) | 553 if (isempty (idx)) |
554 warning ("Package %s is not installed - not updating this package", files{i}); | 554 warning ("Package %s is not installed - not updating this package", files{i}); |