My favorites | Sign in
Logo
waf
Project hosting will be READ-ONLY Wednesday, 7AM PST due to brief network maintenance
                
Search
for
Updated Jun 03, 2009 by tenoften
FeatureSuggestions  
Feature suggestions or new ideas

Where to send Suggestions

For direct feature requests use the Issues tracker

Suggestion for user variants

Let's show the concept with an example. A user often builds 2 versions of the same program. The 2 versions differ only in the options used during the build.

For the first version, the user has to run:

  ./waf configure target=x86 CC=/usr/bin/gcc
  ./waf build

And for the second:

  ./waf configure target=x86-64 CC=/usr/bin/gcc-64
  ./waf build

Doing that continuously, quickly becomes tiresome. If WAF could store the different set of options, it becomes very simple.

The user will run once (and only once) a call to waf to set the options for each version:

  ./waf configure --uvariant x86 target=x86 CC=/usr/bin/gcc
  ./waf configure --uvariant x86-64 target=x86-64 CC=/usr/bin/gcc-64

Next for each version, the user only has to run:

  ./waf --uvariant x86

or:

  ./waf --uvariant x86-64

Of course a project will include the common versions in the wscript using WAF variants. But a project cannot define all possible combinations of options as variants. Here user variants will help.


Comment by yesud...@gmail.com, Apr 16, 2008

Please simplify the DistTarball? API

Here is some proposed sample usage:

def dist():
    import hashlib
    from Scripting import DistTarball, DistGzipTarball, DistBzip2Tarball   
 
    # Snapshot adds the date to the cut release tarball.
    gz_tarball = DistGzipTarball(APPNAME, VERSION, snapshot=True)
    gz_md5_digest = gz_tarball.digest(hash=hashlib.md5())   # => '12e3fc...'
    gz_sha1_digest = gz_tarball.digest(hash=hashlib.sha1()) # => 'e96fa7...'
    
    bz2_tarball = DistBzip2Tarball(APPNAME, VERSION, snapshot=False)
    bz2_md5_digest = bz2_tarball.digest(hash=hashlib.md5())
    bz2_sha1_digest = bz2_tarball.digest(hash=hashlib.sha1())

    # Output checksums...
    print bz2_sha1_digest, bz2_tarball.name
    ...

    # OO.
    isinstance(tarball, file) # => True
    isinstance(tarball, DistTarball) => True
    isinstance(tarball, DistGzipTarball) => True
    isinstance(tarball, DistBzip2Tarball) => False

as against the current

def dist():
    import md5
    from Scripting import DistTarball
    (f, filename) = DistTarball(APPNAME, VERSION)
    f = file(filename,'rb')
    m = md5.md5()
    readBytes = 100000
    while (readBytes):
        readString = f.read(readBytes)
        m.update(readString)
        readBytes = len(readString)
    f.close()
    print filename, m.hexdigest()
    sys.exit(0)

The current pattern will unnecessarily get repeated in future projects using Waf, which means more people will make mistakes and these mistakes won't be in one place to be fixed. By providing a method such as "digest(crypto_service)" you are allowing people to choose whether they want to generate a release digest.

Comment by dlin.tw, Apr 28, 2008

I wish there have a wiki page for help Makefile user learning the waf. And also put a simple makefile.<platform> in demo/make directory. That let makefile user could quick understand how to do such thing in waf. I could provide a sample makefile for linux+gcc and solaris+gcc.

Comment by davvid, Mar 29, 2009

words_with_underscores is PEP-8 and the preferred Python style.

Comment by bohan.go...@retropaganda.info, Apr 28, 2009

following davvid's comment (which was in reply to maxim.mueller), waf mostly follows the python naming convention (expect for package names, which normally should be lowercase)

Comment by bohan.go...@retropaganda.info, Apr 28, 2009

wildcards in source Waf provide two utility methods in the Node class to find sources that match (or don't match) some patterns: Node.find_iter and Node.ant_glob. The TaskGen? class also has a find_sources_in_dirs method, but be aware that it doesn't recurse into subdirectories.


Sign in to add a comment
Hosted by Google Code