|
FeatureSuggestions
Feature suggestions or new ideas
Where to send SuggestionsFor direct feature requests use the Issues tracker Suggestion for user variantsLet'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. |
Sign in to add a comment
Simplify Waf's API
Disclaimer: i have only limited experience so far with waf, but i want to attempt to port mesa gallium3d's new scons build system over to waf, in order to confirm it's viability. since documentation is scarce,i might have gotten it wrong, but then a reply here would be a good start to document this feature
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) => Falseas 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.
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.
words_with_underscores is PEP-8 and the preferred Python style.
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)
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.