2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-24 18:59:39 +01:00

Add EnvContext to simplify configuration-dependent command definition

This commit is contained in:
Thomas Nagy 2016-04-11 23:28:33 +02:00
parent e0080e9f58
commit e35d3628d2
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
4 changed files with 38 additions and 9 deletions

View File

@ -10,26 +10,30 @@ NEW IN WAF 1.9
- Merge ${FOO}${BAR} flags in commands executed without a shell (no space added)
- Interpret empty command-line defines as integer values #1704
- Waf tools are not cached on "waf configure" by default anymore; pass conf.load(.., cache=True)
- Enable a consistent progress bar output #1641
- New --profile command-line option
- Add ${VAR?X} constructs in script expressions to enable simple conditional outputs
- Enable 'waf dist' to package arbitrary symlinks in tarballs #1719
* Performance highlights:
- Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs
- Remove __hash__ and __eq__ from Context, Node and Task #1629
- Make lazy visual studio detection the default
- Remove the uses of run_once that creates unfree-able memory
- Enable a consistent progress bar output #1641
- Reduce the memory footprint of Task objects, up to 50% memory reduction on large builds
- Enabled pre-forked builds by default to achieve faster builds, up to 2x speedup on short-lived processes
- Remove the uses of run_once that can consume a lot of memory
- Enable pre-forked builds by default to achieve faster builds, up to 2x speedup on short-lived processes
* API changes:
- The minimum Python version required is Python 2.5
- Remove the duplicate split functions from Utils
- Remove the duplicate split() functions from Utils
- Remove the command called "update"
- Add Task.get_cwd()
- Remove Utils.nogc
- Modify Utils.run_once so that it accepts a list of *args
- Improve the task consumer in Runner.py
- Rewrote the main task consumer in Runner.py for performance purposes
- Use relative paths in apply_incpaths by default (and absolute ones when paths cross drives)
- Remove Configure.err_handler
- Remove TaskBase.attr() as it was never used
- Remove TaskBase.attr() which was never used
- Task.sig_vars, Task.sig_explit_deps and Task.sig_implicit_deps return None
- Better consistency between check_cfg and check_cc variables
- Subclass waflib.Build.ConfiguredContext to enable configuration-dependent user commands

2
TODO
View File

@ -1,8 +1,6 @@
Waf 1.9
-------
* Better consistency between check_cfg and check_cc variables
* Let more context commands depend on the configuration
* Rework qt5
* Regexps for extension-based processing
* Other issues listed on https://github.com/waf-project/waf/issues

View File

@ -0,0 +1,18 @@
#! /usr/bin/env python
# encoding: utf-8
"""
Call 'waf configure display'
"""
def configure(conf):
pass
from waflib.Build import EnvContext
class fu_class(EnvContext):
cmd = 'display'
def display(self):
print(self.env.PREFIX)

View File

@ -1348,3 +1348,12 @@ class StepContext(BuildContext):
return pattern.match(node.abspath())
return match
class EnvContext(BuildContext):
"""Subclass EnvContext to create commands that require configuration data in 'env'"""
fun = cmd = None
def execute(self):
self.restore()
if not self.all_envs:
self.load_envs()
self.recurse([self.run_dir])