Re: Possible bug
Bram Moolenaar <[email protected]> Mon, 22 Dec 2003 09:50:53 +0100
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Tim Hemel wrote:
> I installed AAP on OpenBSD, and had to use the pre patch for Python 2.2.1.
> Now, I am trying the following recipe, but I get a strange error...
>
> Target = build
>
> Subdirs = base etc kernel minihttpd php
>
> :print $Subdirs
> @for d in expand2list(Subdirs):
> :print $d
>
> install:
> :print $Subdirs
> @for d in expand2list(Subdirs):
> :print $d
> :execute $d/main.aap install
>
>
> $ aap install
> base etc kernel minihttpd php
> base
> etc
> kernel
> minihttpd
> php
> base etc kernel minihttpd php
> Aap: Error in recipe "/usr/home/tim/soekris/main.aap" line 20: NameError: name 'Subdirs' is not defined
>
> Why is this variable not defined in that particular place, but is defined in
> all the others?
As Adriaan already pointed out: This is a scope problem. In Aap
statements $var is using the stack of scopes, thus it works as you would
expect. In Python commands this is not possible, thus you have to
explicitly specify that the scope stack has to be searched. You can
prepend "_no", which stands for "no scope" (as if no scope was specified
in an Aap command).
Thus:
@for d in expand2list(Subdirs):
Should be:
@for d in expand2list(_no.Subdirs):
--
From "know your smileys":
|-P Reaction to unusually ugly C code
/// 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: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click