Scripting

Module called for configuring, compiling and installing targets

waflib.Scripting.waf_entry_point(current_directory, version, wafdir)[source]

This is the main entry point, all Waf execution starts here.

Parameters:
  • current_directory (string) – absolute path representing the current directory
  • version (string) – version number
  • wafdir (string) – absolute path representing the directory of the waf library
waflib.Scripting.set_main_module(file_path)[source]

Read the main wscript file into waflib.Context.Context.g_module and bind default functions such as init, dist, distclean if not defined. Called by waflib.Scripting.waf_entry_point() during the initialization.

Parameters:file_path (string) – absolute path representing the top-level wscript file
waflib.Scripting.parse_options()[source]

Parses the command-line options and initialize the logging system. Called by waflib.Scripting.waf_entry_point() during the initialization.

waflib.Scripting.run_command(cmd_name)[source]

Executes a single Waf command. Called by waflib.Scripting.run_commands().

Parameters:cmd_name (string) – command to execute, like build
waflib.Scripting.run_commands()[source]

Execute the Waf commands that were given on the command-line, and the other options Called by waflib.Scripting.waf_entry_point() during the initialization, and executed after waflib.Scripting.parse_options().

waflib.Scripting.distclean_dir(dirname)[source]

Distclean function called in the particular case when:

top == out
Parameters:dirname (string) – absolute path of the folder to clean
waflib.Scripting.distclean(ctx)[source]

removes build folders and data

class waflib.Scripting.Dist(**kw)[source]

Bases: waflib.Context.Context

creates an archive containing the project source code

cmd = 'dist'
fun = 'dist'
algo = 'tar.bz2'
ext_algo = {}
execute()[source]

See waflib.Context.Context.execute()

archive()[source]

Creates the source archive.

get_tar_path(node)[source]

Return the path to use for a node in the tar archive, the purpose of this is to let subclases resolve symbolic links or to change file names

Returns:absolute path
Return type:string
add_tar_file(x, tar)[source]

Adds a file to the tar archive. Symlinks are not verified.

Parameters:
  • x – file path
  • tar – tar file object
get_tar_prefix()[source]

Returns the base path for files added into the archive tar file

Return type:string
get_arch_name()[source]

Returns the archive file name. Set the attribute arch_name to change the default value:

def dist(ctx):
        ctx.arch_name = 'ctx.tar.bz2'
Return type:string
get_base_name()[source]

Returns the default name of the main directory in the archive, which is set to appname-version. Set the attribute base_name to change the default value:

def dist(ctx):
        ctx.base_name = 'files'
Return type:string
get_excl()[source]

Returns the patterns to exclude for finding the files in the top-level directory. Set the attribute excl to change the default value:

def dist(ctx):
        ctx.excl = 'build **/*.o **/*.class'
Return type:string
get_files()[source]

Files to package are searched automatically by waflib.Node.Node.ant_glob(). Set files to prevent this behaviour:

def dist(ctx):
        ctx.files = ctx.path.find_node('wscript')

Files are also searched from the directory ‘base_path’, to change it, set:

def dist(ctx):
        ctx.base_path = path
Return type:list of waflib.Node.Node
waflib.Scripting.dist(ctx)[source]

makes a tarball for redistributing the sources

class waflib.Scripting.DistCheck(**kw)[source]

Bases: waflib.Scripting.Dist

creates an archive with dist, then tries to build it

fun = 'distcheck'
cmd = 'distcheck'
execute()[source]

See waflib.Context.Context.execute()

check()[source]

Creates the archive, uncompresses it and tries to build the project

waflib.Scripting.distcheck(ctx)[source]

checks if the project compiles (tarball from ‘dist’)

waflib.Scripting.autoconfigure(execute_method)[source]

Decorator that enables context commands to run configure as needed.