Ejemplo n.º 1
0
def construct_types(project, name, target_types, prop_set, sources):

    result = []
    usage_requirements = property_set.empty()

    for t in target_types:
        r = construct(project, name, t, prop_set, sources)

        if r:
            (ur, targets) = r
            usage_requirements = usage_requirements.add(ur)
            result.extend(targets)

    # TODO: have to introduce parameter controlling if
    # several types can be matched and add appropriate
    # checks

    # TODO: need to review the documentation for
    # 'construct' to see if it should return $(source) even
    # if nothing can be done with it. Currents docs seem to
    # imply that, contrary to the behaviour.
    if result:
        return (usage_requirements, result)

    else:
        return (usage_requirements, sources)
Ejemplo n.º 2
0
 def construct(self, name, source_targets, properties):
     if __debug__:
         from .virtual_target import VirtualTarget
         assert isinstance(name, basestring)
         assert is_iterable_typed(source_targets, VirtualTarget)
         assert isinstance(properties, property_set.PropertySet)
     return [property_set.empty(), source_targets]
Ejemplo n.º 3
0
def try_one_generator_really(project, name, generator, target_type, properties,
                             sources):
    """ Returns usage requirements + list of created targets.
    """
    targets = generator.run(project, name, properties, sources)

    usage_requirements = []
    success = False

    dout("returned " + str(targets))

    if targets:
        success = True

        if isinstance(targets[0], property_set.PropertySet):
            usage_requirements = targets[0]
            targets = targets[1]

        else:
            usage_requirements = property_set.empty()

    dout("  generator" + generator.id() + " spawned ")
    #    generators.dout [ indent ] " " $(targets) ;
    #    if $(usage-requirements)
    #    {
    #        generators.dout [ indent ] "  with usage requirements:" $(x) ;
    #    }

    if success:
        return (usage_requirements, targets)
    else:
        return None
Ejemplo n.º 4
0
def construct_types (project, name, target_types, prop_set, sources):
    
    result = []
    usage_requirements = property_set.empty()
    
    for t in target_types:
        r = construct (project, name, t, prop_set, sources)

        if r:
            (ur, targets) = r
            usage_requirements = usage_requirements.add(ur)
            result.extend(targets)

    # TODO: have to introduce parameter controlling if
    # several types can be matched and add appropriate
    # checks 

    # TODO: need to review the documentation for
    # 'construct' to see if it should return $(source) even
    # if nothing can be done with it. Currents docs seem to
    # imply that, contrary to the behaviour.
    if result:
        return (usage_requirements, result)

    else:
        return (usage_requirements, sources)
Ejemplo n.º 5
0
def try_one_generator_really (project, name, generator, target_type, properties, sources):
    """ Returns usage requirements + list of created targets.
    """
    targets = generator.run (project, name, properties, sources)

    usage_requirements = []
    success = False

    dout("returned " + str(targets))

    if targets:
        success = True;
        
        if isinstance (targets[0], property_set.PropertySet):
            usage_requirements = targets [0]
            targets = targets [1]

        else:
            usage_requirements = property_set.empty ()

    dout(  "  generator" + generator.id() + " spawned ")
    #    generators.dout [ indent ] " " $(targets) ; 
#    if $(usage-requirements)
#    {
#        generators.dout [ indent ] "  with usage requirements:" $(x) ;
#    }

    if success:
        return (usage_requirements, targets)
    else:
        return None
Ejemplo n.º 6
0
 def construct(self, name, source_targets, properties):
     if __debug__:
         from .virtual_target import VirtualTarget
         assert isinstance(name, basestring)
         assert is_iterable_typed(source_targets, VirtualTarget)
         assert isinstance(properties, property_set.PropertySet)
     return [property_set.empty(), source_targets]
 def construct(self, name, source_targets, properties):
     return [property_set.empty(), source_targets]
Ejemplo n.º 8
0
 def construct(self, name, source_targets, properties):
     return [property_set.empty(), source_targets]