Mercurial > hg > octave-lyh
annotate scripts/pkg/pkg.m @ 17384:f0e3d3de5c22
build: Enable subdir-objects Automake option project-wide
* configure.ac (AM_INIT_AUTOMAKE): Add subdir-objects option to enable it
project-wide to simplify and anticipate future Automake defaults.
* libgui/Makefile.am, libinterp/Makefile.am, liboctave/Makefile.am,
liboctave/cruft/Makefile.am, scripts/Makefile.am (AUTOMAKE_OPTIONS): Delete.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Thu, 05 Sep 2013 01:49:29 -0400 |
parents | 1c89599167a6 |
children |
rev | line source |
---|---|
17251
f4c8c66faf34
maint: Update source file encodings to UTF-8 and fix character errors
Mike Miller <mtmiller@ieee.org>
parents:
16304
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 ## |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
140 ## The option @qcode{"-forge"} lists packages available at the Octave-Forge |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
141 ## repository. This requires an internet connection and the cURL library. |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
142 ## For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
143 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
144 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
145 ## oct_forge_pkgs = pkg ("list", "-forge") |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
146 ## @end example |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
147 ## |
7497 | 148 ## @item describe |
149 ## Show a short description of the named installed packages, with the option | |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
150 ## @qcode{"-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
|
151 ## |
7497 | 152 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
153 ## pkg describe -verbose all |
7497 | 154 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
155 ## |
7497 | 156 ## @noindent |
157 ## will describe all installed packages and the functions they provide. | |
158 ## If one output is requested a cell of structure containing the | |
159 ## description and list of functions of each package is returned as | |
160 ## output rather than printed on screen: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
161 ## |
7497 | 162 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
163 ## desc = pkg ("describe", "secs1d", "image") |
7497 | 164 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
165 ## |
7497 | 166 ## @noindent |
167 ## If any of the requested packages is not installed, pkg returns an | |
168 ## error, unless a second output is requested: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
169 ## |
7497 | 170 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
171 ## [desc, flag] = pkg ("describe", "secs1d", "image") |
7497 | 172 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
173 ## |
7497 | 174 ## @noindent |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
175 ## @var{flag} will take one of the values @qcode{"Not installed"}, |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
176 ## @qcode{"Loaded"}, or |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17251
diff
changeset
|
177 ## @qcode{"Not loaded"} for each of the named packages. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
178 ## |
6034 | 179 ## @item prefix |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
180 ## Set the installation prefix directory. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
181 ## |
6070 | 182 ## @example |
183 ## pkg prefix ~/my_octave_packages | |
184 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
185 ## |
6070 | 186 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
187 ## sets the installation prefix to @file{~/my_octave_packages}. |
6070 | 188 ## Packages will be installed in this directory. |
6034 | 189 ## |
6070 | 190 ## 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
|
191 ## output argument. For example: |
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
192 ## |
6070 | 193 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
194 ## pfx = pkg ("prefix") |
6070 | 195 ## @end example |
6925 | 196 ## |
197 ## 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
|
198 ## independently specified with an addition argument. For example: |
6925 | 199 ## |
200 ## @example | |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9079
diff
changeset
|
201 ## pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs |
6925 | 202 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
203 ## |
6189 | 204 ## @item local_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
205 ## 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
|
206 ## 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
|
207 ## available only to the current user. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
208 ## |
6189 | 209 ## @example |
210 ## pkg local_list ~/.octave_packages | |
211 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
212 ## |
6189 | 213 ## 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
|
214 ## |
6189 | 215 ## @example |
216 ## pkg local_list | |
217 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
218 ## |
6189 | 219 ## @item global_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
220 ## 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
|
221 ## 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
|
222 ## available to all users. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
223 ## |
6189 | 224 ## @example |
225 ## pkg global_list /usr/share/octave/octave_packages | |
226 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
227 ## |
6189 | 228 ## 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
|
229 ## |
6189 | 230 ## @example |
231 ## pkg global_list | |
232 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
233 ## |
6675 | 234 ## @item build |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
235 ## Build a binary form of a package or packages. The binary file produced |
6675 | 236 ## 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
|
237 ## @code{pkg}. The form of the command to build a binary package is |
6675 | 238 ## |
239 ## @example | |
240 ## pkg build builddir image-1.0.0.tar.gz @dots{} | |
241 ## @end example | |
242 ## | |
243 ## @noindent | |
9079
4d610aba7347
Cleanup documentation for system.texi, package.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
244 ## where @code{builddir} is the name of a directory where the temporary |
6675 | 245 ## 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
|
246 ## 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
|
247 ## all other options are ignored. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
248 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
249 ## @item rebuild |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
250 ## 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
|
251 ## 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
|
252 ## 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
|
253 ## 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
|
254 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
255 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
256 ## pkg rebuild -noauto image |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
257 ## @end example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
258 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
259 ## @noindent |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
260 ## will remove the autoloading status of the image package. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
261 ## |
6032 | 262 ## @end table |
11547 | 263 ## @end deftypefn |
5947 | 264 |
6496 | 265 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
|
266 ## Installation prefix (FIXME: what should these be on windows?) |
6645 | 267 persistent user_prefix = false; |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
268 persistent prefix = false; |
6925 | 269 persistent archprefix = -1; |
7498 | 270 persistent local_list = tilde_expand (fullfile ("~", ".octave_packages")); |
6496 | 271 persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", |
10549 | 272 "octave_packages"); |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
273 |
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
274 confirm_recursive_rmdir (false, "local"); |
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
275 |
6496 | 276 mlock (); |
6189 | 277 |
14472
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
278 ## If user is superuser set global_istall to true |
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
279 ## FIXME: is it OK to set this always true on windows? |
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
280 global_install = ((ispc () && ! isunix ()) || (geteuid () == 0)); |
6683 | 281 |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
282 if (isbool (prefix)) |
6645 | 283 if (global_install) |
6496 | 284 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
|
285 archprefix = fullfile (octave_config_info ("libdir"), |
10549 | 286 "octave", "packages"); |
6496 | 287 else |
288 prefix = fullfile ("~", "octave"); | |
6925 | 289 archprefix = prefix; |
5801 | 290 endif |
6645 | 291 prefix = tilde_expand (prefix); |
6925 | 292 archprefix = tilde_expand (archprefix); |
6496 | 293 endif |
294 | |
7498 | 295 available_actions = {"list", "install", "uninstall", "load", ... |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
296 "unload", "prefix", "local_list", ... |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
297 "global_list", "rebuild", "build", ... |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
298 "describe", "update"}; |
6496 | 299 ## Handle input |
300 if (length (varargin) == 0 || ! iscellstr (varargin)) | |
301 print_usage (); | |
302 endif | |
303 files = {}; | |
304 deps = true; | |
305 auto = 0; | |
306 action = "none"; | |
6614 | 307 verbose = false; |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
308 octave_forge = false; |
6496 | 309 for i = 1:length (varargin) |
310 switch (varargin{i}) | |
311 case "-nodeps" | |
10549 | 312 deps = false; |
6496 | 313 case "-noauto" |
10549 | 314 auto = -1; |
6496 | 315 case "-auto" |
10549 | 316 auto = 1; |
6614 | 317 case "-verbose" |
10549 | 318 verbose = true; |
13275
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
319 ## 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
|
320 page_output_immediately (true, "local"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
321 case "-forge" |
15184
0b29c16a2645
pkg: check cURL library when using -forge
Carnë Draug <carandraug+dev@gmail.com>
parents:
15058
diff
changeset
|
322 if (! octave_config_info ("CURL_LIBS")) |
15202
f3b5cadfd6d5
fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents:
15184
diff
changeset
|
323 error ("pkg: can't download from forge without the cURL library"); |
15184
0b29c16a2645
pkg: check cURL library when using -forge
Carnë Draug <carandraug+dev@gmail.com>
parents:
15058
diff
changeset
|
324 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
325 octave_forge = true; |
6645 | 326 case "-local" |
10549 | 327 global_install = false; |
328 if (! user_prefix) | |
329 prefix = tilde_expand (fullfile ("~", "octave")); | |
330 archprefix = prefix; | |
331 endif | |
6645 | 332 case "-global" |
10549 | 333 global_install = true; |
334 if (! user_prefix) | |
335 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
|
336 archprefix = fullfile (octave_config_info ("libdir"), |
10549 | 337 "octave", "packages"); |
338 endif | |
7497 | 339 case available_actions |
10549 | 340 if (strcmp (action, "none")) |
341 action = varargin{i}; | |
342 else | |
343 error ("more than one action specified"); | |
344 endif | |
6496 | 345 otherwise |
10549 | 346 files{end+1} = varargin{i}; |
5801 | 347 endswitch |
6496 | 348 endfor |
349 | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
350 if (octave_forge && ! any (strcmp (action, {"install", "list"}))) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
351 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
|
352 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
353 |
6496 | 354 ## Take action |
355 switch (action) | |
356 case "list" | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
357 if (octave_forge) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
358 if (nargout > 0) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
359 local_packages = list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
360 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
361 list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
362 endif |
6496 | 363 else |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
364 if (nargout == 0) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
365 installed_packages (local_list, global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
366 elseif (nargout == 1) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
367 local_packages = installed_packages (local_list, global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
368 elseif (nargout == 2) |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
369 [local_packages, global_packages] = installed_packages (local_list, |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
370 global_list); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
371 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
372 error ("too many output arguments requested"); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
373 endif |
6496 | 374 endif |
375 | |
376 case "install" | |
377 if (length (files) == 0) | |
10549 | 378 error ("you must specify at least one filename when calling 'pkg install'"); |
6496 | 379 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
380 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
381 local_files = {}; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
382 unwind_protect |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
383 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
384 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
|
385 [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
|
386 [files, succ] = cellfun ("urlwrite", urls, local_files, "uniformoutput", false); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
387 succ = [succ{:}]; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
388 if (! all (succ)) |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
389 i = find (! succ, 1); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
390 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
|
391 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
392 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
393 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
394 install (files, deps, auto, prefix, archprefix, verbose, local_list, |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
395 global_list, global_install); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
396 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
397 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
|
398 cellfun ("unlink", local_files); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
399 end_unwind_protect |
6496 | 400 |
401 case "uninstall" | |
402 if (length (files) == 0) | |
10549 | 403 error ("you must specify at least one package when calling 'pkg uninstall'"); |
6496 | 404 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
405 uninstall (files, deps, verbose, local_list, |
10549 | 406 global_list, global_install); |
6496 | 407 |
408 case "load" | |
409 if (length (files) == 0) | |
10549 | 410 error ("you must specify at least one package, 'all' or 'auto' when calling 'pkg load'"); |
6496 | 411 endif |
412 load_packages (files, deps, local_list, global_list); | |
413 | |
414 case "unload" | |
415 if (length (files) == 0) | |
10549 | 416 error ("you must specify at least one package or 'all' when calling 'pkg unload'"); |
6496 | 417 endif |
418 unload_packages (files, deps, local_list, global_list); | |
419 | |
420 case "prefix" | |
421 if (length (files) == 0 && nargout == 0) | |
10549 | 422 printf ("Installation prefix: %s\n", prefix); |
423 printf ("Architecture dependent prefix: %s\n", archprefix); | |
6925 | 424 elseif (length (files) == 0 && nargout >= 1) |
10549 | 425 local_packages = prefix; |
426 global_packages = archprefix; | |
6925 | 427 elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1})) |
16173
40a9a4e0d12a
pkg.m: Restore ability to use '~' in specifying prefix directories.
Rik <rik@octave.org>
parents:
15966
diff
changeset
|
428 prefix = tilde_expand (files{1}); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
429 if (! exist (prefix, "dir")) |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
430 [status, msg, msgid] = mkdir (prefix); |
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
431 if (status == 0) |
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
432 error("cannot create prefix %s: %s", prefix, msg); |
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
433 endif |
14857
7371e127c351
pkg.m: create prefix directory, if it does not exist
Rafael Laboissiere <rafael@laboissiere.net>
parents:
14472
diff
changeset
|
434 warning ("creating the directory %s\n", prefix); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
435 endif |
15058
3691a606283e
Fix typo in pkg.m reported in bug #36994.
Muhali <muhali@shaw.ca>
parents:
15000
diff
changeset
|
436 local_packages = prefix = canonicalize_file_name (prefix); |
10549 | 437 user_prefix = true; |
438 if (length (files) >= 2 && ischar (files{2})) | |
16173
40a9a4e0d12a
pkg.m: Restore ability to use '~' in specifying prefix directories.
Rik <rik@octave.org>
parents:
15966
diff
changeset
|
439 archprefix = tilde_expand (files{2}); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
440 if (! exist (archprefix, "dir")) |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
441 [status, msg, msgid] = mkdir (archprefix); |
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
442 if (status == 0) |
14860
e027f98403c3
fix typo in error message in pkg.m
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14858
diff
changeset
|
443 error("cannot create archprefix %s: %s", archprefix, msg); |
14858
a82fcd612c8f
pkg.m: Check if the prefix directory can be created; don't fail silently
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14857
diff
changeset
|
444 endif |
10549 | 445 warning ("creating the directory %s\n", archprefix); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
446 global_packages = archprefix = canonicalize_file_name (archprefix); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
447 endif |
10549 | 448 endif |
6496 | 449 else |
10549 | 450 error ("you must specify a prefix directory, or request an output argument"); |
6496 | 451 endif |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
452 |
6496 | 453 case "local_list" |
454 if (length (files) == 0 && nargout == 0) | |
10549 | 455 disp (local_list); |
6496 | 456 elseif (length (files) == 0 && nargout == 1) |
10549 | 457 local_packages = local_list; |
6496 | 458 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
459 local_list = files{1}; |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
460 if (! exist (local_list, "file")) |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
461 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
462 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
463 fclose (fopen (local_list, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
464 catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
465 error ("cannot create file %s", local_list); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
466 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
467 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
468 local_list = canonicalize_file_name (local_list); |
6496 | 469 else |
10549 | 470 error ("you must specify a local_list file, or request an output argument"); |
6496 | 471 endif |
472 | |
473 case "global_list" | |
474 if (length (files) == 0 && nargout == 0) | |
10549 | 475 disp(global_list); |
6496 | 476 elseif (length (files) == 0 && nargout == 1) |
10549 | 477 local_packages = global_list; |
6496 | 478 elseif (length (files) == 1 && nargout == 0 && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
479 global_list = files{1}; |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
480 if (! exist (global_list, "file")) |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
481 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
482 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
483 fclose (fopen (files{1}, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
484 catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
485 error ("cannot create file %s", global_list); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
486 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
487 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
488 global_list = canonicalize_file_name (global_list); |
6496 | 489 else |
10549 | 490 error ("you must specify a global_list file, or request an output argument"); |
6496 | 491 endif |
6645 | 492 |
493 case "rebuild" | |
494 if (global_install) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
495 global_packages = rebuild (prefix, archprefix, global_list, files, |
10549 | 496 auto, verbose); |
497 global_packages = save_order (global_packages); | |
498 save (global_list, "global_packages"); | |
499 if (nargout > 0) | |
500 local_packages = global_packages; | |
501 endif | |
6645 | 502 else |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
503 local_packages = rebuild (prefix, archprefix, local_list, files, auto, |
10549 | 504 verbose); |
505 local_packages = save_order (local_packages); | |
506 save (local_list, "local_packages"); | |
507 if (nargout == 0) | |
508 clear ("local_packages"); | |
509 endif | |
6645 | 510 endif |
511 | |
6675 | 512 case "build" |
513 if (length (files) < 2) | |
10549 | 514 error ("you must specify at least the build directory and one filename\nwhen calling 'pkg build'"); |
6675 | 515 endif |
516 build (files, deps, auto, verbose); | |
517 | |
7497 | 518 case "describe" |
519 if (length (files) == 0) | |
10549 | 520 error ("you must specify at least one package or 'all' when calling 'pkg describe'"); |
7497 | 521 endif |
8202
cf59d542f33e
replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents:
8174
diff
changeset
|
522 ## FIXME: the name of the output variables is inconsistent |
7497 | 523 ## with their content |
524 switch (nargout) | |
10549 | 525 case 0 |
526 describe (files, verbose, local_list, global_list); | |
527 case 1 | |
528 pkg_desc_list = describe (files, verbose, local_list, ... | |
529 global_list); | |
530 local_packages = pkg_desc_list; | |
531 case 2 | |
532 [pkg_desc_list, flag] = describe (files, verbose, local_list, ... | |
533 global_list); | |
534 local_packages = pkg_desc_list; | |
535 global_packages = flag; | |
536 otherwise | |
537 error ("you can request at most two outputs when calling 'pkg describe'"); | |
7498 | 538 endswitch |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
539 |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
540 case "update" |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
541 if (nargout == 0) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
542 installed_pkgs_lst = installed_packages (local_list, global_list); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
543 for i = 1:length (installed_pkgs_lst) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
544 installed_pkg_name = installed_pkgs_lst{i}.name; |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
545 installed_pkg_version = installed_pkgs_lst{i}.version; |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
546 forge_pkg_version = get_forge_pkg (installed_pkg_name); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
547 if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
548 feval (@pkg, "install", "-forge", installed_pkg_name); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
549 endif |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
550 endfor |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
551 else |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
552 error ("no output arguments available"); |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
553 endif |
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
554 |
6496 | 555 otherwise |
556 error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); | |
557 endswitch | |
558 endfunction | |
17346
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17289
diff
changeset
|
559 |