Use getattr instead of eval in the wscript

This commit is contained in:
Christian Dywan 2009-05-30 23:56:31 +02:00
parent eff875e2e3
commit a6cb1d8450

10
wscript
View file

@ -38,23 +38,23 @@ srcdir = '.'
blddir = '_build_' blddir = '_build_'
def option_enabled (option): def option_enabled (option):
if eval ('Options.options.enable_' + option): if getattr (Options.options, 'enable_' + option):
return True return True
if eval ('Options.options.disable_' + option): if getattr (Options.options, 'disable_' + option):
return False return False
return True return True
def configure (conf): def configure (conf):
def option_checkfatal (option, desc): def option_checkfatal (option, desc):
if eval ('Options.options.enable_' + option): if hasattr (Options.options, 'enable_' + option):
Utils.pprint ('RED', desc + ' N/A') Utils.pprint ('RED', desc + ' N/A')
sys.exit (1) sys.exit (1)
def dirname_default (dirname, default): def dirname_default (dirname, default):
if eval ('Options.options.' + dirname) == '': if getattr (Options.options, dirname) == '':
dirvalue = default dirvalue = default
else: else:
dirvalue = eval ('Options.options.' + dirname) dirvalue = getattr (Options.options, dirname)
conf.define (dirname, dirvalue) conf.define (dirname, dirvalue)
return dirvalue return dirvalue