Re: bug? using :import from within :execute

Tim Hemel <[email protected]> Fri, 10 Sep 2004 11:40:30 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
On Fri, 2004-09-10 at 10:57, Tim Hemel wrote:
> Ok, if I run aap from the bla_sub2 directory, everything works fine, the file
> bla.html is generated. However, when I run it from the bla_top directory, I get
> the following error:
> 
> [tim@localhost bla_top]$ aap
> aaping ../bla_sub1/main.aap
> sub1
> Aap: No target on the command line and no $TARGET, build rules or "all" target in a recipe
> aaping ../bla_sub2/main.aap
> Aap: Internal Error
> Aap: Traceback (most recent call last):
>    File "/usr/local/lib/aap/Exec-1.068/Process.py", line 1163, in Process
>     exec script_string in recdict, recdict
>    File "<string>", line 10, in ?
>    File "/usr/local/lib/aap/Exec-1.068/Commands.py", line 1219, in aap_execute
>     aap_child_and_exe(line_nr, recdict, arg, 0)
>    File "/usr/local/lib/aap/Exec-1.068/Commands.py", line 1375, in aap_child_and_exe
>     dobuild(newwork)
>    File "/usr/local/lib/aap/Exec-1.068/DoBuild.py", line 1583, in dobuild
>     res = target_update(work, work.recdict, target, 1, level = 1)
>    File "/usr/local/lib/aap/Exec-1.068/DoBuild.py", line 941, in target_update
>     xscope = dep.get_scope_names(work))
>    File "/usr/local/lib/aap/Exec-1.068/Scope.py", line 412, in get_build_recdict
>     new_recdict[n] = recdict[n]
>  KeyError: 'm_taptu'
> 
> Aap: Aborted
> Aap: More info in the logfile: /home/tim/aapbug/bla_top/AAPDIR/log
> 
> 
> How best to fix this?
> 

The following hack seems to work, but not sure if it works for more than
one layer of :execute commands:

In bla_sub2/main.aap:

:import taptu
@m_taptu = _tree.get('m_taptu')

I got this idea by looking at the source code for Scope.py. Still, I
think that this behaviour should be hidden from the user, and that
modules should be available from the current scope.

> 
> Tim

Tim




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php