bug? using :import from within :execute
Tim Hemel <[email protected]> Fri, 10 Sep 2004 10:57:34 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Dear fellow aap users,
I have the following aap setup, but it bombs, so I suspect that there is a
little bug here:
bla_top/main.aap:
SubProjects= ../bla_sub1/main.aap
../bla_sub2/main.aap
all: $SubProjects
@for p in var2list(_no.SubProjects):
:print aaping $p
:execute {pass} $p
------------------------------------------------------------------------------
bla_sub1/main.aap:
:print sub1
:pass
------------------------------------------------------------------------------
bla_sub2/main.aap:
:import taptu
s_bla.x = 2
s_bla.y = 56
@_no.TAPTU_VARS = s_bla
all: bla.html
bla.html: bla.html.tpl
:do compile $source
------------------------------------------------------------------------------
taptu is a little module that I have written for templating, it is probably
not perfect but it's my first module (it requires a python module too, but that
is probably not relevant for the problem):
#
# Taptu module
#
:python
sys.path.append(os.path.join(os.getenv('HOME'),'.aap',"modules"))
from Taptu import Taptu
def taptu_process(src, tgt, vars,
re_var = r'\[\[([^[]*)\]\]', re_beg = r'\[\!',
re_end = r'\!\]', re_cont = r'\[='):
t = Taptu(re_var=re_var, re_beg=re_beg, re_end=re_end,
re_cont=re_cont)
t.setVarDict(vars)
f = open(src)
s = t.process(f.read())
f.close()
g = open(tgt,"w")
g.write(s)
g.close()
:filetype
suffix tpl taptu
:action compile object,default taptu
@if not _no.get("target"):
target = `os.path.splitext(fname)`
@if not _no.TAPTU_VARS: _no.TAPTU_VARS = { }
@if _no.get("TAPTU_COMPILE_ACTION"):
:do $TAPTU_COMPILE_ACTION {target = $target} $source
@else:
@_no.taptu_process(_no.source, _no.target, _no.TAPTU_VARS)
:route {default} taptu object
compile
------------------------------------------------------------------------------
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?
Tim
--
Zen Microsystems: we're the om in .commmmmmmmm...
-------------------------------------------------------
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