Mercurial > octave
annotate scripts/pkg/private/describe.m @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 ## 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:
27897
diff
changeset
|
2 ## |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27897
diff
changeset
|
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27897
diff
changeset
|
4 ## or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27897
diff
changeset
|
5 ## |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
6 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
7 ## This file is part of Octave. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
8 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
9 ## Octave is free software: you can redistribute it and/or modify it |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
10 ## 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
|
11 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## (at your option) any later version. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
13 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
14 ## Octave is distributed in the hope that it will be useful, but |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## GNU General Public License for more details. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
18 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
19 ## You should have received a copy of the GNU General Public License |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
20 ## 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
|
21 ## <https://www.gnu.org/licenses/>. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
22 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
23 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 ## @deftypefn {} {[@var{pkg_desc_list}, @var{flag}] =} describe (@var{pkgnames}, @var{verbose}, @var{local_list}, @var{global_list}) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
25 ## Undocumented internal function. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
26 ## @end deftypefn |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
27 |
22765
01aae08a0105
maint: Rename variables to match documentation in m-files.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
28 function [pkg_desc_list, flag] = describe (pkgnames, verbose, local_list, global_list) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
29 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
30 ## Get the list of installed packages. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
31 installed_pkgs_lst = installed_packages(local_list, global_list); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
32 num_packages = length (installed_pkgs_lst); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
33 |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21758
diff
changeset
|
34 if (isempty (pkgnames)) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
35 describe_all = true; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
36 flag(1:num_packages) = {"Not Loaded"}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
37 num_pkgnames = num_packages; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
38 else |
21954
6da01de4dd8a
pkg: drop special usage of 'all' in load, unload, and describe (bug #40674)
Carnë Draug <carandraug@octave.org>
parents:
21758
diff
changeset
|
39 describe_all = false; |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
40 num_pkgnames = length (pkgnames); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
41 flag(1:num_pkgnames) = {"Not installed"}; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
42 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
43 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
44 for i = 1:num_packages |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
45 curr_name = installed_pkgs_lst{i}.name; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
46 if (describe_all) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
47 name_pos = i; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
48 else |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14479
diff
changeset
|
49 name_pos = find (strcmp (curr_name, pkgnames)); |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
50 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
51 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
52 if (! isempty (name_pos)) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
53 if (installed_pkgs_lst{i}.loaded) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
54 flag{name_pos} = "Loaded"; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
55 else |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
56 flag{name_pos} = "Not loaded"; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
57 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
58 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
59 pkg_desc_list{name_pos}.name = installed_pkgs_lst{i}.name; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
60 pkg_desc_list{name_pos}.version = installed_pkgs_lst{i}.version; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
61 pkg_desc_list{name_pos}.description = installed_pkgs_lst{i}.description; |
27897
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
62 pkg_desc_list{name_pos}.depends = installed_pkgs_lst{i}.depends; |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
63 pkg_desc_list{name_pos}.provides = parse_pkg_idx (installed_pkgs_lst{i}.dir); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
64 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
65 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
66 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
67 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
68 non_inst = find (strcmp (flag, "Not installed")); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
69 if (! isempty (non_inst)) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
70 if (nargout < 2) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
71 non_inst_str = sprintf (" %s ", pkgnames{non_inst}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
72 error ("some packages are not installed: %s", non_inst_str); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
73 else |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
74 pkg_desc_list{non_inst} = struct ("name", {}, "description", |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
75 {}, "provides", {}); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
76 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
77 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
78 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
79 if (nargout == 0) |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
80 for i = 1:num_pkgnames |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
81 print_package_description (pkg_desc_list{i}.name, |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
82 pkg_desc_list{i}.version, |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
83 pkg_desc_list{i}.provides, |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
84 pkg_desc_list{i}.description, |
27897
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
85 pkg_desc_list{i}.depends, |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
86 flag{i}, verbose); |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
87 endfor |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
88 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
89 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
90 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
91 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
92 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
93 ## Read an INDEX file. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
94 function pkg_idx_struct = parse_pkg_idx (packdir) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
95 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
96 index_file = fullfile (packdir, "packinfo", "INDEX"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
97 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
98 if (! exist (index_file, "file")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
99 error ("could not find any INDEX file in directory %s, try 'pkg rebuild all' to generate missing INDEX files", packdir); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
100 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
101 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
102 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
103 [fid, msg] = fopen (index_file, "r"); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
104 if (fid == -1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
105 error ("the INDEX file %s could not be read: %s", |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
106 index_file, msg); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
107 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
108 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
109 cat_num = 1; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
110 pkg_idx_struct{1}.category = "Uncategorized"; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
111 pkg_idx_struct{1}.functions = {}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
112 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
113 line = fgetl (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
114 while (isempty (strfind (line, ">>")) && ! feof (fid)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
115 line = fgetl (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
116 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
117 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
118 while (! feof (fid) || line != -1) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
119 if (! any (! isspace (line)) || line(1) == "#" || any (line == "=")) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
120 ## Comments, blank lines or comments about unimplemented |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
121 ## functions: do nothing |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
122 ## FIXME: probably comments and pointers to external functions |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
123 ## could be treated better when printing to screen? |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
124 elseif (! isempty (strfind (line, ">>"))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
125 ## Skip package name and description as they are in DESCRIPTION |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
126 ## already. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
127 elseif (! isspace (line(1))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
128 ## Category. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
129 if (! isempty (pkg_idx_struct{cat_num}.functions)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
130 pkg_idx_struct{++cat_num}.functions = {}; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
131 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
132 pkg_idx_struct{cat_num}.category = deblank (line); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
133 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
134 ## Function names. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
135 while (any (! isspace (line))) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
136 [fun_name, line] = strtok (line); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
137 pkg_idx_struct{cat_num}.functions{end+1} = deblank (fun_name); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
138 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
139 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
140 line = fgetl (fid); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
141 endwhile |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
142 fclose (fid); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
143 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
144 endfunction |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
145 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
146 |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
147 function print_package_description (pkg_name, pkg_ver, pkg_idx_struct, |
27897
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
148 pkg_desc, pkg_deps, status, verbose) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
149 |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
150 printf ("---\nPackage name:\n\t%s\n", pkg_name); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
151 printf ("Version:\n\t%s\n", pkg_ver); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
152 printf ("Short description:\n\t%s\n", pkg_desc); |
27897
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
153 pkg_deps = cellfun (@(d) sprintf ("%s %s %s", struct2cell (d){:}), pkg_deps, |
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
154 "UniformOutput", false); |
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
155 pkg_deps = strjoin (pkg_deps, "\n\t"); |
c8a44a4e4fe7
Add dependency information to output of "pkg describe" (patch #9880).
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents:
26376
diff
changeset
|
156 printf ("Depends on:\n\t%s\n", pkg_deps); |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
157 printf ("Status:\n\t%s\n", status); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
158 if (verbose) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
159 printf ("---\nProvides:\n"); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
160 for i = 1:length (pkg_idx_struct) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
161 if (! isempty (pkg_idx_struct{i}.functions)) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
162 printf ("%s\n", pkg_idx_struct{i}.category); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
163 for j = 1:length (pkg_idx_struct{i}.functions) |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
164 printf ("\t%s\n", pkg_idx_struct{i}.functions{j}); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
165 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
166 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
167 endfor |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
168 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
169 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
20852
diff
changeset
|
170 endfunction |