コード例 #1
0
def normalize_condition(property_sets):
    """ Expands subfeatures in each property set.
        e.g
            <toolset>gcc-3.2
        will be converted to
        <toolset>gcc/<toolset-version>3.2

        TODO: does this one belong here or in feature?
    """
    result = []
    for p in property_sets:
        split = feature.split(p)
        expanded = feature.expand_subfeatures(split)
        result.append('/'.join(expanded))

    return result
コード例 #2
0
ファイル: toolset.py プロジェクト: elemel/boost-python
def normalize_condition (property_sets):
    """ Expands subfeatures in each property set.
        e.g
            <toolset>gcc-3.2
        will be converted to
        <toolset>gcc/<toolset-version>3.2

        TODO: does this one belong here or in feature?
    """
    result = []
    for p in property_sets:
        split = feature.split (p)
        expanded = feature.expand_subfeatures (split)
        result.append ('/'.join (expanded))

    return result
コード例 #3
0
 def expand_subfeatures(self):
     if not self.subfeatures_:
         self.subfeatures_ = create(feature.expand_subfeatures(self.all_))
     return self.subfeatures_
コード例 #4
0
ファイル: toolset.py プロジェクト: Bandeira/sps
def flags(rule_or_module, variable_name, condition, values=[]):
    """ Specifies the flags (variables) that must be set on targets under certain
        conditions, described by arguments.
        rule_or_module:   If contains dot, should be a rule name.
                          The flags will be applied when that rule is
                          used to set up build actions.
                          
                          If does not contain dot, should be a module name.
                          The flags will be applied for all rules in that
                          module.
                          If module for rule is different from the calling
                          module, an error is issued.

         variable_name:   Variable that should be set on target
         
         condition        A condition when this flag should be applied.
                          Should be set of property sets. If one of
                          those property sets is contained in build
                          properties, the flag will be used.
                          Implied values are not allowed:
                          "<toolset>gcc" should be used, not just
                          "gcc". Subfeatures, like in "<toolset>gcc-3.2"
                          are allowed. If left empty, the flag will
                          always used.
                          
                          Propery sets may use value-less properties 
                          ('<a>'  vs. '<a>value') to match absent 
                          properties. This allows to separately match
                          
                             <architecture>/<address-model>64
                             <architecture>ia64/<address-model>
                          
                          Where both features are optional. Without this
                          syntax we'd be forced to define "default" value.

         values:          The value to add to variable. If <feature>
                          is specified, then the value of 'feature' 
                          will be added.
    """
    caller = bjam.caller()
    if not "." in rule_or_module and caller and caller[:-1].startswith("Jamfile"):
        # Unqualified rule name, used inside Jamfile. Most likely used with
        # 'make' or 'notfile' rules. This prevents setting flags on the entire
        # Jamfile module (this will be considered as rule), but who cares?
        # Probably, 'flags' rule should be split into 'flags' and
        # 'flags-on-module'.
        rule_or_module = qualify_jam_action(rule_or_module, caller)
    else:
        # FIXME: revive checking that we don't set flags for a different
        # module unintentionally
        pass

    if condition and not replace_grist(condition, ""):
        # We have condition in the form '<feature>', that is, without
        # value. That's a previous syntax:
        #
        #   flags gcc.link RPATH <dll-path> ;
        # for compatibility, convert it to
        #   flags gcc.link RPATH : <dll-path> ;
        values = [condition]
        condition = None

    if condition:
        transformed = []
        for c in condition:
            # FIXME: 'split' might be a too raw tool here.
            pl = [property.create_from_string(s, False, True) for s in c.split("/")]
            pl = feature.expand_subfeatures(pl)
            transformed.append(property_set.create(pl))
        condition = transformed

        property.validate_property_sets(condition)

    __add_flag(rule_or_module, variable_name, condition, values)
コード例 #5
0
ファイル: property_set.py プロジェクト: Lecton/COS-700
 def expand_subfeatures(self):
     if not self.subfeatures_:
         self.subfeatures_ = create(feature.expand_subfeatures(self.all_))
     return self.subfeatures_
コード例 #6
0
ファイル: toolset.py プロジェクト: AishwaryaDoosa/Boost1.49
def flags(rule_or_module, variable_name, condition, values=[]):
    """ Specifies the flags (variables) that must be set on targets under certain
        conditions, described by arguments.
        rule_or_module:   If contains dot, should be a rule name.
                          The flags will be applied when that rule is
                          used to set up build actions.
                          
                          If does not contain dot, should be a module name.
                          The flags will be applied for all rules in that
                          module.
                          If module for rule is different from the calling
                          module, an error is issued.

         variable_name:   Variable that should be set on target
         
         condition        A condition when this flag should be applied.
                          Should be set of property sets. If one of
                          those property sets is contained in build
                          properties, the flag will be used.
                          Implied values are not allowed:
                          "<toolset>gcc" should be used, not just
                          "gcc". Subfeatures, like in "<toolset>gcc-3.2"
                          are allowed. If left empty, the flag will
                          always used.
                          
                          Propery sets may use value-less properties 
                          ('<a>'  vs. '<a>value') to match absent 
                          properties. This allows to separately match
                          
                             <architecture>/<address-model>64
                             <architecture>ia64/<address-model>
                          
                          Where both features are optional. Without this
                          syntax we'd be forced to define "default" value.

         values:          The value to add to variable. If <feature>
                          is specified, then the value of 'feature' 
                          will be added.
    """
    caller = bjam.caller()[:-1]
    if not '.' in rule_or_module and caller.startswith("Jamfile"):
        # Unqualified rule name, used inside Jamfile. Most likely used with
        # 'make' or 'notfile' rules. This prevents setting flags on the entire
        # Jamfile module (this will be considered as rule), but who cares?
        # Probably, 'flags' rule should be split into 'flags' and
        # 'flags-on-module'.
        rule_or_module = qualify_jam_action(rule_or_module, caller)
    else:
        # FIXME: revive checking that we don't set flags for a different
        # module unintentionally
        pass

    if condition and not replace_grist(condition, ''):
        # We have condition in the form '<feature>', that is, without
        # value. That's a previous syntax:
        #
        #   flags gcc.link RPATH <dll-path> ;
        # for compatibility, convert it to
        #   flags gcc.link RPATH : <dll-path> ;
        values = [condition]
        condition = None

    if condition:
        transformed = []
        for c in condition:
            # FIXME: 'split' might be a too raw tool here.
            pl = [property.create_from_string(s) for s in c.split('/')]
            pl = feature.expand_subfeatures(pl)
            transformed.append(property_set.create(pl))
        condition = transformed

        property.validate_property_sets(condition)

    __add_flag(rule_or_module, variable_name, condition, values)