octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another package manager issue


From: David Bateman
Subject: Another package manager issue
Date: Mon, 28 Aug 2006 23:36:49 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060817)

Ok, I have another issue with the package manager. Firstly in trying to
treat both PKG_ADD and PKG_DEL I introduced a error. However the more
interesting issue is how addpath work in pkg.m. Both addpath and pkg are
marked as commands, but the addpath in pkg are called in sub-functions
of pkg, Therefore we aren't at the top-level when addpath is called. If
the PKG_ADD file in a package includes a "mark_as_command" line then
this can't be executed. I see two solutions. Mark all of the
sub-functions that call addpath in pkg.m as commands, or use evalin to
run the addpath command in the top-level (which is what the attached
patch does). Can this be applied

D.


2006-08-26  David Bateman  <address@hidden>

        * pkg/pkg.m (install, load_packages): Run the addpath command in
        the top-level to ensure that PKG_ADD files are read correctly.
        (create_pkgadddel): Resolve variable name-clash.
Index: scripts/pkg/pkg.m
===================================================================
RCS file: /cvs/octave/scripts/pkg/pkg.m,v
retrieving revision 1.8
diff -c -r1.8 pkg.m
*** scripts/pkg/pkg.m   26 Aug 2006 09:38:53 -0000      1.8
--- scripts/pkg/pkg.m   28 Aug 2006 21:28:57 -0000
***************
*** 327,333 ****
        for i = 1:length(descriptions)
          dirs{i} = descriptions{i}.dir;
        endfor
!       addpath(dirs{:});
      endif
  endfunction
  
--- 327,337 ----
        for i = 1:length(descriptions)
          dirs{i} = descriptions{i}.dir;
        endfor
! 
!       ## Evaluate in top-level as some commands that are needed in
!       ## PKG_ADD can only be executed at the toplevel
!       cmd = ["addpath('",dirs{1},"'",sprintf(",'%s'",dirs{2:end}),");"];
!       evalin ("base", cmd);
      endif
  endfunction
  
***************
*** 551,570 ****
  function create_pkgadddel (desc, packdir, nm)
    pkg = [desc.dir "/" nm];
    fid = fopen(pkg, "wt");
    if (fid >= 0)
      ## Search all dot-m files for PKG commands
      lst = dir ([packdir "inst/*.m"]);
      for i=1:length(lst)
!       nm = lst(i).name;
!       fwrite (fid, extract_pkg (nm, ['^[#%][#%]* *' nm ': *(.*)$']));
      endfor
  
      ## Search all C++ source files for PKG commands
      lst = dir ([packdir "src/*.cc"]);
      for i=1:length(lst)
!       nm = lst(i).name;
!       fwrite (fid, extract_pkg (nm, ['^//* *' nm ': *(.*)$']));
!       fwrite (fid, extract_pkg (nm, ['^/\** *' nm ': *(.*) *\*/$']));
      endfor
  
      ## Add developer included PKG commands
--- 555,575 ----
  function create_pkgadddel (desc, packdir, nm)
    pkg = [desc.dir "/" nm];
    fid = fopen(pkg, "wt");
+ 
    if (fid >= 0)
      ## Search all dot-m files for PKG commands
      lst = dir ([packdir "inst/*.m"]);
      for i=1:length(lst)
!       nam = [packdir "inst/" lst(i).name];
!       fwrite (fid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$']));
      endfor
  
      ## Search all C++ source files for PKG commands
      lst = dir ([packdir "src/*.cc"]);
      for i=1:length(lst)
!       nam = [packdir "src/" lst(i).name];
!       fwrite (fid, extract_pkg (nam, ['^//* *' nm ': *(.*)$']));
!       fwrite (fid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$']));
      endfor
  
      ## Add developer included PKG commands
***************
*** 1047,1053 ****
              endif
          endfor
      endif
!     addpath(dirs{:});
  
      ## Add local binaries, if any, to the EXEC_PATH
      for i = 1:length(dirs)
--- 1052,1062 ----
              endif
          endfor
      endif
! 
!     ## Evaluate in top-level as some commands that are needed in
!     ## PKG_ADD can only be executed at the toplevel
!     cmd = ["addpath('",dirs{1},"'",sprintf(",'%s'",dirs{2:end}),");"];
!     evalin ("base",cmd);
  
      ## Add local binaries, if any, to the EXEC_PATH
      for i = 1:length(dirs)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]