Exemplo n.º 1
0
def __handle_flag_value(manager, value, properties):
    result = []

    if get_grist(value):
        matches = property.select(value, properties)
        for p in matches:
            att = feature.attributes(get_grist(p))

            ungristed = replace_grist(p, '')

            if 'dependency' in att:
                # the value of a dependency feature is a target
                # and must be actualized
                # FIXME: verify that 'find' actually works, ick!
                result.append(manager.targets().find(ungristed).actualize())

            elif 'path' in att or 'free' in att:
                values = []

                # Treat features with && in the value
                # specially -- each &&-separated element is considered
                # separate value. This is needed to handle searched
                # libraries, which must be in specific order.
                if not __re_two_ampersands.search(ungristed):
                    values.append(ungristed)

                else:
                    values.extend(value.split('&&'))

                result.extend(values)
            else:
                result.append(ungristed)
    else:
        result.append(value)

    return result
Exemplo n.º 2
0
def __handle_flag_value (manager, value, properties):
    result = []
    
    if get_grist (value):
        matches = property.select (value, properties)
        for p in matches:
            att = feature.attributes (get_grist (p))
            
            ungristed = replace_grist (p, '')

            if 'dependency' in att:
                # the value of a dependency feature is a target
                # and must be actualized
                # FIXME: verify that 'find' actually works, ick!
                result.append (manager.targets ().find (ungristed).actualize ())

            elif 'path' in att or 'free' in att:
                values = []
                
                # Treat features with && in the value
                # specially -- each &&-separated element is considered
                # separate value. This is needed to handle searched
                # libraries, which must be in specific order.
                if not __re_two_ampersands.search (ungristed):
                    values.append (ungristed)

                else:
                    values.extend(value.split ('&&'))

                result.extend(values)
            else:
                result.append (ungristed)
    else:
        result.append (value)

    return result
Exemplo n.º 3
0
    def __init__(self, properties=[]):

        raw_properties = []
        for p in properties:
            raw_properties.append(p.to_raw())

        self.all_ = properties
        self.all_raw_ = raw_properties
        self.all_set_ = set(properties)

        self.incidental_ = []
        self.free_ = []
        self.base_ = []
        self.dependency_ = []
        self.non_dependency_ = []
        self.conditional_ = []
        self.non_conditional_ = []
        self.propagated_ = []
        self.link_incompatible = []

        # A cache of refined properties.
        self.refined_ = {}

        # A cache of property sets created by adding properties to this one.
        self.added_ = {}

        # Cache for the default properties.
        self.defaults_ = None

        # Cache for the expanded properties.
        self.expanded_ = None

        # Cache for the expanded composite properties
        self.composites_ = None

        # Cache for property set with expanded subfeatures
        self.subfeatures_ = None

        # Cache for the property set containing propagated properties.
        self.propagated_ps_ = None

        # A map of features to its values.
        self.feature_map_ = None

        # A tuple (target path, is relative to build directory)
        self.target_path_ = None

        self.as_path_ = None

        # A cache for already evaluated sets.
        self.evaluated_ = {}

        for p in raw_properties:
            if not get_grist(p):
                raise BaseException("Invalid property: '%s'" % p)

            att = feature.attributes(get_grist(p))

            if 'propagated' in att:
                self.propagated_.append(p)

            if 'link_incompatible' in att:
                self.link_incompatible.append(p)

        for p in properties:

            # A feature can be both incidental and free,
            # in which case we add it to incidental.
            if p.feature().incidental():
                self.incidental_.append(p)
            elif p.feature().free():
                self.free_.append(p)
            else:
                self.base_.append(p)

            if p.condition():
                self.conditional_.append(p)
            else:
                self.non_conditional_.append(p)

            if p.feature().dependency():
                self.dependency_.append(p)
            else:
                self.non_dependency_.append(p)
Exemplo n.º 4
0
    def __init__ (self, raw_properties = []):

        self.raw_ = raw_properties
        
        self.incidental_ = []
        self.free_ = []
        self.base_ = []
        self.dependency_ = []
        self.non_dependency_ = []
        self.conditional_ = []
        self.non_conditional_ = []
        self.propagated_ = []
        self.link_incompatible = []
        
        # A cache of refined properties.
        self.refined_ = {}
        
        # A cache of property sets created by adding properties to this one.
        self.added_ = {}

        # Cache for the default properties.
        self.defaults_ = None

        # Cache for the expanded properties.
        self.expanded_ = None

        # Cache for the expanded composite properties
        self.composites_ = None

        # Cache for the property set containing propagated properties.
        self.propagated_ps_ = None
        
        # A map of features to its values.
        self.feature_map_ = None
        
        # A tuple (target path, is relative to build directory)
        self.target_path_ = None
        
        self.as_path_ = None
        
        # A cache for already evaluated sets.
        self.evaluated_ = {}
        
        for p in raw_properties:
            if not get_grist (p):
                raise BaseException ("Invalid property: '%s'" % p)
            
            att = feature.attributes (get_grist (p))
            
            # A feature can be both incidental and free,
            # in which case we add it to incidental.
            if 'incidental' in att:
                self.incidental_.append (p)
            elif 'free' in att:
                self.free_.append (p)
            else:
                self.base_.append (p)
        
            if 'dependency' in att:
                self.dependency_.append (p)
            else:
                self.non_dependency_.append (p)
            
            if property.is_conditional (p):
                self.conditional_.append (p)
            else:
                self.non_conditional_.append (p)
                                    
            if 'propagated' in att:
                self.propagated_.append (p)

            if 'link_incompatible' in att:
                self.link_incompatible.append (p)