Fix SConstruct check for config.is_enabled()

This commit is contained in:
Ignacio Etcheverry 2017-10-03 00:01:15 +02:00
parent e36fb95c50
commit d5caf71c3f
1 changed files with 6 additions and 7 deletions

View File

@ -192,13 +192,12 @@ for x in module_list:
module_enabled = True
tmppath = "./modules/" + x
sys.path.append(tmppath)
try:
import config
if (not config.is_enabled()):
module_enabled = False
except:
pass
import config
enabled_attr = getattr(config, "is_enabled", None)
if (callable(enabled_attr) and not config.is_enabled()):
module_enabled = False
sys.path.remove(tmppath)
sys.modules.pop('config')
opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), module_enabled))
opts.Update(env_base) # update environment