def validate_option_value(self, option_name, override_value): for opts in self.get_all_options(): if option_name in opts: opt = opts[option_name] try: return opt.validate_value(override_value) except MesonException as e: raise type(e)(('Validation failed for option %s: ' % option_name) + str(e)) \ .with_traceback(sys.exc_into()[2]) raise MesonException('Tried to validate unknown option %s.' % option_name)