Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
creating a waf tool
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mihai Rotaru  
View profile  
 More options Oct 2 2012, 8:03 am
From: Mihai Rotaru <mihai.rot...@gmx.com>
Date: Tue, 2 Oct 2012 05:03:38 -0700 (PDT)
Local: Tues, Oct 2 2012 8:03 am
Subject: creating a waf tool

I'm working on a waf tool for htmlcompressor<http://code.google.com/p/htmlcompressor/>
.

However, I'm having trouble understanding how the tool system works. The wiki
page on creating tools<http://code.google.com/p/waf/wiki/AddingNewToolsToWaf>
is too high-level for me, since it assumes knowledge of waf's inner
workings.

My intention is to make a basic tool which would allow usage like the
following:

sources = ['index.html']

def configure( ctx ):
    ctx.load( 'htmlcompressor' )

def build( bld ):
    bld.compress_html( sources )

I have attached what I have so far, but it's not working. I created the
task class,
but how do I use it in the build function ?

  htmlcompressor.py
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas Nagy  
View profile  
 More options Oct 2 2012, 12:13 pm
From: Thomas Nagy <tnagy1...@gmail.com>
Date: Tue, 2 Oct 2012 18:12:54 +0200
Local: Tues, Oct 2 2012 12:12 pm
Subject: Re: [waf-users 4639] creating a waf tool

You could call bld(source='foo.html') for example, but since your tool
does not specify output files, it would not work. Try something like
this instead:

@waflib.Configure.conf
def compress_html(ctx, lst)
  for x in lst:
    bld(rule='java -jar ${HTML_COMPRESSOR} ${SRC} -o ${TGT}',
source=x, target="html/%s" % x)

Thomas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mihai Rotaru  
View profile  
 More options Oct 3 2012, 3:04 am
From: Mihai Rotaru <mihai.rot...@gmx.com>
Date: Wed, 3 Oct 2012 00:04:56 -0700 (PDT)
Local: Wed, Oct 3 2012 3:04 am
Subject: Re: [waf-users 4639] creating a waf tool

Thanx for the reply Thomas, I fixed it by setting a target in the tool,
because I want
to keep wscript as clean as possible, moving all the tool logic to the waf
tools.

wscript looks like this:

sources = ['index.html','about.html']

def configure( ctx ):
    ctx.load( 'htmlcompressor' )

def build( bld ):
    for s in sources:
        bld( source=s )

  htmlcompressor.py
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »