2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00

Enable regexp objects in @extension besides strings for file extensions

This commit is contained in:
Thomas Nagy 2016-04-22 19:27:22 +02:00
parent b0954282e9
commit 44db1efc02
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 12 additions and 14 deletions

View File

@ -14,6 +14,7 @@ NEW IN WAF 1.9 preview 1
- 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
- Enable regexp objects in @extension besides strings for file extensions
* Performance highlights:
- Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs
@ -37,4 +38,7 @@ NEW IN WAF 1.9 preview 1
- Better consistency between check_cfg and check_cc variables
- Subclass waflib.Build.ConfiguredContext to enable configuration-dependent user commands
- Remove Task.dep_vars as it is never used (define Task.vars on instances if necessary)
- task_gen.mapping is not defined by default on instances anymore, but instances can
still define their own mappings to override the defaults, but in that case all mappings
must be present. This feature was not used in Waf 1.8.

View File

@ -66,12 +66,6 @@ class task_gen(object):
Precedence table for sorting the methods in self.meths
"""
self.mappings = {}
"""
List of mappings {extension -> function} for processing files by extension
This is very rarely used, so we do not use an ordered dict here
"""
self.features = []
"""
List of feature names for bringing new methods in
@ -243,14 +237,15 @@ class task_gen(object):
:rtype: function
"""
name = node.name
if self.mappings:
for k in self.mappings:
for k in self.mappings:
try:
if name.endswith(k):
return self.mappings[k]
for k in task_gen.mappings:
if name.endswith(k):
return task_gen.mappings[k]
raise Errors.WafError("File %r has no mapping in %r (have you forgotten to load a waf tool?)" % (node, task_gen.mappings.keys()))
except TypeError:
# regexps objects
if k.match(name):
return self.mappings[k]
raise Errors.WafError("File %r has no mapping in %r (have you forgotten to load a waf tool?)" % (node, self.mappings.keys()))
def create_task(self, name, src=None, tgt=None, **kw):
"""
@ -346,7 +341,6 @@ def declare_chain(name='', rule=None, reentrant=None, color='BLUE',
tsk = self.create_task(name, node)
cnt = 0
keys = set(self.mappings.keys()) | set(self.__class__.mappings.keys())
for x in ext:
k = node.change_ext(x, ext_in=_ext_in)
tsk.outputs.append(k)
@ -356,7 +350,7 @@ def declare_chain(name='', rule=None, reentrant=None, color='BLUE',
self.source.append(k)
else:
# reinject downstream files into the build
for y in keys: # ~ nfile * nextensions :-/
for y in self.mappings: # ~ nfile * nextensions :-/
if k.name.endswith(y):
self.source.append(k)
break