2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-12-25 02:35:04 +01:00

Use stash/revert/commit pattern for transactional configuration

Apply that pattern when relevant. That allows correct behavior if tools are
loaded inside a transaction.
This commit is contained in:
Gustavo Jose de Sousa 2016-03-21 18:59:13 -03:00 committed by Thomas Nagy
parent 85e403516c
commit d46f541099
5 changed files with 13 additions and 3 deletions

View File

@ -81,7 +81,9 @@ def configure(conf):
if conf.env['CC']: if conf.env['CC']:
conf.end_msg(conf.env.get_flat('CC')) conf.end_msg(conf.env.get_flat('CC'))
conf.env['COMPILER_CC'] = compiler conf.env['COMPILER_CC'] = compiler
conf.env.commit()
break break
conf.env.revert()
conf.end_msg(False) conf.end_msg(False)
else: else:
conf.fatal('could not configure a C compiler!') conf.fatal('could not configure a C compiler!')

View File

@ -82,7 +82,9 @@ def configure(conf):
if conf.env['CXX']: if conf.env['CXX']:
conf.end_msg(conf.env.get_flat('CXX')) conf.end_msg(conf.env.get_flat('CXX'))
conf.env['COMPILER_CXX'] = compiler conf.env['COMPILER_CXX'] = compiler
conf.env.commit()
break break
conf.env.revert()
conf.end_msg(False) conf.end_msg(False)
else: else:
conf.fatal('could not configure a C++ compiler!') conf.fatal('could not configure a C++ compiler!')

View File

@ -58,7 +58,9 @@ def configure(conf):
if conf.env.D: if conf.env.D:
conf.end_msg(conf.env.get_flat('D')) conf.end_msg(conf.env.get_flat('D'))
conf.env['COMPILER_D'] = compiler conf.env['COMPILER_D'] = compiler
conf.env.commit()
break break
conf.env.revert()
conf.end_msg(False) conf.end_msg(False)
else: else:
conf.fatal('could not configure a D compiler!') conf.fatal('could not configure a D compiler!')

View File

@ -44,7 +44,9 @@ def configure(conf):
if conf.env['FC']: if conf.env['FC']:
conf.end_msg(conf.env.get_flat('FC')) conf.end_msg(conf.env.get_flat('FC'))
conf.env.COMPILER_FORTRAN = compiler conf.env.COMPILER_FORTRAN = compiler
conf.env.commit()
break break
conf.env.revert()
conf.end_msg(False) conf.end_msg(False)
else: else:
conf.fatal('could not configure a Fortran compiler!') conf.fatal('could not configure a Fortran compiler!')

View File

@ -410,12 +410,14 @@ def check_boost(self, *k, **kw):
self.env["CXXFLAGS_%s" % var] += cxxflags self.env["CXXFLAGS_%s" % var] += cxxflags
try: try:
try_link() try_link()
self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
exc = None
break
except Errors.ConfigurationError as e: except Errors.ConfigurationError as e:
self.env.revert() self.env.revert()
exc = e exc = e
else:
self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
exc = None
self.env.commit()
break
if exc is not None: if exc is not None:
self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=exc) self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=exc)