annotate scripts/miscellaneous/news.m @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents 5d928d37f159
children 3e94663fc3e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13865
diff changeset
1 ## Copyright (C) 2007-2012 John W. Eaton
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
2 ##
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
4 ##
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6252
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6252
diff changeset
8 ## your option) any later version.
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
9 ##
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
14 ##
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6252
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6252
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
18
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
20 ## @deftypefn {Function File} {} news (@var{package})
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
21 ## Display the current NEWS file for Octave or installed package.
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
22 ##
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
23 ## If @var{package} is the name of an installed package, display the current
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
24 ## NEWS file for that package.
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
25 ## @end deftypefn
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
26
13865
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
27 function news (package = "octave")
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
28
13865
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
29 if (ischar (package) && strcmpi (package, "octave"))
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
30 octetcdir = octave_config_info ("octetcdir");
13865
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
31 newsfile = fullfile (octetcdir, "NEWS");
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
32
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
33 elseif (nargin == 1 && ischar (package))
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
34 installed = pkg ("list");
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
35 names = cellfun (@(x) x.name, installed, "UniformOutput", false);
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
36 ## we are nice and let the user use any case on the package name
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
37 pos = strcmpi (names, package);
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
38 if (!any (pos))
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
39 error ("Package '%s' is not installed.", package);
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
40 endif
13864
a03e96aa4977 NEWS file of packages now expected to be in the package root. Also support ONEWS file as per GNU the standards. Updated manual accordingly.
Carnë Draug <carandraug+dev@gmail.com>
parents: 13863
diff changeset
41 newsfile = fullfile (installed{pos}.dir, "packinfo", "NEWS");
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
42
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
43 else
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
44 print_usage;
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
45 endif
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
46
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
47 if (exist (newsfile, "file"))
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
48 f = fopen (newsfile, "r");
7769
247828ad21e2 Replace deprecated isstr() call
Thomas Weber <thomas.weber.mail@gmail.com>
parents: 7016
diff changeset
49 while (ischar (line = fgets (f)))
8688
d7306ecd077a news.m: use puts, not printf
John W. Eaton <jwe@octave.org>
parents: 7769
diff changeset
50 puts (line);
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
51 endwhile
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
52 else
13865
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
53 if (strcmpi (package, "octave"))
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
54 error ("news: unable to locate NEWS file");
5d928d37f159 news: fixing bug when package is not specified and core NEWS file can't be found
Carnë Draug <carandraug+dev@gmail.com>
parents: 13864
diff changeset
55 else
13863
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
56 error ("news: unable to locate NEWS file of %s package", package);
b81e0b3fedab news: support to read news of installed packages
Carnë Draug <carandraug+dev@gmail.com>
parents: 12844
diff changeset
57 endif
6252
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
58 endif
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
59
738c97e101eb [project @ 2007-01-24 19:58:46 by jwe]
jwe
parents:
diff changeset
60 endfunction
12844
e51ad94535b9 codesprint: Remove news.m from test statistics.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
61
e51ad94535b9 codesprint: Remove news.m from test statistics.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
62 ## Remove from test statistics. No real tests possible
e51ad94535b9 codesprint: Remove news.m from test statistics.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
63 %!assert (1)