changeset 14470:aad7ad0e15c1

maint: Remove redundant private function from the package manager. * pkg/private/isautoload.m: remove file. * pkg/private/install.m: remove calls to isautoload.
author Carlo de Falco <kingcrimson@tiscali.it>
date Fri, 16 Mar 2012 18:54:34 +0100
parents 29aabe9b37a2
children d2c095e45196
files scripts/pkg/module.mk scripts/pkg/private/get_forge_pkg.m scripts/pkg/private/install.m scripts/pkg/private/isautoload.m
diffstat 4 files changed, 16 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/module.mk	Thu Mar 15 20:03:01 2012 -0700
+++ b/scripts/pkg/module.mk	Fri Mar 16 18:54:34 2012 +0100
@@ -23,7 +23,6 @@
   pkg/private/install.m \
   pkg/private/installed_packages.m \
   pkg/private/is_architecture_dependent.m \
-  pkg/private/isautoload.m \
   pkg/private/issuperuser.m \
   pkg/private/list_forge_packages.m \
   pkg/private/load_package_dirs.m \
--- a/scripts/pkg/private/get_forge_pkg.m	Thu Mar 15 20:03:01 2012 -0700
+++ b/scripts/pkg/private/get_forge_pkg.m	Fri Mar 16 18:54:34 2012 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2005-2012 S�ren Hauberg
 ## Copyright (C) 2010-2012 VZLU Prague, a.s.
 ##
 ## This file is part of Octave.
--- a/scripts/pkg/private/install.m	Thu Mar 15 20:03:01 2012 -0700
+++ b/scripts/pkg/private/install.m	Fri Mar 16 18:54:34 2012 +0100
@@ -259,12 +259,25 @@
 
   ## If the package requested that it is autoloaded, or the installer
   ## requested that it is, then mark the package as autoloaded.
+  str_true = {"true", "on", "yes", "1"};
   for i = length (descriptions):-1:1
-    if (autoload > 0 || (autoload == 0 && isautoload (descriptions(i))))
+
+    desc_autoload = false;
+    if (isfield (descriptions{i}, "autoload"))
+      a = descriptions{i}.autoload;
+      desc_autoload = ((isnumeric (a) && a > 0)
+                       || (ischar (a) 
+                           && any (strcmpi (a, str_true))));
+    endif
+
+    if (autoload > 0 || desc_autoload)
       fclose (fopen (fullfile (descriptions{i}.dir, "packinfo",
                                ".autoload"), "wt"));
       descriptions{i}.autoload = 1;
+    else
+      descriptions{i}.autoload = 0;
     endif
+
   endfor
 
   ## Add the packages to the package list.
@@ -309,7 +322,7 @@
   if (length (descriptions) > 0)
     idx = [];
     for i = 1:length (descriptions)
-      if (isautoload (descriptions(i)))
+      if (descriptions{i}.autoload > 0)
         nm = descriptions{i}.name;
         for j = 1:length (installed_pkgs_lst)
           if (strcmp (nm, installed_pkgs_lst{j}.name))
--- a/scripts/pkg/private/isautoload.m	Thu Mar 15 20:03:01 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-## Copyright (C) 2005-2012 S�ren Hauberg
-## Copyright (C) 2010 VZLU Prague, a.s.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{auto} =} isautoload (@var{desc})
-## Undocumented internal function.
-## @end deftypefn
-
-function auto = isautoload (desc)
-  auto = false;
-  if (isfield (desc{1}, "autoload"))
-    a = desc{1}.autoload;
-    if ((isnumeric (a) && a > 0)
-        || (ischar (a) && (strcmpi (a, "true")
-                         || strcmpi (a, "on")
-                         || strcmpi (a, "yes")
-                         || strcmpi (a, "1"))))
-      auto = true;
-    endif
-  endif
-endfunction
-