Let waf -v catch invalid string on hcode values in Python3

This commit is contained in:
Thomas Nagy 2015-11-03 22:35:33 +01:00
parent c755de45c7
commit d4334adfb9
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,7 @@ typos = {
meths_typos = ['__call__', 'program', 'shlib', 'stlib', 'objects']
import sys
from waflib import Logs, Build, Node, Task, TaskGen, ConfigSet, Errors, Utils
import waflib.Tools.ccroot
@ -84,6 +85,9 @@ def check_invalid_constraints(self):
# the build scripts have been read, so we can check for invalid after/before attributes on task classes
for cls in list(Task.classes.values()):
if sys.hexversion > 0x3000000 and issubclass(cls, Task.Task) and isinstance(cls.hcode, str):
raise Errors.WafError('Class %r has hcode value %r of type <str>, expecting <bytes> (use Utils.h_cmd() ?)' % (cls, cls.hcode))
for x in ('before', 'after'):
for y in Utils.to_list(getattr(cls, x, [])):
if not Task.classes.get(y, None):