Mercurial > octave
annotate scripts/pkg/pkg.m @ 28064:fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
* pkg.m: Add "test" command to test all functions in a package.
Thanks to Oliver Heimlich and Philip Nienhuis for their original revisions
of this patch.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sun, 16 Feb 2020 11:31:48 -0800 |
parents | 915b3630eed0 |
children | baf16e6f498b |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2005-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27794
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
7 ## |
6440 | 8 ## This file is part of Octave. |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
6440 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22529
diff
changeset
|
13 ## (at your option) any later version. |
6440 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22529
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22529
diff
changeset
|
18 ## GNU General Public License for more details. |
6440 | 19 ## |
5801 | 20 ## You should have received a copy of the GNU General Public License |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
5801 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
27 ## @deftypefn {} {} pkg @var{command} @var{pkg_name} |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
28 ## @deftypefnx {} {} pkg @var{command} @var{option} @var{pkg_name} |
22529
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
29 ## @deftypefnx {} {[@var{out1}, @dots{}] =} pkg (@var{command}, @dots{} ) |
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
30 ## Manage or query packages (groups of add-on functions) for Octave. |
19187 | 31 ## |
22529
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
32 ## Different actions are available depending on the value of @var{command} |
640c1b476860
pkg.m: more clearly document package querying options (bug #49156)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
22323
diff
changeset
|
33 ## and on return arguments. |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
34 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
35 ## Available commands: |
6032 | 36 ## |
37 ## @table @samp | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
38 ## |
6032 | 39 ## @item install |
6070 | 40 ## Install named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
41 ## |
6070 | 42 ## @example |
43 ## pkg install image-1.0.0.tar.gz | |
44 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
45 ## |
6070 | 46 ## @noindent |
24934
1db0b81efafe
maint: strip trailing whitespace from source files
Mike Miller <mtmiller@octave.org>
parents:
24877
diff
changeset
|
47 ## installs the package found in the file @file{image-1.0.0.tar.gz}. The |
27574
c89a6f3eab69
pkg.m: Use uppercase URL in documentation and error messages.
Rik <rik@octave.org>
parents:
27573
diff
changeset
|
48 ## file containing the package can be a URL, e.g., |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
49 ## |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
50 ## @example |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
51 ## pkg install 'http://somewebsite.org/image-1.0.0.tar.gz' |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
52 ## @end example |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
53 ## |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
54 ## @noindent |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27707
diff
changeset
|
55 ## installs the package found in the given URL@. This |
24934
1db0b81efafe
maint: strip trailing whitespace from source files
Mike Miller <mtmiller@octave.org>
parents:
24877
diff
changeset
|
56 ## requires an internet connection and the cURL library. |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
57 ## |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
58 ## @noindent |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
59 ## @emph{Security risk}: no verification of the package is performed |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
60 ## before the installation. It has the same security issues as manually |
27574
c89a6f3eab69
pkg.m: Use uppercase URL in documentation and error messages.
Rik <rik@octave.org>
parents:
27573
diff
changeset
|
61 ## downloading the package from the given URL and installing it. |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
62 ## |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
63 ## @noindent |
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
64 ## @emph{No support}: the GNU Octave community is not responsible for |
24934
1db0b81efafe
maint: strip trailing whitespace from source files
Mike Miller <mtmiller@octave.org>
parents:
24877
diff
changeset
|
65 ## packages installed from foreign sites. For support or for |
1db0b81efafe
maint: strip trailing whitespace from source files
Mike Miller <mtmiller@octave.org>
parents:
24877
diff
changeset
|
66 ## reporting bugs you need to contact the maintainers of the installed |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
67 ## package directly (see the @file{DESCRIPTION} file of the package) |
6070 | 68 ## |
6645 | 69 ## 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
|
70 ## in which a package is installed. These options can be one or more of |
6645 | 71 ## |
72 ## @table @code | |
73 ## @item -nodeps | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
74 ## 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
|
75 ## 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
|
76 ## which is not installed on the system. @strong{Use this option with care.} |
6645 | 77 ## |
78 ## @item -local | |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12931
diff
changeset
|
79 ## 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
|
80 ## even if the user has system privileges. |
6258 | 81 ## |
6645 | 82 ## @item -global |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
83 ## 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
|
84 ## 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
|
85 ## |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
86 ## @item -forge |
25836
07cb3e098c0a
Use "Octave Forge" spelling in all files.
Rik <rik@octave.org>
parents:
25539
diff
changeset
|
87 ## Install a package directly from the Octave Forge repository. This |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
88 ## requires an internet connection and the cURL library. |
6614 | 89 ## |
20708
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
90 ## @emph{Security risk}: no verification of the package is performed |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
91 ## before the installation. There are no signature for packages, or |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
92 ## checksums to confirm the correct file was downloaded. It has the |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
93 ## same security issues as manually downloading the package from the |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
94 ## Octave Forge repository and installing it. |
453fca9ae397
pkg: add warning about security implications when using -forge.
Carnë Draug <carandraug@octave.org>
parents:
20480
diff
changeset
|
95 ## |
6645 | 96 ## @item -verbose |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
97 ## 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
|
98 ## they are performed. |
6645 | 99 ## @end table |
100 ## | |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
101 ## @item update |
25836
07cb3e098c0a
Use "Octave Forge" spelling in all files.
Rik <rik@octave.org>
parents:
25539
diff
changeset
|
102 ## 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
|
103 ## 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
|
104 ## Usage: |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
105 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
106 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
107 ## pkg update |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
108 ## @end example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
109 ## |
24966
70490bb1f59d
pkg.m: remove update of single package and update docstring
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24965
diff
changeset
|
110 ## @noindent |
70490bb1f59d
pkg.m: remove update of single package and update docstring
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24965
diff
changeset
|
111 ## To update a single package use @code{pkg install -forge} |
70490bb1f59d
pkg.m: remove update of single package and update docstring
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24965
diff
changeset
|
112 ## |
6032 | 113 ## @item uninstall |
6070 | 114 ## Uninstall named packages. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
115 ## |
6070 | 116 ## @example |
117 ## pkg uninstall image | |
118 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
119 ## |
6070 | 120 ## @noindent |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
121 ## removes the @code{image} package from the system. If another installed |
6070 | 122 ## 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
|
123 ## 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
|
124 ## |
6032 | 125 ## @item load |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
126 ## 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
|
127 ## 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
|
128 ## |
6070 | 129 ## @example |
130 ## pkg load image | |
131 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
132 ## |
6070 | 133 ## @noindent |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
134 ## adds the @code{image} package to the path. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
135 ## |
28023
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
136 ## Note: When loading a package, @code{pkg} will automatically try to load |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
137 ## any unloaded dependencies as well, unless the @option{-nodeps} flag has |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
138 ## been specified. For example, |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
139 ## |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
140 ## @example |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
141 ## pkg load signal |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
142 ## @end example |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
143 ## |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
144 ## @noindent |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
145 ## adds the @code{signal} package and also tries to load its dependency: the |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
146 ## @code{control} package. Be aware that the functionality of package(s) |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
147 ## loaded will probably be impacted by use of the @option{-nodeps} flag. Even |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
148 ## if necessary dependencies are loaded later, the functionality of depender |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
149 ## packages can still be affected because the optimal loading order of may |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
150 ## not have been followed. |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
151 ## |
6203 | 152 ## @item unload |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
153 ## Remove named packages from the path. After unloading a package it is |
28023
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
154 ## no longer possible to use the functions provided by the package. Trying |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
155 ## to unload a package that other loaded packages still depend on will result |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
156 ## in an error; no packages will be unloaded in this case. A package can |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
157 ## be forcibly removed with the @option{-nodeps} flag, but be aware that the |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
158 ## functionality of depender packages will likely be affected. As when loading |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
159 ## packages, reloading dependencies after having unloaded them with the |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
160 ## @option{-nodeps} flag may not restore all functionality of the depender |
915b3630eed0
pkg.m: Don't unload dependency packages when their dependers are loaded (bug #57522).
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27923
diff
changeset
|
161 ## packages as the required loading order may be incorrect. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
162 ## |
6032 | 163 ## @item list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
164 ## 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
|
165 ## |
6070 | 166 ## @example |
19187 | 167 ## pkg list |
6070 | 168 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
169 ## |
6070 | 170 ## @noindent |
19187 | 171 ## will produce a short report with the package name, version, and installation |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
172 ## directory for each installed package. Supply a package name to limit |
19187 | 173 ## reporting to a particular package. For example: |
174 ## | |
175 ## @example | |
176 ## pkg list image | |
177 ## @end example | |
178 ## | |
179 ## If a single return argument is requested then @code{pkg} returns a cell | |
180 ## array where each element is a structure with information on a single | |
181 ## package. | |
182 ## | |
183 ## @example | |
184 ## installed_packages = pkg ("list") | |
185 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
186 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
187 ## 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
|
188 ## 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
|
189 ## 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
|
190 ## |
6070 | 191 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
192 ## [user_packages, system_packages] = pkg ("list") |
6070 | 193 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
194 ## |
25836
07cb3e098c0a
Use "Octave Forge" spelling in all files.
Rik <rik@octave.org>
parents:
25539
diff
changeset
|
195 ## The @qcode{"-forge"} option lists packages available at the Octave Forge |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
196 ## repository. This requires an internet connection and the cURL library. |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
197 ## For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
198 ## |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
199 ## @example |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
200 ## oct_forge_pkgs = pkg ("list", "-forge") |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
201 ## @end example |
12561
0ade5992e374
Add documentation for '-forge' option (bug #32464).
Rik <octave@nomad.inbox5.com>
parents:
12167
diff
changeset
|
202 ## |
7497 | 203 ## @item describe |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
204 ## Show a short description of installed packages. With the option |
21546
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
21518
diff
changeset
|
205 ## @qcode{"-verbose"} also list functions provided by the package. For |
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
21518
diff
changeset
|
206 ## example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
207 ## |
7497 | 208 ## @example |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
209 ## pkg describe -verbose |
7497 | 210 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
211 ## |
7497 | 212 ## @noindent |
213 ## will describe all installed packages and the functions they provide. | |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
214 ## Display can be limited to a set of packages: |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
215 ## |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
216 ## @example |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27707
diff
changeset
|
217 ## @group |
26577
ae1542fb58ba
documentation: Avoid some overfull lines in the PDF manual.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
218 ## ## describe control and signal packages |
ae1542fb58ba
documentation: Avoid some overfull lines in the PDF manual.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
219 ## pkg describe control signal |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27707
diff
changeset
|
220 ## @end group |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
221 ## @end example |
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
222 ## |
7497 | 223 ## If one output is requested a cell of structure containing the |
224 ## description and list of functions of each package is returned as | |
225 ## output rather than printed on screen: | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
226 ## |
7497 | 227 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
228 ## desc = pkg ("describe", "secs1d", "image") |
7497 | 229 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
230 ## |
7497 | 231 ## @noindent |
19187 | 232 ## If any of the requested packages is not installed, @code{pkg} returns an |
7497 | 233 ## error, unless a second output is requested: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
234 ## |
7497 | 235 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
236 ## [desc, flag] = pkg ("describe", "secs1d", "image") |
7497 | 237 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
238 ## |
7497 | 239 ## @noindent |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
240 ## @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:
17243
diff
changeset
|
241 ## @qcode{"Loaded"}, or |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17243
diff
changeset
|
242 ## @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
|
243 ## |
6034 | 244 ## @item prefix |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8942
diff
changeset
|
245 ## Set the installation prefix directory. For example, |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
246 ## |
6070 | 247 ## @example |
248 ## pkg prefix ~/my_octave_packages | |
249 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
250 ## |
6070 | 251 ## @noindent |
9307
c2923c27c877
Various documentation improvements
Rik <rdrider0-list@yahoo.com>
parents:
9258
diff
changeset
|
252 ## sets the installation prefix to @file{~/my_octave_packages}. |
6070 | 253 ## Packages will be installed in this directory. |
6034 | 254 ## |
6070 | 255 ## 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
|
256 ## output argument. For example: |
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
257 ## |
6070 | 258 ## @example |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
259 ## pfx = pkg ("prefix") |
6070 | 260 ## @end example |
6925 | 261 ## |
262 ## 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
|
263 ## independently specified with an addition argument. For example: |
6925 | 264 ## |
265 ## @example | |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9079
diff
changeset
|
266 ## pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs |
6925 | 267 ## @end example |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
268 ## |
6189 | 269 ## @item local_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
270 ## 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
|
271 ## 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
|
272 ## available only to the current user. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
273 ## |
6189 | 274 ## @example |
275 ## pkg local_list ~/.octave_packages | |
276 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
277 ## |
6189 | 278 ## 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
|
279 ## |
6189 | 280 ## @example |
281 ## pkg local_list | |
282 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
283 ## |
6189 | 284 ## @item global_list |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
285 ## 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
|
286 ## 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
|
287 ## available to all users. For example: |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
288 ## |
6189 | 289 ## @example |
290 ## pkg global_list /usr/share/octave/octave_packages | |
291 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
292 ## |
6189 | 293 ## 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
|
294 ## |
6189 | 295 ## @example |
296 ## pkg global_list | |
297 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
298 ## |
6675 | 299 ## @item build |
12779
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
300 ## Build a binary form of a package or packages. The binary file produced |
6675 | 301 ## 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
|
302 ## @code{pkg}. The form of the command to build a binary package is |
6675 | 303 ## |
304 ## @example | |
305 ## pkg build builddir image-1.0.0.tar.gz @dots{} | |
306 ## @end example | |
307 ## | |
308 ## @noindent | |
9079
4d610aba7347
Cleanup documentation for system.texi, package.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
309 ## where @code{builddir} is the name of a directory where the temporary |
6675 | 310 ## 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
|
311 ## 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
|
312 ## all other options are ignored. |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
313 ## |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
314 ## @item rebuild |
095fd5c8b7e1
doc: Update docstring for pkg()
Rik <octave@nomad.inbox5.com>
parents:
12778
diff
changeset
|
315 ## 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
|
316 ## 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
|
317 ## |
28064
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
318 ## @item test |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
319 ## Perform the built-in self tests contained in all functions provided by |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
320 ## the named packages. For example, |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
321 ## |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
322 ## @example |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
323 ## pkg test image |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
324 ## @end example |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
325 ## |
6032 | 326 ## @end table |
19192
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
19187
diff
changeset
|
327 ## @seealso{ver, news} |
11547 | 328 ## @end deftypefn |
5947 | 329 |
6496 | 330 function [local_packages, global_packages] = pkg (varargin) |
19187 | 331 |
8202
cf59d542f33e
replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents:
8174
diff
changeset
|
332 ## Installation prefix (FIXME: what should these be on windows?) |
6645 | 333 persistent user_prefix = false; |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
334 persistent prefix = false; |
6925 | 335 persistent archprefix = -1; |
7498 | 336 persistent local_list = tilde_expand (fullfile ("~", ".octave_packages")); |
6496 | 337 persistent global_list = fullfile (OCTAVE_HOME (), "share", "octave", |
10549 | 338 "octave_packages"); |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
339 |
14472
045a5b85495d
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14471
diff
changeset
|
340 ## 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
|
341 ## 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
|
342 global_install = ((ispc () && ! isunix ()) || (geteuid () == 0)); |
6683 | 343 |
16304
c8e1b0213e34
pkg.m: Fix str-to-num warnings (bug #37785)
Rik <rik@octave.org>
parents:
16173
diff
changeset
|
344 if (isbool (prefix)) |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
345 [prefix, archprefix] = default_prefix (global_install); |
6645 | 346 prefix = tilde_expand (prefix); |
6925 | 347 archprefix = tilde_expand (archprefix); |
6496 | 348 endif |
349 | |
19187 | 350 mlock (); |
351 | |
352 confirm_recursive_rmdir (false, "local"); | |
353 | |
24965
0974a3649c81
pkg.m: alphabetic order of available_actions
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24934
diff
changeset
|
354 # valid actions in alphabetical order |
0974a3649c81
pkg.m: alphabetic order of available_actions
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24934
diff
changeset
|
355 available_actions = {"build", "describe", "global_list", "install", ... |
0974a3649c81
pkg.m: alphabetic order of available_actions
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24934
diff
changeset
|
356 "list", "load", "local_list", "prefix", "rebuild", ... |
28064
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
357 "test", "uninstall", "unload", "update"}; |
19187 | 358 |
359 ## Parse input arguments | |
360 if (isempty (varargin) || ! iscellstr (varargin)) | |
6496 | 361 print_usage (); |
362 endif | |
363 files = {}; | |
364 deps = true; | |
365 action = "none"; | |
6614 | 366 verbose = false; |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
367 octave_forge = false; |
19187 | 368 for i = 1:numel (varargin) |
6496 | 369 switch (varargin{i}) |
370 case "-nodeps" | |
10549 | 371 deps = false; |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
372 ## TODO completely remove these warnings after some releases. |
6496 | 373 case "-noauto" |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
374 warning ("Octave:deprecated-option", |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
375 ["pkg: autoload is no longer supported. The -noauto "... |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
376 "option is no longer required."]); |
6496 | 377 case "-auto" |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
378 warning ("Octave:deprecated-option", |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
379 ["pkg: autoload is no longer supported. Add a "... |
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
380 "'pkg load ...' command to octaverc instead."]); |
6614 | 381 case "-verbose" |
10549 | 382 verbose = true; |
13275
635db52feab4
pkg.m: Display verbose output immediately rather than buffering it.
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
383 ## 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
|
384 page_output_immediately (true, "local"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
385 case "-forge" |
21434
1da428cbf401
deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents:
20852
diff
changeset
|
386 if (! __octave_config_info__ ("CURL_LIBS")) |
25841
0d4b88086f36
doc: use "Octave Forge" spelling in a few more instances
Mike Miller <mtmiller@octave.org>
parents:
25836
diff
changeset
|
387 error ("pkg: can't download from Octave Forge without the cURL library"); |
15184
0b29c16a2645
pkg: check cURL library when using -forge
Carnë Draug <carandraug+dev@gmail.com>
parents:
15058
diff
changeset
|
388 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
389 octave_forge = true; |
6645 | 390 case "-local" |
10549 | 391 global_install = false; |
392 if (! user_prefix) | |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
393 [prefix, archprefix] = default_prefix (global_install); |
10549 | 394 endif |
6645 | 395 case "-global" |
10549 | 396 global_install = true; |
397 if (! user_prefix) | |
18448
b26d6be1767a
Move definifion of default package paths to separate function.
Carlo de Falco <cdf@users.sourceforge.net>
parents:
17744
diff
changeset
|
398 [prefix, archprefix] = default_prefix (global_install); |
10549 | 399 endif |
7497 | 400 case available_actions |
19187 | 401 if (! strcmp (action, "none")) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
402 error ("pkg: more than one action specified"); |
10549 | 403 endif |
19187 | 404 action = varargin{i}; |
6496 | 405 otherwise |
10549 | 406 files{end+1} = varargin{i}; |
5801 | 407 endswitch |
6496 | 408 endfor |
409 | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
410 if (octave_forge && ! any (strcmp (action, {"install", "list"}))) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
411 error ("pkg: '-forge' can only be used with install or list"); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
412 endif |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
413 |
6496 | 414 ## Take action |
415 switch (action) | |
416 case "list" | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
417 if (octave_forge) |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
418 if (nargout) |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
419 local_packages = list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
420 else |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
421 list_forge_packages (); |
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
422 endif |
6496 | 423 else |
20480
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
424 if (nargout == 1) |
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
425 local_packages = installed_packages (local_list, global_list, files); |
ad7fe3cb6fd2
pkg: fix regression on output of pkg list (bug #45873)
Carnë Draug <carandraug@octave.org>
parents:
20475
diff
changeset
|
426 elseif (nargout > 1) |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
427 [local_packages, global_packages] = installed_packages (local_list, |
19187 | 428 global_list, |
429 files); | |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
430 else |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
431 installed_packages (local_list, global_list, files); |
10685
81a43049dee2
support pkg list -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10684
diff
changeset
|
432 endif |
6496 | 433 endif |
434 | |
435 case "install" | |
19187 | 436 if (isempty (files)) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
437 error ("pkg: install action requires at least one filename"); |
6496 | 438 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
439 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
440 local_files = {}; |
25140
ad6dce96cbca
pkg.m: fix undefined variable error in install (bug #53567)
Mike Miller <mtmiller@octave.org>
parents:
25131
diff
changeset
|
441 tmp_dir = tempname (); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
442 unwind_protect |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
443 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
444 if (octave_forge) |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
445 [urls, local_files] = cellfun ("get_forge_download", files, |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
446 "uniformoutput", false); |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
447 [files, succ] = cellfun ("urlwrite", urls, local_files, |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
448 "uniformoutput", false); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
449 succ = [succ{:}]; |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
450 if (! all (succ)) |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
451 i = find (! succ, 1); |
27574
c89a6f3eab69
pkg.m: Use uppercase URL in documentation and error messages.
Rik <rik@octave.org>
parents:
27573
diff
changeset
|
452 error ("pkg: could not download file %s from URL %s", |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
453 local_files{i}, urls{i}); |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
454 endif |
24871
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
455 else |
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
456 ## If files do not exist, maybe they are not local files. |
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
457 ## Try to download them. |
26589
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
458 not_local_files = cellfun (@(x) isempty (glob (x)), files); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
459 if (any (not_local_files)) |
25140
ad6dce96cbca
pkg.m: fix undefined variable error in install (bug #53567)
Mike Miller <mtmiller@octave.org>
parents:
25131
diff
changeset
|
460 [success, msg] = mkdir (tmp_dir); |
24871
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
461 if (success != 1) |
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
462 error ("pkg: failed to create temporary directory: %s", msg); |
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
463 endif |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
464 |
26589
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
465 for file = files(not_local_files) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
466 file = file{1}; |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
467 [~, fname, fext] = fileparts (file); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
468 tmp_file = fullfile (tmp_dir, [fname fext]); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
469 local_files{end+1} = tmp_file; |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
470 looks_like_url = regexp (file, '^\w+://'); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
471 if (looks_like_url) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
472 [~, success, msg] = urlwrite (file, local_files{end}); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
473 if (success != 1) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
474 error ("pkg: failed downloading '%s': %s", file, msg); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
475 endif |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
476 ## Verify that download is a tarball, |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
477 ## to protect against ISP DNS hijacking. |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
478 ## FIXME: Need a test which does not rely on external OS. |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
479 #{ |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
480 if (isunix ()) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
481 [ok, file_descr] = ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
482 system (sprintf ('file "%s" | cut -d ":" -f 2', ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
483 local_files{end})); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
484 if (! ok) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
485 if (strfind (file_descr, "HTML")) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
486 error (["pkg: Invalid package file downloaded from " ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
487 "%s\n" ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
488 "File is HTML, not a tar archive."], ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
489 file); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
490 endif |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
491 else |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
492 ## Ignore: maybe something went wrong with the "file" call. |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
493 endif |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
494 endif |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
495 #} |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
496 else |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
497 looks_like_pkg_name = regexp (file, '^[\w-]+$'); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
498 if (looks_like_pkg_name) |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
499 error (["pkg: file not found: %s.\n" ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
500 "This looks like an Octave Forge package name." ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
501 " Did you mean:\n" ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
502 " pkg install -forge %s"], ... |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
503 file, file); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
504 else |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
505 error ("pkg: file not found: %s", file); |
5bfbcbec6826
pkg.m: Clearer error messages when file doesn't exist or -forge switch is forgotten (bug #55515).
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
506 endif |
25030
62186547b752
pkg.m: remove yes-no question when installing from URI.
Carnë Draug <carandraug@octave.org>
parents:
24934
diff
changeset
|
507 endif |
26856
65c036b78040
pkg.m: Fix regression installing pkgs from URL (bug #55843).
Rik <rik@octave.org>
parents:
26595
diff
changeset
|
508 files{strcmp (files, file)} = local_files{end}; |
24872
a26f8c97df21
warning and yes_or_no for installing using url
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
24871
diff
changeset
|
509 |
24871
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
510 endfor |
ca43264971ea
pkg: allow URI for external files (https/ftp/etc links) as install targets
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
511 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
512 endif |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
513 install (files, deps, prefix, archprefix, verbose, local_list, |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
514 global_list, global_install); |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
515 |
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
516 unwind_protect_cleanup |
25306
a6419af90031
pkg: restore deletion of package archive downloaded from Octave Forge
Mike Miller <mtmiller@octave.org>
parents:
25140
diff
changeset
|
517 cellfun ("unlink", local_files); |
25131
0cd7076a97c8
pkg.m: Don't leave behind temporary directories if error occurs during install (bug #53567).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
518 if (exist (tmp_dir, "file")) |
0cd7076a97c8
pkg.m: Don't leave behind temporary directories if error occurs during install (bug #53567).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
519 rmdir (tmp_dir, "s"); |
0cd7076a97c8
pkg.m: Don't leave behind temporary directories if error occurs during install (bug #53567).
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
520 endif |
10684
76aba4305f1f
support pkg install -forge
Jaroslav Hajek <highegg@gmail.com>
parents:
10549
diff
changeset
|
521 end_unwind_protect |
6496 | 522 |
523 case "uninstall" | |
19187 | 524 if (isempty (files)) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
525 error ("pkg: uninstall action requires at least one package name"); |
6496 | 526 endif |
19187 | 527 uninstall (files, deps, verbose, local_list, global_list, global_install); |
6496 | 528 |
529 case "load" | |
19187 | 530 if (isempty (files)) |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
531 error ("pkg: load action requires at least one package name"); |
6496 | 532 endif |
533 load_packages (files, deps, local_list, global_list); | |
534 | |
535 case "unload" | |
19187 | 536 if (isempty (files)) |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21634
diff
changeset
|
537 error ("pkg: unload action requires at least one package name"); |
6496 | 538 endif |
539 unload_packages (files, deps, local_list, global_list); | |
540 | |
541 case "prefix" | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
542 if (isempty (files) && ! nargout) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
543 printf ("Installation prefix: %s\n", prefix); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
544 printf ("Architecture dependent prefix: %s\n", archprefix); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
545 elseif (isempty (files) && nargout) |
10549 | 546 local_packages = prefix; |
547 global_packages = archprefix; | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
548 elseif (numel (files) >= 1 && ischar (files{1})) |
16173
40a9a4e0d12a
pkg.m: Restore ability to use '~' in specifying prefix directories.
Rik <rik@octave.org>
parents:
15966
diff
changeset
|
549 prefix = tilde_expand (files{1}); |
26100
7a8f895c8f15
pkg.m: Don't create 'prefix' directory until needed (bug #53577).
Rik <rik@octave.org>
parents:
25842
diff
changeset
|
550 local_packages = prefix = make_absolute_filename (prefix); |
10549 | 551 user_prefix = true; |
19187 | 552 if (numel (files) >= 2 && ischar (files{2})) |
26100
7a8f895c8f15
pkg.m: Don't create 'prefix' directory until needed (bug #53577).
Rik <rik@octave.org>
parents:
25842
diff
changeset
|
553 archprefix = make_absolute_filename (tilde_expand (files{2})); |
10549 | 554 endif |
6496 | 555 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
556 error ("pkg: prefix action requires a directory input, or an output argument"); |
6496 | 557 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
558 |
6496 | 559 case "local_list" |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
560 if (isempty (files) && ! nargout) |
10549 | 561 disp (local_list); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
562 elseif (isempty (files) && nargout) |
10549 | 563 local_packages = local_list; |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
564 elseif (numel (files) == 1 && ! nargout && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
565 local_list = files{1}; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
566 if (! exist (local_list, "file")) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
567 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
568 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
569 fclose (fopen (local_list, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
570 catch |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
571 error ("pkg: cannot create file %s", local_list); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
572 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
573 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
574 local_list = canonicalize_file_name (local_list); |
6496 | 575 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
576 error ("pkg: specify a local_list file, or request an output argument"); |
6496 | 577 endif |
578 | |
579 case "global_list" | |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
580 if (isempty (files) && ! nargout) |
19187 | 581 disp (global_list); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
582 elseif (isempty (files) && nargout) |
10549 | 583 local_packages = global_list; |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
584 elseif (numel (files) == 1 && ! nargout && ischar (files{1})) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
585 global_list = files{1}; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
586 if (! exist (global_list, "file")) |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
587 try |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
588 ## Force file to be created |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
589 fclose (fopen (files{1}, "wt")); |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
590 catch |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
591 error ("pkg: cannot create file %s", global_list); |
15000
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
592 end_try_catch |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
593 endif |
4c8ddf57fcda
remove redundant private function absolute_pathname
Carlo de Falco <cdf@users.sourceforge.net>
parents:
14860
diff
changeset
|
594 global_list = canonicalize_file_name (global_list); |
6496 | 595 else |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
596 error ("pkg: specify a global_list file, or request an output argument"); |
6496 | 597 endif |
6645 | 598 |
599 case "rebuild" | |
600 if (global_install) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
601 global_packages = rebuild (prefix, archprefix, global_list, files, |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
602 verbose); |
10549 | 603 global_packages = save_order (global_packages); |
27573
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
604 if (ispc) |
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
605 ## On Windows ensure LFN paths are saved rather than 8.3 style paths |
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
606 global_packages = standardize_paths (global_packages); |
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
607 endif |
27707
377f069841c1
Make packages installation dirs in global octave_packages file relative
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
27574
diff
changeset
|
608 global_packages = make_rel_paths (global_packages); |
10549 | 609 save (global_list, "global_packages"); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
610 if (nargout) |
10549 | 611 local_packages = global_packages; |
612 endif | |
6645 | 613 else |
19187 | 614 local_packages = rebuild (prefix, archprefix, local_list, files, |
21624
cf227735d5fd
pkg: remove support for autoload (automatically loading package at start).
Carnë Draug <carandraug@octave.org>
parents:
21546
diff
changeset
|
615 verbose); |
10549 | 616 local_packages = save_order (local_packages); |
27573
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
617 if (ispc) |
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
618 local_packages = standardize_paths (local_packages); |
0cedd1e23c1f
Adapt path styles for pkg.m on Windows (bug #57083)
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
26856
diff
changeset
|
619 endif |
10549 | 620 save (local_list, "local_packages"); |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
621 if (! nargout) |
10549 | 622 clear ("local_packages"); |
623 endif | |
6645 | 624 endif |
625 | |
6675 | 626 case "build" |
19187 | 627 if (numel (files) < 2) |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
628 error ("pkg: build action requires build directory and at least one filename"); |
6675 | 629 endif |
21518
2ee20a290d61
pkg build: complete rewrite of the logic behind binary packages.
Carnë Draug <carandraug@octave.org>
parents:
21434
diff
changeset
|
630 build (files{1}, files(2:end), verbose); |
6675 | 631 |
7497 | 632 case "describe" |
19187 | 633 ## FIXME: name of the output variables is inconsistent with their content |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
634 if (nargout) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
635 [local_packages, global_packages] = describe (files, verbose, |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
636 local_list, global_list); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
637 else |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
638 describe (files, verbose, local_list, global_list); |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
639 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
640 |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
641 case "update" |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
642 installed_pkgs_lst = installed_packages (local_list, global_list); |
25031
f2f813a55eec
pkg: remove update of listed packages (actually do 70490bb1f59d)
Carnë Draug <carandraug@octave.org>
parents:
24966
diff
changeset
|
643 |
26207
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
644 ## Explicit list of packages to update, rather than all packages |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
645 if (numel (files) > 0) |
26207
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
646 update_lst = {}; |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
647 installed_names = cellfun (@(idx) idx.name, installed_pkgs_lst, |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
648 "UniformOutput", false); |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
649 for i = 1:numel (files) |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
650 idx = find (strcmp (files{i}, installed_names), 1); |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
651 if (isempty (idx)) |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
652 warning ("pkg: package %s is not installed - skipping update", |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
653 files{i}); |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
654 else |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
655 update_lst = [ update_lst, installed_pkgs_lst(idx) ]; |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
656 endif |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
657 endfor |
b964092ad9f8
pkg.m: Allow updating a list of supplied packages, instead of all (bug #48151).
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
26100
diff
changeset
|
658 installed_pkgs_lst = update_lst; |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
659 endif |
25031
f2f813a55eec
pkg: remove update of listed packages (actually do 70490bb1f59d)
Carnë Draug <carandraug@octave.org>
parents:
24966
diff
changeset
|
660 |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
661 for i = 1:numel (installed_pkgs_lst) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
662 installed_pkg_name = installed_pkgs_lst{i}.name; |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
663 installed_pkg_version = installed_pkgs_lst{i}.version; |
21998
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
664 try |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
665 forge_pkg_version = get_forge_pkg (installed_pkg_name); |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
666 catch |
25841
0d4b88086f36
doc: use "Octave Forge" spelling in a few more instances
Mike Miller <mtmiller@octave.org>
parents:
25836
diff
changeset
|
667 warning ("pkg: package %s not found on Octave Forge - skipping update\n", |
21998
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
668 installed_pkg_name); |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
669 forge_pkg_version = "0"; |
cf5db742f552
pkg: warn and continue updating on non-forge packages (bug #48294)
Mike Miller <mtmiller@octave.org>
parents:
21954
diff
changeset
|
670 end_try_catch |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
671 if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) |
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
672 feval (@pkg, "install", "-forge", installed_pkg_name); |
18556
4daf647c86c3
Implement pkg update pkgnametoupdate (Bug #41732)
John Donoghue <john.donoghue@ieee.org>
parents:
17744
diff
changeset
|
673 endif |
20475
7fa1970a655d
pkg.m: drop check of nargout value, the interpreter already does that.
Carnë Draug <carandraug@octave.org>
parents:
19833
diff
changeset
|
674 endfor |
12778
0ca5672d5f1a
Implement pkg update command
Lukas Reichlin <lukas.reichlin@gmail.com>
parents:
12710
diff
changeset
|
675 |
28064
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
676 case "test" |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
677 if (isempty (files)) |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
678 error ("pkg: test action requires at least one package name"); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
679 endif |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
680 ## Make sure the requested packages are loaded |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
681 orig_path = path (); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
682 load_packages (files, deps, local_list, global_list); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
683 ## Test packages one by one |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
684 installed_pkgs_lst = installed_packages (local_list, global_list, files); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
685 unwind_protect |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
686 for i = 1:numel (installed_pkgs_lst) |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
687 printf ("Testing functions in package '%s':\n", files{i}); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
688 installed_pkgs_dirs = {installed_pkgs_lst{i}.dir, ... |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
689 installed_pkgs_lst{i}.archprefix}; |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
690 ## For local installs installed_pkgs_dirs contains the same subdirs |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
691 installed_pkgs_dirs = unique (installed_pkgs_dirs); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
692 if (! isempty (installed_pkgs_dirs)) |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
693 ## FIXME invoke another test routine once that is available. |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
694 ## Until then __run_test_suite__.m will do the job fine enough |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
695 __run_test_suite__ ({installed_pkgs_dirs{:}}, {}); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
696 endif |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
697 endfor |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
698 unwind_protect_cleanup |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
699 ## Restore load path back to its original value before loading packages |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
700 path (orig_path); |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
701 end_unwind_protect |
fbed279b7074
pkg: add "test" command to test all functions in a package (bug #41215)
Mike Miller <mtmiller@octave.org>
parents:
28023
diff
changeset
|
702 |
6496 | 703 otherwise |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20708
diff
changeset
|
704 error ("pkg: invalid action. See 'help pkg' for available actions"); |
6496 | 705 endswitch |
19187 | 706 |
6496 | 707 endfunction |