Classes related to the build phase (build, clean, install, step, etc)
The inheritance tree is the following:
Location of the cache files
Suffix for the cache files
Positive value ‘->’ install, see waflib.Build.BuildContext.is_install
Negative value ‘<-‘ uninstall, see waflib.Build.BuildContext.is_install
Build class members to save between the runs (root, node_deps, raw_deps, task_sigs)
Files from the build directory to hash before starting the build (config.h written during the configuration)
Post mode: all task generators are posted before the build really starts
Post mode: post the task generators group after group
Post mode: post the task generators at once, then re-check them for each group
Bases: waflib.Context.Context
executes the build
Non-zero value when installing or uninstalling file
post the task generators at once, group-by-group, or both
Signatures of the tasks (persists between build executions)
Dict of node dependencies found by waflib.Task.Task.scan() (persists between build executions)
Dict of custom data returned by waflib.Task.Task.scan() (persists between build executions)
Manual dependencies set by waflib.Build.BuildContext.add_manual_dependency()
Current build group
List containing lists of task generators
Map group names to the group lists. See waflib.Build.BuildContext.add_group()
Getter for the variant_dir attribute
Create a task generator and add it to the current build group. The following forms are equivalent:
def build(bld):
tg = bld(a=1, b=2)
def build(bld):
tg = bld()
tg.a = 1
tg.b = 2
def build(bld):
tg = TaskGen.task_gen(a=1, b=2)
bld.add_to_group(tg, None)
Parameters: | group (string) – group name to add the task generator to |
---|
Actual implementation provided by waflib.Build.InstallContext.install_files()
Actual implementation provided by waflib.Build.InstallContext.install_as()
Actual implementation provided by waflib.Build.InstallContext.symlink_as()
The configuration command creates files of the form build/c4che/NAMEcache.py. This method creates a waflib.ConfigSet.ConfigSet instance for each NAME by reading those files. The config sets are then stored in the dict waflib.Build.BuildContext.allenvs.
Initialize the project directory and the build directory by creating the nodes waflib.Build.BuildContext.srcnode and waflib.Build.BuildContext.bldnode corresponding to top_dir and variant_dir respectively. The bldnode directory will be created if it does not exist.
Restore the data from previous builds and call waflib.Build.BuildContext.execute_build(). Overrides from waflib.Context.Context.execute()
Execute the build by:
Load the data from a previous run, sets the attributes listed in waflib.Build.SAVED_ATTRS
Store the data for next runs, sets the attributes listed in waflib.Build.SAVED_ATTRS. Uses a temporary file to avoid problems on ctrl+c.
Run the build by creating an instance of waflib.Runner.Parallel The cache file is not written if the build is up to date (no task executed).
Import waf tools, used to import those accessed during the configuration:
def configure(conf):
conf.load('glib2')
def build(bld):
pass # glib2 is imported implicitly
Parameters: |
|
---|
Getter for the env property
Adds a dependency from a node object to a value:
def build(bld):
bld.add_manual_dependency(
bld.path.find_resource('wscript'),
bld.root.find_resource('/etc/fstab'))
Parameters: |
|
---|
Returns the launch directory as a waflib.Node.Node object
Hash configuration set variables:
def build(bld):
bld.hash_env_vars(bld.env, ['CXX', 'CC'])
Parameters: |
|
---|
Retrieves a task generator from its name or its target name the name must be unique:
def build(bld):
tg = bld(name='foo')
tg == bld.get_tgen_by_name('foo')
Wrapper for waflib.TaskGen.declare_chain() provided for convenience
Execute user-defined methods before the build starts, see waflib.Build.BuildContext.add_pre_fun()
Executes the user-defined methods after the build is successful, see waflib.Build.BuildContext.add_post_fun()
Bind a method to execute after the scripts are read and before the build starts:
def mycallback(bld):
print("Hello, world!")
def build(bld):
bld.add_pre_fun(mycallback)
Bind a method to execute immediately after the build is successful:
def call_ldconfig(bld):
bld.exec_command('/sbin/ldconfig')
def build(bld):
if bld.cmd == 'install':
bld.add_pre_fun(call_ldconfig)
Get the group x, or return the current group if x is None
Parameters: | x (string, int or None) – name or number or None |
---|
Index of the group containing the task generator given as argument:
def build(bld):
tg = bld(name='nada')
0 == bld.get_group_idx(tg)
Parameters: | tg (waflib.TaskGen.task_gen) – Task generator object |
---|
Add a new group of tasks/task generators. By default the new group becomes the default group for new task generators.
Parameters: |
|
---|
Set the current group to be idx: now new task generators will be added to this group by default:
def build(bld):
bld(rule='touch ${TGT}', target='foo.txt')
bld.add_group() # now the current group is 1
bld(rule='touch ${TGT}', target='bar.txt')
bld.set_group(0) # now the current group is 0
bld(rule='touch ${TGT}', target='truc.txt') # build truc.txt before bar.txt
Parameters: | idx (string or int) – group name or group index |
---|
Approximate task count: this value may be inaccurate if task generators are posted lazily (see waflib.Build.BuildContext.post_mode). The value waflib.Runner.Parallel.total is updated during the task execution.
Return the task generator corresponding to the ‘targets’ list, used by waflib.Build.BuildContext.get_build_iterator():
$ waf --targets=myprogram,myshlib
Post the task generators from the group indexed by self.cur, used by waflib.Build.BuildContext.get_build_iterator()
Return all the tasks for the group of num idx, used by waflib.Build.BuildContext.get_build_iterator()
Creates a generator object that returns lists of tasks executable in parallel (yield)
Returns: | tasks which can be executed immediatly |
---|---|
Return type: | list of waflib.Task.TaskBase |
Bases: waflib.Task.Task
Same interface as in waflib.TaskGen.task_gen.post()
Installation tasks are always executed, so this method returns either waflib.Task.ASK_LATER or waflib.Task.RUN_ME.
Bases: waflib.Build.BuildContext
installs the targets on the system
Copy a file from src to tgt with given file permissions. The actual copy is not performed if the source and target file have the same size and the same timestamps. When the copy occurs, the file is first removed and then copied (prevent stale inodes).
This method is overridden in waflib.Build.UninstallContext.do_install() to remove the file.
Parameters: |
|
---|
Create a symlink from tgt to src.
This method is overridden in waflib.Build.UninstallContext.do_link() to remove the symlink.
Parameters: |
|
---|
This method is called by waflib.Build.InstallContext.install_files(), waflib.Build.InstallContext.install_as() and waflib.Build.InstallContext.symlink_as() immediately after the installation task is created. Its role is to force the immediate execution if necessary, that is when postpone=False was given.
Create a task to install files on the system:
def build(bld):
bld.install_files('${DATADIR}', self.path.find_resource('wscript'))
Parameters: |
|
---|
Create a task to install a file on the system with a different name:
def build(bld):
bld.install_as('${PREFIX}/bin', 'myapp', chmod=Utils.O755)
Parameters: |
|
---|
Create a task to install a symlink:
def build(bld):
bld.symlink_as('${PREFIX}/lib/libfoo.so', 'libfoo.so.1.2.3')
Parameters: |
|
---|
Bases: waflib.Build.InstallContext
removes the targets installed
Bases: waflib.Build.BuildContext
cleans the project
Bases: waflib.Build.BuildContext
lists the targets to execute
Bases: waflib.Build.BuildContext
executes tasks in a step-by-step fashion, for debugging
Compile the tasks matching the input/output files given (regular expression matching). Derived from waflib.Build.BuildContext.compile():
$ waf step --files=foo.c,bar.c,in:truc.c,out:bar.o
$ waf step --files=in:foo.cpp.1.o # link task only