Re: Includes/childs

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Lars Ivar Igesund wrote:

> To be in front of evolution, I've put my D code into a recipe
> called dmodule.aap. Sometime in the future, this can be
> included automagically when I specify a program with
> d sources. Just to test it out, I tried to have default.app
> including it;
> :include dmodule.aap
> 
> This didn't work very well with my project as it took the
> path to be relative to my project, and not default.aap (as
> I would expect after reading the docs.)

The default.aap recipe is read without changing the current directory.
Aap changes directory only when it has found the main recipe to be read.
Thus before that the current directory is where you started Aap from.
An ":include" in default.aap would require an absolute path.

There is a much easier way: Additions that you always want to use you
can store in your own Aap startup directory.  This is explained in the
first chapter of the user manual, under "Recipe Execution Details":

1. Read the startup recipes, these define default rules and variables.
   These recipes are used:
   - default.aap from the distribution
   - all recipes matching /usr/local/share/aap/startup/*.aap
   - all recipes matching ~/.aap/startup/*.aap

> Then I did
> :child dmodule.aap
> instead. From my projects dir, it still didn't work;
> 
> 'Recipe "dmodule.aap" does not exist'

Same problem, Aap can't find the recipe without an absolute path.

> To test a little further, I went to the aap/Exec dir and
> ran just aap. This lead to the following:
> 
> $ aap
> Aap: Internal Error
> Aap: Traceback (most recent call last):
>    File "c:\projects\code\myaap\Exec\Process.py", line 1105, in Process
>     exec script_string in recdict, recdict
>    File "<string>", line 18, in ?
>    File "c:\projects\code\myaap\Exec\Commands.py", line 1098, in aap_child
>     aap_child_and_exe(line_nr, recdict, arg, 1)
>    File "c:\projects\code\myaap\Exec\Commands.py", line 1174, in
> aap_child_and_exe
>     new_recdict = get_build_recdict(recdict, None, recipe_name = name)
>    File "c:\projects\code\myaap\Exec\Scope.py", line 401, in
> get_build_recdict
>     new_recdict["_default"] = recdict["_default"]
>  KeyError: '_default'
> 
> Aap: Aborted
> 
> AFAIK, default.aap only differ from the original on
> the :child statement, and Filetype.py on the addition
> of the d file type.
>
> I guess that I'm just not supposed to do this...

When the default.aap recipe is being read there is no toplevel recipe
yet.  Therefore the ":child" command doesn't work.  The error message
could be better though, I'll fix that.

-- 
ARTHUR:  You fight with the strength of many men, Sir knight.
         I am Arthur, King of the Britons.  [pause]
         I seek the finest and the bravest knights in the land to join me
         in my Court of Camelot.  [pause]
         You have proved yourself worthy; will you join me?  [pause]
         You make me sad.  So be it.  Come, Patsy.
BLACK KNIGHT:  None shall pass.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.