From cb0f935cdbb391afeeb918f9631960d2e2d956a7 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 5 Sep 2009 12:59:39 +0000 Subject: [PATCH] Merge feature.jam changes into Python [SVN r56046] --- v2/build/feature.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/v2/build/feature.py b/v2/build/feature.py index 43701c29d..33a054478 100644 --- a/v2/build/feature.py +++ b/v2/build/feature.py @@ -1,6 +1,6 @@ # Status: mostly ported. # TODO: carry over tests. -# Base revision: 40480 +# Base revision: 56043 # # Copyright 2001, 2002, 2003 Dave Abrahams # Copyright 2002, 2006 Rene Rivera @@ -128,7 +128,17 @@ def set_default (feature, value): feature = add_grist (feature) f = __all_features [feature] + attributes = f['attributes'] + bad_attribute = None + if "free" in attributes: + bad_attribute = "free" + elif "optional" in attributes: + bad_attribute = "optional" + + if bad_attribute: + raise InvalidValue ("%s property %s cannot have a default" % (bad_attribute, feature)) + if isinstance(value, list): value = value[0] @@ -370,7 +380,8 @@ def validate_value_string (feature, value_string): values = [value_string] if f['subfeatures']: - values = value_string.split('-') + if not value_string in f['subfeatures']: + values = value_string.split('-') # An empty value is allowed for optional features if not values[0] in f['values'] and \