bugGNU Octave - Bugs: bug #49156, No easy way to check whether a...

 
 

bug #49156: No easy way to check whether a package is installed

Submitted by:  Francesco Potortì <pot>
Submitted on:  Thu 22 Sep 2016 11:03:11 AM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Invalid Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.0.3 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 22 Sep 2016 10:39:35 PM UTC, comment #6: 
Carnë Draug <carandraug>
Project Member
Thu 22 Sep 2016 08:04:08 PM UTC, comment #5: 

Francesco,

I added some notes on pkg.m's querying options here:
http://hg.savannah.gnu.org/hgweb/octave/rev/640c1b476860

Will be part of the 4.2.0 release.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 22 Sep 2016 05:55:34 PM UTC, comment #4: 

Fransesco,

it is documented:

>> help pkg
:
     'list'
          Show the list of currently installed packages.  For example,

               pkg list

          will produce a short report with the package name, version,
          and installation directory for each installed package.  Supply
          a package name to limit reporting to a particular package.
          For example:

               pkg list image

          If a single return argument is requested then 'pkg' returns a
          cell array where each element is a structure with information
          on a single package.

               installed_packages = pkg ("list")
          by the package.

Maybe the first lines of the help should mention that pkg can be used for querying installed packages and the relevant syntax should be listed.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 22 Sep 2016 12:03:02 PM UTC, comment #3: 

Thanks. nice.  I had not tried it because the obvious outcome in my opinion would have been throwing an error, and no docs exist on the result.

So please convert this into a documentation bug, saying that if the package does not exist then an empty cell array is returned, and that this is the recommended way to check for a package being installed.

Francesco Potortì <pot>
Thu 22 Sep 2016 11:19:20 AM UTC, comment #2: 

Define "easy" ....

Have you tried your own suggestion? as that works since ages:

pkgs = pkg ("list")   ## returns info on all installed packages

pkgfoo = pkg ("list", "foo")  ## returns info about pkg foo
If not installed you get an empty cell array.

As this is available functionality I close this with "invalid"

Philip Nienhuis <philipnienhuis>
Project Member
Thu 22 Sep 2016 11:11:00 AM UTC, comment #1: 

Something like

## Check whether a package is installed
function ret = pkginstalled(package)
  l = pkg('list');                              # list of installed packages
  ret = any(arrayfun((@(x)strcmp(x{}.name, package)), l));
endfunction

Francesco Potortì <pot>
Thu 22 Sep 2016 11:03:11 AM UTC, original submission:  

Ideally, it should be easy to check whether a package is installed, something like

> pkg("isinstalled", "packagename")

Francesco Potortì <pot>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pot (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-22 philipnienhuis Item GroupFeature Request => Documentation
    2016-09-22 philipnienhuis StatusNone => Invalid
        Open/ClosedOpen => Closed
        Operating SystemGNU/Linux => Any

    Back to the top


    Powered by Savane 3.5