addpath/rmpath and PKG_ADD/PKG_DEL

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

addpath/rmpath and PKG_ADD/PKG_DEL

Julien Bect
Dear all,

I recently discovered by accident that using addpath and rmpath triggers
the execution of respectively PKG_ADD and PKG_DEL, if they exist (see
attached test script). This is not documented in the help of the
functions. Is it an intended feature ?

If it is, I can file a documentation bug report and provide a
documentation patch.

If it isn't, I can file a bug report as well, but providing a patch will
probably be more difficult...

@++
Julien


test_addpath_rmpath.m (247 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: addpath/rmpath and PKG_ADD/PKG_DEL

c.-2


Il 25/feb/2014 09:28 "Julien Bect" <[hidden email]> ha scritto:
>
> Dear all,
>
> I recently discovered by accident that using addpath and rmpath triggers the execution of respectively PKG_ADD and PKG_DEL, if they exist (see attached test script). This is not documented in the help of the functions. Is it an intended feature ?
>
> If it is, I can file a documentation bug report and provide a documentation patch.
>

That's exactly the main mechanism by which PKG_ADD/PKG_DEL work and it seems to me that it is explained quite well in the manual:
http://www.gnu.org/software/octave/doc/interpreter/PKG_005fADD-and-PKG_005fDEL-Directives.html#PKG_005fADD-and-PKG_005fDEL-Directives
But, if you think that needs further clarification feel free to suggest a patch.
c.

Reply | Threaded
Open this post in threaded view
|

Re: addpath/rmpath and PKG_ADD/PKG_DEL

Julien Bect
On 25/02/2014 10:48, Carlo de Falco wrote:


Il 25/feb/2014 09:28 "Julien Bect" <[hidden email]> ha scritto:
>
> Dear all,
>
> I recently discovered by accident that using addpath and rmpath triggers the execution of respectively PKG_ADD and PKG_DEL, if they exist (see attached test script). This is not documented in the help of the functions. Is it an intended feature ?
>
> If it is, I can file a documentation bug report and provide a documentation patch.
>

That's exactly the main mechanism by which PKG_ADD/PKG_DEL work and it seems to me that it is explained quite well in the manual:
http://www.gnu.org/software/octave/doc/interpreter/PKG_005fADD-and-PKG_005fDEL-Directives.html#PKG_005fADD-and-PKG_005fDEL-Directives
But, if you think that needs further clarification feel free to suggest a patch.
c.


Yes, it is explained in the manual in the section that describes packages.

But

1) there is no mention, in the section of the manual you're referring to, of the fact that this behaviour is automatically achieved by the functions addpath/rmpath (it is not obvious that "pkg load ..." implies a call to rmpath, for instance),

2) this appears to be in fact a general behaviour of addpath/rmpath, even outside the world of packages,

3) and there is no mention of this behaviour of addpath/rmpath if you type "help addpath" or "help rmpath".

If you confirm that this is indeed the intended behaviour of addpath/rmpath, even outside packages, then I can prepare a patch for the documentation of these functions in libinterp/corefcn/load-path.cc.

@++
Julien

Reply | Threaded
Open this post in threaded view
|

Re: addpath/rmpath and PKG_ADD/PKG_DEL

c.-2

On 25 Feb 2014, at 11:17, Julien Bect <[hidden email]> wrote:

> Yes, it is explained in the manual in the section that describes packages.
>
> But
>
> 1) there is no mention, in the section of the manual you're referring to, of the fact that this behaviour is automatically achieved by the functions addpath/rmpath (it is not obvious that "pkg load ..." implies a call to rmpath, for instance),
>
> 2) this appears to be in fact a general behaviour of addpath/rmpath, even outside the world of packages,
>
> 3) and there is no mention of this behaviour of addpath/rmpath if you type "help addpath" or "help rmpath".
>
> If you confirm that this is indeed the intended behaviour of addpath/rmpath, even outside packages, then I can prepare a patch for the documentation of these functions in libinterp/corefcn/load-path.cc.


the PKG_ADD file is sourced whenever the directory that contains it is added to the path.
if you have mydir/PKG_ADD and you start Octave from within mydir, PKG_ADD will be sourced at startup.
this is not handled by "pkg"

> @++
> Julien

c.
Reply | Threaded
Open this post in threaded view
|

Re: addpath/rmpath and PKG_ADD/PKG_DEL

Julien Bect
On 25/02/2014 11:53, c. wrote:

> On 25 Feb 2014, at 11:17, Julien Bect<[hidden email]>  wrote:
>
>> >Yes, it is explained in the manual in the section that describes packages.
>> >
>> >But
>> >
>> >1) there is no mention, in the section of the manual you're referring to, of the fact that this behaviour is automatically achieved by the functions addpath/rmpath (it is not obvious that "pkg load ..." implies a call to rmpath, for instance),
>> >
>> >2) this appears to be in fact a general behaviour of addpath/rmpath, even outside the world of packages,
>> >
>> >3) and there is no mention of this behaviour of addpath/rmpath if you type "help addpath" or "help rmpath".
>> >
>> >If you confirm that this is indeed the intended behaviour of addpath/rmpath, even outside packages, then I can prepare a patch for the documentation of these functions in libinterp/corefcn/load-path.cc.
> the PKG_ADD file is sourced whenever the directory that contains it is added to the path.
> if you have mydir/PKG_ADD and you start Octave from within mydir, PKG_ADD will be sourced at startup.
> this is not handled by "pkg"

Yes, this was precisely the point of the test script attached to my
initial email.

Since you confirm that this is an intentional feature of addpath/rmpath,
I will prepare a patch for their doc.

@++
Reply | Threaded
Open this post in threaded view
|

Re: addpath/rmpath and PKG_ADD/PKG_DEL

Julien Bect
On 25/02/2014 11:55, Julien Bect wrote:

> On 25/02/2014 11:53, c. wrote:
>> On 25 Feb 2014, at 11:17, Julien Bect<[hidden email]> wrote:
>>
>>> >Yes, it is explained in the manual in the section that describes
>>> packages.
>>> >
>>> >But
>>> >
>>> >1) there is no mention, in the section of the manual you're
>>> referring to, of the fact that this behaviour is automatically
>>> achieved by the functions addpath/rmpath (it is not obvious that
>>> "pkg load ..." implies a call to rmpath, for instance),
>>> >
>>> >2) this appears to be in fact a general behaviour of
>>> addpath/rmpath, even outside the world of packages,
>>> >
>>> >3) and there is no mention of this behaviour of addpath/rmpath if
>>> you type "help addpath" or "help rmpath".
>>> >
>>> >If you confirm that this is indeed the intended behaviour of
>>> addpath/rmpath, even outside packages, then I can prepare a patch
>>> for the documentation of these functions in
>>> libinterp/corefcn/load-path.cc.
>> the PKG_ADD file is sourced whenever the directory that contains it
>> is added to the path.
>> if you have mydir/PKG_ADD and you start Octave from within mydir,
>> PKG_ADD will be sourced at startup.
>> this is not handled by "pkg"
>
> Yes, this was precisely the point of the test script attached to my
> initial email.
>
> Since you confirm that this is an intentional feature of
> addpath/rmpath, I will prepare a patch for their doc.
>
> @++

Here it is: https://savannah.gnu.org/bugs/index.php?41885