waf: reconfigure for any changes in loaded modules

Waf's autoconfig feature works only for wscripts loaded by the recurse()
function. This patch extends that functionality to all loaded modules, which
includes Waf tools.
This commit is contained in:
Gustavo Jose de Sousa 2016-06-21 10:07:44 -03:00 committed by Lucas De Marchi
parent 2566a13e1b
commit d3ed17f047
1 changed files with 19 additions and 0 deletions

19
wscript
View File

@ -82,6 +82,23 @@ revisions.
default=False,
help='Configure as debug variant.')
def _collect_autoconfig_files(cfg):
for m in sys.modules.values():
paths = []
if hasattr(m, '__file__'):
paths.append(m.__file__)
elif hasattr(m, '__path__'):
for p in m.__path__:
paths.append(p)
for p in paths:
if p in cfg.files or not os.path.isfile(p):
continue
with open(p, 'rb') as f:
cfg.hash = Utils.h_list((cfg.hash, f.read()))
cfg.files.append(p)
def configure(cfg):
cfg.env.BOARD = cfg.options.board
cfg.env.DEBUG = cfg.options.debug
@ -142,6 +159,8 @@ def configure(cfg):
cfg.write_config_header(os.path.join(cfg.variant, 'ap_config.h'))
_collect_autoconfig_files(cfg)
def collect_dirs_to_recurse(bld, globs, **kw):
dirs = []
globs = Utils.to_list(globs)