Mercurial > octave
annotate scripts/pkg/pkg.m @ 14466:cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
* pkg.m: move all sub-functions to private/
* pkg/private/absolute_pathname.m
* pkg/private/build.m
* pkg/private/configure_make.m
* pkg/private/copy_files.m
* pkg/private/create_pkgadddel.m
* pkg/private/describe.m
* pkg/private/dirempty.m
* pkg/private/extract_pkg.m
* pkg/private/finish_installation.m
* pkg/private/fix_depends.m
* pkg/private/fix_version.m
* pkg/private/generate_lookfor_cache.m
* pkg/private/get_description.m
* pkg/private/get_forge_download.m
* pkg/private/get_forge_pkg.m
* pkg/private/getarch.m
* pkg/private/getarchdir.m
* pkg/private/getarchprefix.m
* pkg/private/get_unsatisfied_deps.m
* pkg/private/install.m
* pkg/private/installed_packages.m
* pkg/private/is_architecture_dependent.m
* pkg/private/isautoload.m
* pkg/private/issuperuser.m
* pkg/private/list_forge_packages.m
* pkg/private/load_package_dirs.m
* pkg/private/load_packages.m
* pkg/private/load_packages_and_dependencies.m
* pkg/private/packinfo_copy_file.m
* pkg/private/parse_pkg_idx.m
* pkg/private/prepare_installation.m
* pkg/private/print_package_description.m
* pkg/private/rebuild.m
* pkg/private/repackage.m
* pkg/private/rm_rf.m
* pkg/private/rstrip.m
* pkg/private/save_order.m
* pkg/private/shell.m
* pkg/private/split_by.m
* pkg/private/strip.m
* pkg/private/uninstall.m
* pkg/private/unload_packages.m
* pkg/private/verify_directory.m
* pkg/private/write_index.m
author | Carlo de Falco <kingcrimson@tiscali.it> |
---|---|
date | Thu, 15 Mar 2012 19:41:24 +0100 |
parents | 12ccdce2c216 |
children | d2c095e45196 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14010
diff
changeset
|
1 ## Copyright (C) 2005-2012 S�ren Hauberg |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
2 ## Copyright (C) 2010 VZLU Prague, a.s. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14446
diff
changeset
|
3 ## Copyright (C) 2012 Carlo de Falco |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
4 ## |
6440 | 5 ## This file is part of Octave. |
6 ## | |
7 ## Octave is free software; you can redistribute it and/or modify it | |
8 ## under the terms of the GNU General Public License as published by | |
7016 | 9 ## the Free Software Foundation; either version 3 of the License, or (at |
10 ## your option) any later version. | |
6440 | 11 ## |
12 ## Octave is distributed in the hope that it will be useful, but | |
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 ## General Public License for more details. | |
16 ## | |
5801 | 17 ## You should have received a copy of the GNU General Public License |
7016 | 18 ## along with Octave; see the file COPYING. If not, see |
19 ## <http://www.gnu.org/licenses/>. | |
5801 | 20 |
21 ## -*- texinfo -*- | |
11547 | 22 ## @deftypefn {Command} {} pkg @var{command} @var{pkg_name} |
23 ## @deftypefnx {Command} {} pkg @var{command} @var{option} @var{pkg_name} | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
24 ## Manage packages (groups of add-on functions) for Octave. Different actions |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
25 ## are available depending on the value of @var{command}. |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
26 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
27 ## Available commands: |
6032 | 28 ## |
29 ## @table @samp | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
30 ## |
6032 | 31 ## @item install |
6070 | 32 ## Install named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
33 ## |
6070 | 34 ## @example |
35 ## pkg install image-1.0.0.tar.gz | |
36 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
37 ## |
6070 | 38 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
39 ## installs the package found in the file @file{image-1.0.0.tar.gz}. |
6070 | 40 ## |
6645 | 41 ## The @var{option} variable can contain options that affect the manner |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
42 ## in which a package is installed. These options can be one or more of |
6645 | 43 ## |
44 ## @table @code | |
45 ## @item -nodeps | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
46 ## The package manager will disable dependency checking. With this option it |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
47 ## is possible to install a package even when it depends on another package |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
48 ## which is not installed on the system. @strong{Use this option with care.} |
6645 | 49 ## |
50 ## @item -noauto | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
51 ## The package manager will not automatically load the installed package |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
52 ## when starting Octave. This overrides any setting within the package. |
6258 | 53 ## |
6645 | 54 ## @item -auto |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
55 ## The package manager will automatically load the installed package when |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
56 ## starting Octave. This overrides any setting within the package. |
6645 | 57 ## |
58 ## @item -local | |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
59 ## A local installation (package available only to current user) is forced, |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
60 ## even if the user has system privileges. |
6258 | 61 ## |
6645 | 62 ## @item -global |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
63 ## A global installation (package available to all users) is forced, even if |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
64 ## the user doesn't normally have system privileges. |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12561
diff
changeset
|
65 ## |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
66 ## @item -forge |
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
67 ## Install a package directly from the Octave-Forge repository. This |
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
68 ## requires an internet connection and the cURL library. |
6614 | 69 ## |
6645 | 70 ## @item -verbose |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
71 ## The package manager will print the output of all commands as |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
72 ## they are performed. |
6645 | 73 ## @end table |
74 ## | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
75 ## @item update |
13931
9de488c6c59c
doc: Spellcheck documentation before 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents:
13864
diff
changeset
|
76 ## Check installed Octave-Forge packages against repository and update any |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
77 ## outdated items. This requires an internet connection and the cURL library. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
78 ## Usage: |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
79 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
80 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
81 ## pkg update |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
82 ## @end example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
83 ## |
6032 | 84 ## @item uninstall |
6070 | 85 ## Uninstall named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
86 ## |
6070 | 87 ## @example |
88 ## pkg uninstall image | |
89 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
90 ## |
6070 | 91 ## @noindent |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
92 ## removes the @code{image} package from the system. If another installed |
6070 | 93 ## package depends on the @code{image} package an error will be issued. |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10685
diff
changeset
|
94 ## The package can be uninstalled anyway by using the @option{-nodeps} option. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
95 ## |
6032 | 96 ## @item load |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
97 ## Add named packages to the path. After loading a package it is |
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
98 ## possible to use the functions provided by the package. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
99 ## |
6070 | 100 ## @example |
101 ## pkg load image | |
102 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
103 ## |
6070 | 104 ## @noindent |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
105 ## adds the @code{image} package to the path. It is possible to load all |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
106 ## installed packages at once with the keyword @samp{all}. Usage: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
107 ## |
6070 | 108 ## @example |
109 ## pkg load all | |
110 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
111 ## |
6203 | 112 ## @item unload |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
113 ## Remove named packages from the path. After unloading a package it is |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
114 ## no longer possible to use the functions provided by the package. It is |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
115 ## possible to unload all installed packages at once with the keyword |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
116 ## @samp{all}. Usage: |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
117 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
118 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
119 ## pkg unload all |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
120 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
121 ## |
6032 | 122 ## @item list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
123 ## Show the list of currently installed packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
124 ## |
6070 | 125 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
126 ## installed_packages = pkg ("list") |
6070 | 127 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
128 ## |
6070 | 129 ## @noindent |
130 ## returns a cell array containing a structure for each installed package. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
131 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
132 ## If two output arguments are requested @code{pkg} splits the list of |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
133 ## installed packages into those which were installed by the current user, |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
134 ## and those which were installed by the system administrator. |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
135 ## |
6070 | 136 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
137 ## [user_packages, system_packages] = pkg ("list") |
6070 | 138 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
139 ## |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14214
diff
changeset
|
140 ## The option "-forge" lists packages available at the Octave-Forge repository. |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
141 ## This requires an internet connection and the cURL library. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
142 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
143 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
144 ## oct_forge_pkgs = pkg ("list", "-forge") |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
145 ## @end example |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
146 ## |
7497 | 147 ## @item describe |
148 ## Show a short description of the named installed packages, with the option | |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14214
diff
changeset
|
149 ## "-verbose" also list functions provided by the package. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
150 ## |
7497 | 151 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
152 ## pkg describe -verbose all |
7497 | 153 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
154 ## |
7497 | 155 ## @noindent |
156 ## will describe all installed packages and the functions they provide. | |
157 ## If one output is requested a cell of structure containing the | |
158 ## description and list of functions of each package is returned as | |
159 ## output rather than printed on screen: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
160 ## |
7497 | 161 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
162 ## desc = pkg ("describe", "secs1d", "image") |
7497 | 163 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
164 ## |
7497 | 165 ## @noindent |
166 ## If any of the requested packages is not installed, pkg returns an | |
167 ## error, unless a second output is requested: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
168 ## |
7497 | 169 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
170 ## [desc, flag] = pkg ("describe", "secs1d", "image") |
7497 | 171 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
172 ## |
7497 | 173 ## @noindent |
174 ## @var{flag} will take one of the values "Not installed", "Loaded" or | |
175 ## "Not loaded" for each of the named packages. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
176 ## |
6034 | 177 ## @item prefix |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
178 ## Set the installation prefix directory. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
179 ## |
6070 | 180 ## @example |
181 ## pkg prefix ~/my_octave_packages | |
182 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
183 ## |
6070 | 184 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
185 ## sets the installation prefix to @file{~/my_octave_packages}. |
6070 | 186 ## Packages will be installed in this directory. |
6034 | 187 ## |
6070 | 188 ## It is possible to get the current installation prefix by requesting an |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
189 ## output argument. For example: |
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
190 ## |
6070 | 191 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
192 ## pfx = pkg ("prefix") |
6070 | 193 ## @end example |
6925 | 194 ## |
195 ## The location in which to install the architecture dependent files can be | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
196 ## independently specified with an addition argument. For example: |
6925 | 197 ## |
198 ## @example | |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9079
diff
changeset
|
199 ## pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs |
6925 | 200 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
201 ## |
6189 | 202 ## @item local_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
203 ## Set the file in which to look for information on locally |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
204 ## installed packages. Locally installed packages are those that are |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
205 ## available only to the current user. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
206 ## |
6189 | 207 ## @example |
208 ## pkg local_list ~/.octave_packages | |
209 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
210 ## |
6189 | 211 ## It is possible to get the current value of local_list with the following |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
212 ## |
6189 | 213 ## @example |
214 ## pkg local_list | |
215 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
216 ## |
6189 | 217 ## @item global_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
218 ## Set the file in which to look for information on globally |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
219 ## installed packages. Globally installed packages are those that are |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
220 ## available to all users. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
221 ## |
6189 | 222 ## @example |
223 ## pkg global_list /usr/share/octave/octave_packages | |
224 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
225 ## |
6189 | 226 ## It is possible to get the current value of global_list with the following |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
227 ## |
6189 | 228 ## @example |
229 ## pkg global_list | |
230 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
231 ## |
6675 | 232 ## @item build |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
233 ## Build a binary form of a package or packages. The binary file produced |
6675 | 234 ## will itself be an Octave package that can be installed normally with |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
235 ## @code{pkg}. The form of the command to build a binary package is |
6675 | 236 ## |
237 ## @example | |
238 ## pkg build builddir image-1.0.0.tar.gz @dots{} | |
239 ## @end example | |
240 ## | |
241 ## @noindent | |
9079
4d610aba7347
Cleanup documentation for system.texi, package.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
242 ## where @code{builddir} is the name of a directory where the temporary |
6675 | 243 ## installation will be produced and the binary packages will be found. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
244 ## The options @option{-verbose} and @option{-nodeps} are respected, while |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
245 ## all other options are ignored. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
246 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
247 ## @item rebuild |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
248 ## Rebuild the package database from the installed directories. This can |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
249 ## be used in cases where the package database has been corrupted. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
250 ## It can also take the @option{-auto} and @option{-noauto} options to allow the |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
251 ## autoloading state of a package to be changed. For example, |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
252 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
253 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
254 ## pkg rebuild -noauto image |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
255 ## @end example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
256 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
257 ## @noindent |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
258 ## will remove the autoloading status of the image package. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
259 ## |
6032 | 260 ## @end table |
11547 | 261 ## @end deftypefn |
5947 | 262 |
6496 | 263 function [local_packages, global_packages] = pkg (varargin) |
8202
cf59d542f33e
replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents:
8174
diff
changeset
|
264 ## Installation prefix (FIXME: what should these be on windows?) |
6645 | 265 persistent user_prefix = false; |
6496 | 266 persistent prefix = -1; |
6925 | 267 persistent archprefix = -1; |
7498 | 268 persistent local_list = tilde_expand (fullfile ("~", ".octave_packages")); |
6496 | 269 persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", |
10549 | 270 "octave_packages"); |
6496 | 271 mlock (); |
6189 | 272 |
6925 | 273 global_install = issuperuser (); |
6683 | 274 |
6496 | 275 if (prefix == -1) |
6645 | 276 if (global_install) |
6496 | 277 prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages"); |
12710
762d10c77277
maint: use libdir for .oct files, not libexecdir
John W. Eaton <jwe@octave.org>
parents:
12642
diff
changeset
|
278 archprefix = fullfile (octave_config_info ("libdir"), |
10549 | 279 "octave", "packages"); |
6496 | 280 else |
281 prefix = fullfile ("~", "octave"); | |
6925 | 282 archprefix = prefix; |
5801 | 283 endif |
6645 | 284 prefix = tilde_expand (prefix); |
6925 | 285 archprefix = tilde_expand (archprefix); |
6496 | 286 endif |
287 | |
7498 | 288 available_actions = {"list", "install", "uninstall", "load", ... |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
289 "unload", "prefix", "local_list", ... |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
290 "global_list", "rebuild", "build", ... |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
291 "describe", "update"}; |
6496 | 292 ## Handle input |
293 if (length (varargin) == 0 || ! iscellstr (varargin)) | |
294 print_usage (); | |
295 endif | |
296 files = {}; | |
297 deps = true; | |
298 auto = 0; | |
299 action = "none"; | |
6614 | 300 verbose = false; |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
301 octave_forge = false; |
6496 | 302 for i = 1:length (varargin) |
303 switch (varargin{i}) | |
304 case "-nodeps" | |
10549 | 305 deps = false; |
6496 | 306 case "-noauto" |
10549 | 307 auto = -1; |
6496 | 308 case "-auto" |
10549 | 309 auto = 1; |
6614 | 310 case "-verbose" |
10549 | 311 verbose = true; |
13275
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
312 ## Send verbose output to pager immediately. Change setting locally. |
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
313 page_output_immediately (true, "local"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
314 case "-forge" |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
315 octave_forge = true; |
6645 | 316 case "-local" |
10549 | 317 global_install = false; |
318 if (! user_prefix) | |
319 prefix = tilde_expand (fullfile ("~", "octave")); | |
320 archprefix = prefix; | |
321 endif | |
6645 | 322 case "-global" |
10549 | 323 global_install = true; |
324 if (! user_prefix) | |
325 prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages"); | |
12710
762d10c77277
maint: use libdir for .oct files, not libexecdir
John W. Eaton <jwe@octave.org>
parents:
12642
diff
changeset
|
326 archprefix = fullfile (octave_config_info ("libdir"), |
10549 | 327 "octave", "packages"); |
328 endif | |
7497 | 329 case available_actions |
10549 | 330 if (strcmp (action, "none")) |
331 action = varargin{i}; | |
332 else | |
333 error ("more than one action specified"); | |
334 endif | |
6496 | 335 otherwise |
10549 | 336 files{end+1} = varargin{i}; |
5801 | 337 endswitch |
6496 | 338 endfor |
339 | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
340 if (octave_forge && ! any (strcmp (action, {"install", "list"}))) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
341 error ("-forge can only be used with install or list"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
342 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
343 |
6496 | 344 ## Take action |
345 switch (action) | |
346 case "list" | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
347 if (octave_forge) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
348 if (nargout > 0) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
349 local_packages = list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
350 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
351 list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
352 endif |
6496 | 353 else |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
354 if (nargout == 0) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
355 installed_packages (local_list, global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
356 elseif (nargout == 1) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
357 local_packages = installed_packages (local_list, global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
358 elseif (nargout == 2) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
359 [local_packages, global_packages] = installed_packages (local_list, |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
360 global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
361 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
362 error ("too many output arguments requested"); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
363 endif |
6496 | 364 endif |
365 | |
366 case "install" | |
367 if (length (files) == 0) | |
10549 | 368 error ("you must specify at least one filename when calling 'pkg install'"); |
6496 | 369 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
370 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
371 local_files = {}; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
372 unwind_protect |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
373 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
374 if (octave_forge) |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12779
diff
changeset
|
375 [urls, local_files] = cellfun ("get_forge_download", files, "uniformoutput", false); |
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12779
diff
changeset
|
376 [files, succ] = cellfun ("urlwrite", urls, local_files, "uniformoutput", false); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
377 succ = [succ{:}]; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
378 if (! all (succ)) |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
379 i = find (! succ, 1); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
380 error ("could not download file %s from url %s", local_files{i}, urls{i}); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
381 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
382 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
383 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
384 install (files, deps, auto, prefix, archprefix, verbose, local_list, |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
385 global_list, global_install); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
386 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
387 unwind_protect_cleanup |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
12779
diff
changeset
|
388 cellfun ("unlink", local_files); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
389 end_unwind_protect |
6496 | 390 |
391 case "uninstall" | |
392 if (length (files) == 0) | |
10549 | 393 error ("you must specify at least one package when calling 'pkg uninstall'"); |
6496 | 394 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
395 uninstall (files, deps, verbose, local_list, |
10549 | 396 global_list, global_install); |
6496 | 397 |
398 case "load" | |
399 if (length (files) == 0) | |
10549 | 400 error ("you must specify at least one package, 'all' or 'auto' when calling 'pkg load'"); |
6496 | 401 endif |
402 load_packages (files, deps, local_list, global_list); | |
403 | |
404 case "unload" | |
405 if (length (files) == 0) | |
10549 | 406 error ("you must specify at least one package or 'all' when calling 'pkg unload'"); |
6496 | 407 endif |
408 unload_packages (files, deps, local_list, global_list); | |
409 | |
410 case "prefix" | |
411 if (length (files) == 0 && nargout == 0) | |
10549 | 412 printf ("Installation prefix: %s\n", prefix); |
413 printf ("Architecture dependent prefix: %s\n", archprefix); | |
6925 | 414 elseif (length (files) == 0 && nargout >= 1) |
10549 | 415 local_packages = prefix; |
416 global_packages = archprefix; | |
6925 | 417 elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1})) |
10549 | 418 prefix = files{1}; |
419 prefix = absolute_pathname (prefix); | |
420 local_packages = prefix; | |
421 user_prefix = true; | |
422 if (length (files) >= 2 && ischar (files{2})) | |
423 archprefix = files{2}; | |
424 try | |
425 archprefix = absolute_pathname (archprefix); | |
6925 | 426 catch |
10549 | 427 mkdir (archprefix); |
428 warning ("creating the directory %s\n", archprefix); | |
429 archprefix = absolute_pathname (archprefix); | |
430 end_try_catch | |
431 global_packages = archprefix; | |
432 endif | |
6496 | 433 else |
10549 | 434 error ("you must specify a prefix directory, or request an output argument"); |
6496 | 435 endif |
436 | |
437 case "local_list" | |
438 if (length (files) == 0 && nargout == 0) | |
10549 | 439 disp (local_list); |
6496 | 440 elseif (length (files) == 0 && nargout == 1) |
10549 | 441 local_packages = local_list; |
6496 | 442 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) |
10549 | 443 try |
444 local_list = absolute_pathname (files{1}); | |
445 catch | |
446 ## Force file to be created | |
447 fclose (fopen (files{1}, "wt")); | |
448 local_list = absolute_pathname (files{1}); | |
449 end_try_catch | |
6496 | 450 else |
10549 | 451 error ("you must specify a local_list file, or request an output argument"); |
6496 | 452 endif |
453 | |
454 case "global_list" | |
455 if (length (files) == 0 && nargout == 0) | |
10549 | 456 disp(global_list); |
6496 | 457 elseif (length (files) == 0 && nargout == 1) |
10549 | 458 local_packages = global_list; |
6496 | 459 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) |
10549 | 460 try |
461 global_list = absolute_pathname (files{1}); | |
462 catch | |
463 ## Force file to be created | |
464 fclose (fopen (files{1}, "wt")); | |
465 global_list = absolute_pathname (files{1}); | |
466 end_try_catch | |
6496 | 467 else |
10549 | 468 error ("you must specify a global_list file, or request an output argument"); |
6496 | 469 endif |
6645 | 470 |
471 case "rebuild" | |
472 if (global_install) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
473 global_packages = rebuild (prefix, archprefix, global_list, files, |
10549 | 474 auto, verbose); |
475 global_packages = save_order (global_packages); | |
476 save (global_list, "global_packages"); | |
477 if (nargout > 0) | |
478 local_packages = global_packages; | |
479 endif | |
6645 | 480 else |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
481 local_packages = rebuild (prefix, archprefix, local_list, files, auto, |
10549 | 482 verbose); |
483 local_packages = save_order (local_packages); | |
484 save (local_list, "local_packages"); | |
485 if (nargout == 0) | |
486 clear ("local_packages"); | |
487 endif | |
6645 | 488 endif |
489 | |
6675 | 490 case "build" |
491 if (length (files) < 2) | |
10549 | 492 error ("you must specify at least the build directory and one filename\nwhen calling 'pkg build'"); |
6675 | 493 endif |
494 build (files, deps, auto, verbose); | |
495 | |
7497 | 496 case "describe" |
497 if (length (files) == 0) | |
10549 | 498 error ("you must specify at least one package or 'all' when calling 'pkg describe'"); |
7497 | 499 endif |
8202
cf59d542f33e
replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents:
8174
diff
changeset
|
500 ## FIXME: the name of the output variables is inconsistent |
7497 | 501 ## with their content |
502 switch (nargout) | |
10549 | 503 case 0 |
504 describe (files, verbose, local_list, global_list); | |
505 case 1 | |
506 pkg_desc_list = describe (files, verbose, local_list, ... | |
507 global_list); | |
508 local_packages = pkg_desc_list; | |
509 case 2 | |
510 [pkg_desc_list, flag] = describe (files, verbose, local_list, ... | |
511 global_list); | |
512 local_packages = pkg_desc_list; | |
513 global_packages = flag; | |
514 otherwise | |
515 error ("you can request at most two outputs when calling 'pkg describe'"); | |
7498 | 516 endswitch |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
517 |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
518 case "update" |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
519 if (nargout == 0) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
520 installed_pkgs_lst = installed_packages (local_list, global_list); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
521 for i = 1:length (installed_pkgs_lst) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
522 installed_pkg_name = installed_pkgs_lst{i}.name; |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
523 installed_pkg_version = installed_pkgs_lst{i}.version; |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
524 forge_pkg_version = get_forge_pkg (installed_pkg_name); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
525 if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
526 feval (@pkg, "install", "-forge", installed_pkg_name); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
527 endif |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
528 endfor |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
529 else |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
530 error ("no output arguments available"); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
531 endif |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
532 |
6496 | 533 otherwise |
534 error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); | |
535 endswitch | |
536 endfunction |