octave-maintainers
[Top][All Lists]
Advanced

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

Re: PKG_ADD and package loading state when called


From: Andrew Janke
Subject: Re: PKG_ADD and package loading state when called
Date: Fri, 18 Jan 2019 21:00:52 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.4.0



On 1/18/19 4:18 PM, Mike Miller wrote:
On Fri, Jan 18, 2019 at 15:21:59 -0500, Andrew Janke wrote:
I notice that when the PKG_ADD file is called, the architecture-specific
directory of the package has been added to the Octave path, but the main
package directory has not. So PKG_ADD can't call any non-octfile functions
in the package. Is this expected?

Have you tried adding a PKG_ADD file to the "inst" directory?

That worked. Thanks!

https://github.com/apjanke/octave-addons-chrono/commit/a94887230d24a418690f14efdc095aa03e0f5266

I agree it's not very clearly documented, but PKG_ADD can exist in any
directory that gets added to the load path.

It's more of an implementation detail of both the 'pkg load' command and
the addpath function that the arch-specific directory is added to the
path first, followed by the arch-independent directory.

The ordering comes from the way that load_packages_and_dependencies
passes package dirs into the addpath function.

The documentation for PKG_ADD doesn't specify what the package loading state
will be when PKG_ADD and PKG_DEL are called.
https://octave.org/doc/v4.4.1/Creating-Packages.html#Creating-Packages.
Could that be added?

We could document that the arch-specific directory is added to the load
path first, followed by the arch-indep directory, and turn that detail
into an explicit documented design decision.


This sounds like a good idea, since the PKG_ADD side effects are dependent on it. If I find some time, I'll make a patch to add it to the docs.

Cheers,
Andrew



reply via email to

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