[Top][All Lists]

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

Re: On the use of PKG_ADD/PKG_DEL directives in the stk package

From: Carnë Draug
Subject: Re: On the use of PKG_ADD/PKG_DEL directives in the stk package
Date: Fri, 19 Jun 2015 16:41:26 +0100

On 19 June 2015 at 08:12, Julien Bect <address@hidden> wrote:
> Le 18/05/2015 19:06, Julien Bect a écrit :
>> Le 18/05/2015 18:12, Carnë Draug a écrit :
>>> 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ë
>> Thanks a lot, I will examine your solution.
> Hello Carnë,
> I am preparing a new (minor) release of stk. I have followed your advice
> concerning PKG_ADD/PKG_DEL directives (preferable to moving files during
> post_install).
> Can you tell me if my solution looks ok to you (see changeset [1] or release
> candidate [2) ?

The cset looks right to me and pkg install, load, and unload all work fine.
The only change I'd make is to move the PKG_ADD and PKG_DEL to the top,
after the documentation and before starting the function code.  This is
only because it's the standard place to put it.  Others are more likely to
see them there than if at the bottom.

The reason to prefer this over movefile is just to prevent accidentally
moving or removing user files.  One never knows what can happen, specially
in more exotic setups.

> Is it ok if I add your name to the AUTHORS file of stk for your help on this
> matter ?

Sure.  Thank you


reply via email to

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