Guilty Spark
Guilty Spark

Reputation: 89

Checking octave package version

I installed the dataframe package in Octave and would like to programmatically assert that the package version is at least 1.2.0. Does octave provide a way to check a package version programmatically?

Upvotes: 0

Views: 606

Answers (1)

Tasos Papastylianou
Tasos Papastylianou

Reputation: 22255

Version = ver('dataframe')
% Version =
%   scalar structure containing the fields:
%     Name = dataframe
%     Version = 1.2.0
%     Release = [](0x0)
%     Date = 2017-08-14

Obviously Version.Version is still a string, but you can process that further, e.g. with strsplit, to obtain the major-minor-patch numbers.

strsplit( Version.Version, '.' )
% ans =
% {
%   [1,1] = 1
%   [1,2] = 2
%   [1,3] = 0
% }

Alternatively you can also use

Out = pkg('list', 'dataframe')

which also contains a 'version' field, as well as some extra information.

Upvotes: 2

Related Questions