On 18 May 2015 at 16:38, Julien Bect <address@hidden> wrote:
Le 18/05/2015 17:21, "Carnë Draug" a écrit :
About your copying of PKG_ADD files, a better solution may have it as
comment on the source of a function in inst/.
What do you mean ?
I saw your comment on post_install.m. Take a look at the modified package
that is attached. I removed the PKG_ADD files, and the lines on post_install
that handled them. The code that was previously on PKG_ADD and PKG_DEL is
now inline in stk_version.
When pkg installs a package, it checks the source for PKG_ADD and PKG_DEL
comments. It creates such scripts in the directory where those files are
installed. This way, those files will not be created on the directory
with the mex files. Note that you can also write if and unwind_protect
blocks in those inline PKG_ADD.
Octave itself uses this to register colormaps,
http://hg.savannah.gnu.org/hgweb/octave/file/f5d9e57d4380/scripts/image/autumn.m#l32
and optimization routines:
http://hg.savannah.gnu.org/hgweb/octave/file/f5d9e57d4380/scripts/optimization/fminbnd.m#l61
Octave Forge packages also use it for that, but also to autoload functions
in oct files:
http://hg.code.sf.net/p/octave/image/file/b348244c0153/src/conndef.cc#l190
Also, I dropped the usage of root and config variables. If the user was
using those variables, the current code would remove them at the end.
Carnë