yabs3
index
/home/jules/undo-work/home/jules/yabs/yabs3.py

Yabs3 is a particular high-level interface onto Yabs.
 
I use this for building projects consisting of C, C++ and Cmm files (Cmm
is an extended C++ that supports multimethods, using a source processor
called cmm). It could easily be extended to support other types of source
files.
 
Supported build flags include:
 
    debug, release, threads, boost (support use of the Boost
    library), gtk (support GTK-2 compile/link).
 
Supported compilers:
 
    gcc/g++ (compiling, linking, preprocessing)
    vc++ (compiling/linking only)

 
Modules
       
StringIO
glob
os
re
string
yabs
yabs2
yabserrors

 
Functions
       
add_composite(target_base, source, linkextra=None, transform_fn=<function _add_exe_transformfn>, prereq_extra=[], state=<yabs.State instance>)
add_custom_params(prefix, includes=(), defines=(), params=(), fn=None, root=None)
Adds extra parameters to be used when compiling files whose paths start
with <prefix>.
add_exe(target_base, source, linkextra=None, transform_fn=<function _add_exe_transformfn>, prereq_extra=[], state=<yabs.State instance>)
Specify an executable, from a base name and list of source files.
 
The actual executable name will be:
 
    <target_base_root>_yabs/<target_base><build-identification>.exe
 
<source> can be either a list of filenames, or a string containing a
space-separated list of filenames.
 
<transform_fn> should be a function that takes the same parameters
as the default add_exe_transformfn() - a source file, a build type
and a Yabs state. It should return the filename of what the source
file should be converted into - e.g. it should convert foo.c into
an object file. It is up to caller to ensure that the returned file
can be created from the source file, by registering other rules with
Yabs. It can return None if the source file should be ignored.
 
Embed default build parameters into <target_base>, e.g.:
 
    add_exe( 'foo,threads', [ 'foo.c', 'bar.cpp'])
 
- will always make a threads build.
add_gcc_dep(cmd, sourcefile, target, dependencies)
Takes a gcc command that already includes source/target filenames
<sourcefile> and <target>, and adds flags and post-command to create
a dependency file called <dependencies>.
add_gcc_pp(cmd, sourcefile, target)
Takes a raw gcc command, and adds the source/target filenames
plus various flags necessary to make the command preprocess
the source into the target.
add_infix_handler(infix, handler)
add_lib(target_base, source, linkextra=None, transform_fn=<function _add_exe_transformfn>, prereq_extra=[], state=<yabs.State instance>)
add_lib_o(target_base, source, linkextra=None, transform_fn=<function _add_exe_transformfn>, prereq_extra=[], state=<yabs.State instance>)
Library created using partial-linking.
add_so(target_base, source, linkextra=None, transform_fn=<function _add_exe_transformfn>, prereq_extra=[], state=<yabs.State instance>)
Specify a shared library, from a base name and list of source files.
 
The actual shared library name will be:
 
    <target_base_root>_yabs/<target_base><build>.so
 
See add_exe() for details.
add_toolcommand(tool, command, tooldict, suffixes=None, state=None)
Adds a particular command to yabs3.
 
<tool> is a yabs3-specific name for a tool. Currently
supported values are: gcc, g++, msvc (which means the microsoft vc++
compiler, usually called `cl.exe'). <command> is something that can
be passed to os.system(), e.g. something like:
 
    /my/custom/installation/directory/gcc-2.95.3/bin/gcc
 
Version information is obtained for gcc and g++ tools, but not
currently for vc++.
add_tools(leafnames)
#print '$PATH=', os.getenv( 'PATH'), os.getenv( 'PATH').split( ':')
convenience_compile(target, state)
Makes things like bar/foo[,<build>].o depend on bar/_yabs/foo[,<build>].o.
cygwin_to_win32(paths)
Converts cygwin path into form accepted by the vc++ compiler.
 
Should probably do this in python, but at the moment we invoke
cygwin's `cygpath' utility.
default_target(target, state=None, build=None, quiet=False)
Takes names such as src/foo.exe, src/bar.c.o and converts them
into src/_yabs/foo,gcc,debug.exe, src/_yabs/bar.c,gcc,debug.o
(insert_subdir=True) or src/foo,gcc,debug.exe, src/bar,gcc,debug.c.o
(insert_subdir=False).
 
This function is useful if you want to force an executable to use a
particular build of a particular source file. For example, to force
the use of a debug build of the file foo.c, do:
 
    yabs3.add_exe( 'myapp',
        'main,release.c '
        + yabs3.default_target( 'foo.c,gcc,debug.o'))
 
Elements inside <target> itself override those in <infix>.
 
Note that any default build passed as part of <target_base> in call to
add_exe/so() will be ignored by this function.
 
Returns <target> unchanged if target is not in form that implies a default
target.
 
If <target> is already inside _yabs/, returns <target> if quiet is True,
else raises an exception.
remove_tooldict_name(name, state=None)
removes <name>=... from target filenames. e.g.:
    yabs3.remove_tooldict_name( 'os')
    yabs3.remove_tooldict_name( 'osv')
- to ommit things like `os=Linux,osv=2.6.30-1-686' within filenames.
setup(state=None)

 
Data
        add_gccdep_versioncache = {}
g = 'g++'
uname_cpu = 'x86_64'