Dealing with build attributes of targets

Adriaan de Groot <adridg-FlD2LfDziEhmR6Xm/[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Consider :ltlib (my favorite target type). An AAP command of this form looks 
like:

:ltlib { attributes for ltlib, like installvar } target { attributes for the 
target, like installdir } : { attributes XXX } sources { attributes for each 
source individually }

What should attributes at the location XXX mean? The AAP code picks them out 
specially (they have name=':' and are found at colonidx) into build_attr, and 
later applies them to the target with

    add_buildrule(rpstack, work, recdict,
                type, cmd_attr, targetlist, build_attr,sourcelist)

I don't know exactly what buildrule() does, but this seems to be redundant .. 
is there anything that you would want to put at XXX that can't be done with 
the { attributes for the target } already? If there is, then @raise 
UserError, "Adriaan is a Doofus".

If not, I'd like to change the meaning of the attributes at XXX to mean 
(perhaps in addition) that they apply to all the sources, so that 

:ltlib { installvar = } conduit_time.la
        { var_LDFLAGS = -L/opt/tmp -R/opt/tmp } :
        { add_INCLUDE = -I$BDIR/timeconduit }
        timeconduit/time-factory.cc
        timeconduit/time-setup.cc
        timeconduit/time-conduit.cc
        timeconduit/time-setup_dialog.ui

does exactly what _I_ want.

Patch attached. Yes, I know that both this and the previous bdir() patch need 
documentation. I'd like to know if there is a Whelk's Chance in a Supernova 
of this going in, first, before I write the docs :)
attr.diff (text/x-diff, 1.1 KB)
Index: Commands.py
===================================================================
RCS file: /cvsroot/a-a-p/Exec/Commands.py,v
retrieving revision 1.110
diff -u -3 -p -r1.110 Commands.py
--- Commands.py	18 Oct 2003 15:10:41 -0000	1.110
+++ Commands.py	21 Oct 2003 17:07:13 -0000
@@ -328,7 +328,7 @@ def aap_program(line_nr, recdict, arg, t
     if len(targetlist) != 1:
         recipe_error(rpstack, _(":%s requires one target") % cmdname)
 
-    # get any build attributes {attr = value}.
+    # get any build attributes {attr = value} from after the ':'.
     build_attr = dictlist[colonidx]
 
     # Expand the sources into dictlists.
@@ -337,6 +337,11 @@ def aap_program(line_nr, recdict, arg, t
     if len(sourcelist) < 1:
         recipe_error(rpstack, _(":%s requires at least one source") % cmdname)
 
+    # Apply the build attributes to the sources.
+    for i in sourcelist:
+        node = work.get_node(i["name"], 1, i)
+        node.set_attributes(build_attr)
+	
     # ":produce abc" needs to declare "abc" as a filetype.
     if cmdname == "produce":
         ft_declare(type)
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.