On Tue, 30 Jul 2019, Artur Tarassow wrote:
Am 30.07.19 um 09:36 schrieb Riccardo (Jack) Lucchetti:
> On Tue, 30 Jul 2019, Artur Tarassow wrote:
>
>> Hi all,
>>
>> Since gretl supports the idea of package dependencies now, I think it's
>> useful to add an accessor to a package's version for checking that the
>> required version is actually installed on the system.
>>
>> In python one has those magic methods of which one is PACKAGE.__version__.
>> Do we have such an accessor available in gretl? Given that it exists in
>> the spec-file it should be possible to grab it, or not?
>
> If you know where your package file is located, you could use our xmlget()
> function, as in
>
> <hansl>
> pkgdata = readfile("(a)dotdir/functions/latextab.gfn")
> eval xmlget(pkgdata, "/gretl-functions/gretl-function-package/version")
> </hansl>
I was thinking about the same, but this won't work if the package is located
somewhere else.
true
> That said, we could have a "version" qualifier to the
"pkg" command, and
> possibly store the output under some $-accessor ($result, maybe?).
You mean something like(?):
<hansl>
pkg version armax
eval $pkg_version
</hansl>
"$result" sounds much more general, returning the details of the author etc.
Maybe one could name it "$pkg_version" as "$version" is already used
for
accessing the installed gretl version.
or perhaps
<hansl>
pkg info armax
bundle b = $result
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------