octave-maintainers
[Top][All Lists]
Advanced

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

Re: pkg / PKG_ADD / arch-dependent


From: Philip Nienhuis
Subject: Re: pkg / PKG_ADD / arch-dependent
Date: Sun, 09 Mar 2014 21:52:50 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1

Olaf Till wrote:
On Sat, Mar 08, 2014 at 04:44:29AM -0800, Philip Nienhuis wrote:
Julien Bect wrote
Hi everyone,

Is there any reason why the PKG_ADD/PKG_DEL scripts located at the root
of a package source (.tar.gz) should end up being moved to the
arch-dependent subdirectory after installation with "pkg install" ?

Because this is the behaviour that I currently observe while trying to
create my first octave package (Octave 3.8.1 / Ubutu 13.04).

The documentation here :

http://www.gnu.org/software/octave/doc/interpreter/Creating-Packages.html

doesn't say explicitely where PKG_ADD will be, just that it is "run when
the package is added to the users path".

If there is a arch-dependent subdir (some OF packages don't have one),
PKG_ADD will end up there. Otherwise PKG_ADD ends up in the scripts subdir
(AFAIK, I'm not sure).

Yep, sometimes this behavior is very undesired.
E.g. in the io package, PKG_ADD (in the arch-dependent subdir) was already
run when the package hadn't fully been loaded yet, so a number of commands
needed for proper operation of the io package couldn't be executed.
That's why in post_install.m I entered some stanzas that move PKG_ADD to the
scripts subdir.

If it solves your problem you can copy those lines to your package's
post_install.m.

A better solution would be some flag in e.g. the file DESCRIPTION in the
package .tar.gz telling pkg.m where PKG_ADD is to be moved to.

AFAIK the arch-debendent path is added (with addpath) after the
scripts path in 'pkg install', so since the rootdir/PKGADD directives
get into the arch-dependent directory, they won't be executed until
both the scripts directory and the arch-dependent directory are in
Octaves path.
This seems reasonable to me and shoudn't cause problems
in 'pkg install'.

It's not so much during 'pkg install', but rather during "regular" loading of a package (e.g., packages that are auto-loaded in the course of starting Octave) that problems may occur.

It could be that "regular" loading of a package shouldn't differ from what happens during 'pkg install'; but my experiences (and Nitzan's, who made the first workarounds for the io package) are that PKG_ADD (and PKG_DEL) in the arch-dependent subdir did hamper proper set-up of the io package. Thinking it was a mere timing issue I introduced delays in PKG_ADD ("sleep (0.5)") but that didn't help. (FYI, the io package doesn't invoke any compiled modules during loading, only .m-files.)

But I just checked: moving io's PKG_ADD to the arch-dependent subdir (in Octave-3.8.0) doesn't make a difference now, the io package is set up fine. Octave's search path neatly has the script subdirs below (= before) the corresponding arch-dependent subdirs as you say.

But.... moving io's PKG_DEL into the arch-dependent subdir too does work out adversely: that hampers proper unloading of the io package. It seems the script subdir, containing .m-files required by PKG_DEL during unloading, is removed from Octave's search path before PKG_DEL is run. I'd expect that subdirectories should be removed from the path in reverse order. Is that the case in pkg.m and friends?

Philip



reply via email to

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