当前位置: 首页>>代码示例>>Python>>正文


Python property_set.create函数代码示例

本文整理汇总了Python中b2.build.property_set.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, name, project, sources, requirements, default_build,
                 usage_requirements):

        AliasTarget.__init__(self, name, project, sources, requirements, default_build,
                             usage_requirements)

        # On Linux, we build release variant by default, since few users will
        # ever want to debug C++ Boost libraries, and there's no ABI
        # incompatibility between debug and release variants. We build
        # shared and static libraries since that's what most packages
        # seem to provide (.so in libfoo and .a in libfoo-dev).
        self.minimal_properties = property_set.create([
            "<variant>release", "<threading>multi", "<link>shared", "<link>static",
            "<runtime-link>shared"])
        # On Windows, new IDE projects use:
        #
        #   runtime-link=dynamic, threading=multi, variant=(debug|release)
        #
        # and in addition, C++ Boost's autolink defaults to static linking.
        self.minimal_properties_win = property_set.create([
            "<variant>debug", "<variant>release", "<threading>multi", "<link>static",
            "<runtime-link>shared"])

        self.complete_properties = property_set.create([
            "<variant>debug", "<variant>release",
            "<threading>single", "<threading>multi"
            "<link>shared", "<link>static",
            "<runtime-link>shared", "<runtime-link>static"])
开发者ID:AlexMioMio,项目名称:boost,代码行数:28,代码来源:boostcpp.py

示例2: set

    def set(self, attribute, specification, exact):
        """Set the named attribute from the specification given by the user.
        The value actually set may be different."""

        if exact:
            self.__dict__[attribute] = specification
            
        elif attribute == "requirements":
            self.requirements = property_set.refine_from_user_input(
                self.requirements, specification,
                self.project_module, self.location)
            
        elif attribute == "usage-requirements":
            unconditional = []
            for p in specification:
                split = property.split_conditional(p)
                if split:
                    unconditional.append(split[1])
                else:
                    unconditional.append(p)

            non_free = property.remove("free", unconditional)
            if non_free:                
                pass
                # FIXME:
                #errors.error "usage-requirements" $(specification) "have non-free properties" $(non-free) ;

            t = property.translate_paths(specification, self.location)

            existing = self.__dict__.get("usage-requirements")
            if existing:
                new = property_set.create(existing.raw() +  t)
            else:
                new = property_set.create(t)
            self.__dict__["usage-requirements"] = new

                
        elif attribute == "default-build":
            self.__dict__["default-build"] = property_set.create(specification)
            
        elif attribute == "source-location":
            source_location = []
            for path in specification:
                source_location += os.path.join(self.location, path)
            self.__dict__["source-location"] = source_location
                
        elif attribute == "build-dir":
            self.__dict__["build-dir"] = os.path.join(self.location, specification)
                 
        elif not attribute in ["id", "default-build", "location",
                               "source-location", "parent",
                               "projects-to-build", "project-root"]:
            self.manager.errors()(
"""Invalid project attribute '%s' specified
for project at '%s'""" % (attribute, self.location))
        else:
            self.__dict__[attribute] = specification
开发者ID:CambrianTech,项目名称:boost-build,代码行数:57,代码来源:project.py

示例3: convert_command_line_element

def convert_command_line_element(e):

    result = None
    parts = e.split("/")
    for p in parts:
        m = p.split("=")
        if len(m) > 1:
            feature = m[0]
            values = m[1].split(",")
            lresult = [("<%s>%s" % (feature, v)) for v in values]
        else:
            lresult = p.split(",")
            
        if p.find('-') == -1:
            # FIXME: first port property.validate
            # property.validate cannot handle subfeatures,
            # so we avoid the check here.
            #for p in lresult:
            #    property.validate(p)
            pass

        if not result:
            result = lresult
        else:
            result = [e1 + "/" + e2 for e1 in result for e2 in lresult]

    return [property_set.create(b2.build.feature.split(r)) for r in result]
开发者ID:Bandeira,项目名称:sps,代码行数:27,代码来源:build_request.py

示例4: run

    def run(self, project, name, prop_set, sources):

        if not name:
            return None

        # If name is empty, it means we're called not from top-level.
        # In this case, we just fail immediately, because SearchedLibGenerator
        # cannot be used to produce intermediate targets.
        
        properties = prop_set.raw ()
        shared = '<link>shared' in properties

        a = virtual_target.NullAction (project.manager(), prop_set)
        
        real_name = feature.get_values ('<name>', properties)
        if real_name:
            real_name = real_name[0]
        else:
            real_name = name
        search = feature.get_values('<search>', properties)
        usage_requirements = property_set.create(['<xdll-path>' + p for p in search])
        t = SearchedLibTarget(real_name, project, shared, search, a)

        # We return sources for a simple reason. If there's
        #    lib png : z : <name>png ; 
        # the 'z' target should be returned, so that apps linking to
        # 'png' will link to 'z', too.
        return(usage_requirements, [b2.manager.get_manager().virtual_targets().register(t)] + sources)
开发者ID:Beman,项目名称:build,代码行数:28,代码来源:builtin.py

示例5: extra_usage_requirements

    def extra_usage_requirements (self, created_targets, prop_set):
        
        result = property_set.empty ()
        extra = []
                        
        # Add appropriate <xdll-path> usage requirements.
        raw = prop_set.raw ()
        if '<link>shared' in raw:
            paths = []
            
            # TODO: is it safe to use the current directory? I think we should use 
            # another mechanism to allow this to be run from anywhere.
            pwd = os.getcwd()
            
            for t in created_targets:
                if type.is_derived(t.type(), 'SHARED_LIB'):
                    paths.append(path.root(path.make(t.path()), pwd))

            extra += replace_grist(paths, '<xdll-path>')
        
        # We need to pass <xdll-path> features that we've got from sources,
        # because if shared library is built, exe which uses it must know paths
        # to other shared libraries this one depends on, to be able to find them
        # all at runtime.
                        
        # Just pass all features in property_set, it's theorically possible
        # that we'll propagate <xdll-path> features explicitly specified by
        # the user, but then the user's to blaim for using internal feature.                
        values = prop_set.get('<xdll-path>')
        extra += replace_grist(values, '<xdll-path>')
        
        if extra:
            result = property_set.create(extra)

        return result
开发者ID:Beman,项目名称:build,代码行数:35,代码来源:builtin.py

示例6: generated_targets

    def generated_targets (self, sources, prop_set, project, name):

        # sources to pass to inherited rule
        sources2 = []
        # properties to pass to inherited rule
        properties2  = []
        # sources which are libraries
        libraries  = []
        
        # Searched libraries are not passed as argument to linker
        # but via some option. So, we pass them to the action
        # via property. 
        properties2 = prop_set.raw()
        fsa = []
        fst = []
        for s in sources:
            if type.is_derived(s.type(), 'SEARCHED_LIB'):
                name = s.real_name()
                if s.shared():
                    fsa.append(name)

                else:
                    fst.append(name)

            else:
                sources2.append(s)

        if fsa:
            properties2 += [replace_grist('&&'.join(fsa), '<find-shared-library>')]
        if fst:
            properties2 += [replace_grist('&&'.join(fst), '<find-static-library>')]
                
        spawn = generators.Generator.generated_targets(self, sources2, property_set.create(properties2), project, name)
        
        return spawn
开发者ID:CambrianTech,项目名称:boost-build,代码行数:35,代码来源:builtin.py

示例7: expand_no_defaults

def expand_no_defaults (property_sets):
    """ Expand the given build request by combining all property_sets which don't
        specify conflicting non-free features.
    """
    # First make all features and subfeatures explicit
    expanded_property_sets = [ps.expand_subfeatures() for ps in property_sets]
    
    # Now combine all of the expanded property_sets
    product = __x_product (expanded_property_sets)
    
    return [property_set.create(p) for p in product]
开发者ID:Bandeira,项目名称:sps,代码行数:11,代码来源:build_request.py

示例8: run

    def run (self, project, name, prop_set, sources):
        assert isinstance(project, targets.ProjectTarget)
        assert isinstance(name, basestring) or name is None
        assert isinstance(prop_set, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)

        # create a copy since sources is being modified
        sources = list(sources)
        sources.extend(prop_set.get('<library>'))

        # Add <library-path> properties for all searched libraries
        extra = []
        for s in sources:
            if s.type () == 'SEARCHED_LIB':
                search = s.search()
                extra.extend(property.Property('<library-path>', sp) for sp in search)

        # It's possible that we have libraries in sources which did not came
        # from 'lib' target. For example, libraries which are specified
        # just as filenames as sources. We don't have xdll-path properties
        # for such target, but still need to add proper dll-path properties.
        extra_xdll_path = []
        for s in sources:
                if type.is_derived (s.type (), 'SHARED_LIB') and not s.action ():
                    # Unfortunately, we don't have a good way to find the path
                    # to a file, so use this nasty approach.
                    p = s.project()
                    location = path.root(s.name(), p.get('source-location')[0])
                    extra_xdll_path.append(os.path.dirname(location))

        # Hardcode DLL paths only when linking executables.
        # Pros: do not need to relink libraries when installing.
        # Cons: "standalone" libraries (plugins, python extensions) can not
        # hardcode paths to dependent libraries.
        if prop_set.get('<hardcode-dll-paths>') == ['true'] \
              and type.is_derived(self.target_types_ [0], 'EXE'):
                xdll_path = prop_set.get('<xdll-path>')
                extra.extend(property.Property('<dll-path>', sp) \
                     for sp in extra_xdll_path)
                extra.extend(property.Property('<dll-path>', sp) \
                     for sp in xdll_path)

        if extra:
            prop_set = prop_set.add_raw (extra)
        result = generators.Generator.run(self, project, name, prop_set, sources)

        if result:
            ur = self.extra_usage_requirements(result, prop_set)
            ur = ur.add(property_set.create(['<xdll-path>' + p for p in extra_xdll_path]))
        else:
            return None
        return (ur, result)
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:52,代码来源:builtin.py

示例9: boost_std

def boost_std(inc=None, lib=None):
    # The default definitions for pre-built libraries.
    rules.project(
        ["boost"],
        ["usage-requirements"] + ["<include>{}".format(i) for i in inc] + ["<define>BOOST_ALL_NO_LIB"],
        ["requirements"] + ["<search>{}".format(l) for l in lib],
    )

    # TODO: There should be a better way to add a Python function into a
    # project requirements property set.
    tag_prop_set = property_set.create([property.Property("<tag>", tag_std)])
    attributes = projects.attributes(projects.current().project_module())
    attributes.requirements = attributes.requirements.refine(tag_prop_set)

    alias("headers")

    def boost_lib(lib_name, dyn_link_macro):
        if isinstance(lib_name, str):
            lib_name = [lib_name]
        builtin.lib(lib_name, usage_requirements=["<link>shared:<define>{}".format(dyn_link_macro)])

    boost_lib("date_time", "BOOST_DATE_TIME_DYN_LINK")
    boost_lib("filesystem", "BOOST_FILE_SYSTEM_DYN_LINK")
    boost_lib("graph", "BOOST_GRAPH_DYN_LINK")
    boost_lib("graph_parallel", "BOOST_GRAPH_DYN_LINK")
    boost_lib("iostreams", "BOOST_IOSTREAMS_DYN_LINK")
    boost_lib("locale", "BOOST_LOG_DYN_LINK")
    boost_lib("log", "BOOST_LOG_DYN_LINK")
    boost_lib("log_setup", "BOOST_LOG_DYN_LINK")
    boost_lib("math_tr1", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("math_tr1f", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("math_tr1l", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("math_c99", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("math_c99f", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("math_c99l", "BOOST_MATH_TR1_DYN_LINK")
    boost_lib("mpi", "BOOST_MPI_DYN_LINK")
    boost_lib("program_options", "BOOST_PROGRAM_OPTIONS_DYN_LINK")
    boost_lib("python", "BOOST_PYTHON_DYN_LINK")
    boost_lib("python3", "BOOST_PYTHON_DYN_LINK")
    boost_lib("random", "BOOST_RANDOM_DYN_LINK")
    boost_lib("regex", "BOOST_REGEX_DYN_LINK")
    boost_lib("serialization", "BOOST_SERIALIZATION_DYN_LINK")
    boost_lib("wserialization", "BOOST_SERIALIZATION_DYN_LINK")
    boost_lib("signals", "BOOST_SIGNALS_DYN_LINK")
    boost_lib("system", "BOOST_SYSTEM_DYN_LINK")
    boost_lib("unit_test_framework", "BOOST_TEST_DYN_LINK")
    boost_lib("prg_exec_monitor", "BOOST_TEST_DYN_LINK")
    boost_lib("test_exec_monitor", "BOOST_TEST_DYN_LINK")
    boost_lib("thread", "BOOST_THREAD_DYN_DLL")
    boost_lib("wave", "BOOST_WAVE_DYN_LINK")
开发者ID:X-Plane,项目名称:xptools_msvc_libs,代码行数:50,代码来源:boost.py

示例10: boost_std

def boost_std(inc = None, lib = None):
    # The default definitions for pre-built libraries.
    rules.project(
        ['boost'],
        ['usage-requirements'] + ['<include>{}'.format(i) for i in inc] + ['<define>BOOST_ALL_NO_LIB'],
        ['requirements'] + ['<search>{}'.format(l) for l in lib])

    # TODO: There should be a better way to add a Python function into a
    # project requirements property set.
    tag_prop_set = property_set.create([property.Property('<tag>', tag_std)])
    attributes = projects.attributes(projects.current().project_module())
    attributes.requirements = attributes.requirements.refine(tag_prop_set)

    alias('headers')

    def boost_lib(lib_name, dyn_link_macro):
        if (isinstance(lib_name,str)):
            lib_name = [lib_name]
        builtin.lib(lib_name, usage_requirements=['<link>shared:<define>{}'.format(dyn_link_macro)])

    boost_lib('container'           , 'BOOST_CONTAINER_DYN_LINK'      )
    boost_lib('date_time'           , 'BOOST_DATE_TIME_DYN_LINK'      )
    boost_lib('filesystem'          , 'BOOST_FILE_SYSTEM_DYN_LINK'    )
    boost_lib('graph'               , 'BOOST_GRAPH_DYN_LINK'          )
    boost_lib('graph_parallel'      , 'BOOST_GRAPH_DYN_LINK'          )
    boost_lib('iostreams'           , 'BOOST_IOSTREAMS_DYN_LINK'      )
    boost_lib('locale'              , 'BOOST_LOG_DYN_LINK'            )
    boost_lib('log'                 , 'BOOST_LOG_DYN_LINK'            )
    boost_lib('log_setup'           , 'BOOST_LOG_DYN_LINK'            )
    boost_lib('math_tr1'            , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('math_tr1f'           , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('math_tr1l'           , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('math_c99'            , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('math_c99f'           , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('math_c99l'           , 'BOOST_MATH_TR1_DYN_LINK'       )
    boost_lib('mpi'                 , 'BOOST_MPI_DYN_LINK'            )
    boost_lib('program_options'     , 'BOOST_PROGRAM_OPTIONS_DYN_LINK')
    boost_lib('python'              , 'BOOST_PYTHON_DYN_LINK'         )
    boost_lib('python3'             , 'BOOST_PYTHON_DYN_LINK'         )
    boost_lib('random'              , 'BOOST_RANDOM_DYN_LINK'         )
    boost_lib('regex'               , 'BOOST_REGEX_DYN_LINK'          )
    boost_lib('serialization'       , 'BOOST_SERIALIZATION_DYN_LINK'  )
    boost_lib('wserialization'      , 'BOOST_SERIALIZATION_DYN_LINK'  )
    boost_lib('signals'             , 'BOOST_SIGNALS_DYN_LINK'        )
    boost_lib('system'              , 'BOOST_SYSTEM_DYN_LINK'         )
    boost_lib('unit_test_framework' , 'BOOST_TEST_DYN_LINK'           )
    boost_lib('prg_exec_monitor'    , 'BOOST_TEST_DYN_LINK'           )
    boost_lib('test_exec_monitor'   , 'BOOST_TEST_DYN_LINK'           )
    boost_lib('thread'              , 'BOOST_THREAD_DYN_DLL'          )
    boost_lib('wave'                , 'BOOST_WAVE_DYN_LINK'           )
开发者ID:Cabriter,项目名称:abelkhan,代码行数:50,代码来源:boost.py

示例11: run

    def run (self, project, name, prop_set, sources):
       
        lib_sources = prop_set.get('<library>')
        sources.extend(lib_sources)
        
        # Add <library-path> properties for all searched libraries
        extra = []
        for s in sources:
            if s.type () == 'SEARCHED_LIB':
                search = s.search()
                extra.extend(property.Property('<library-path>', sp) for sp in search)

        orig_xdll_path = []
                   
        if prop_set.get('<hardcode-dll-paths>') == ['true'] \
               and type.is_derived(self.target_types_ [0], 'EXE'):
            xdll_path = prop_set.get('<xdll-path>')
            orig_xdll_path = [ replace_grist(x, '<dll-path>') for x in xdll_path ]
            # It's possible that we have libraries in sources which did not came
            # from 'lib' target. For example, libraries which are specified
            # just as filenames as sources. We don't have xdll-path properties
            # for such target, but still need to add proper dll-path properties.
            for s in sources:
                if type.is_derived (s.type (), 'SHARED_LIB') and not s.action ():
                    # Unfortunately, we don't have a good way to find the path
                    # to a file, so use this nasty approach.
                    p = s.project()
                    location = path.root(s.name(), p.get('source-location'))
                    xdll_path.append(path.parent(location))
                          
            extra.extend(property.Property('<dll-path>', sp) for sp in xdll_path)
        
        if extra:
            prop_set = prop_set.add_raw (extra)
                        
        result = generators.Generator.run(self, project, name, prop_set, sources)

        if result:
            ur = self.extra_usage_requirements(result, prop_set)
            ur = ur.add(property_set.create(orig_xdll_path))
        else:
            return None
        
        return(ur, result)
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:44,代码来源:builtin.py

示例12: run

    def run(self, project, name, prop_set, sources):

        sources.extend(prop_set.get("<library>"))

        # Add <library-path> properties for all searched libraries
        extra = []
        for s in sources:
            if s.type() == "SEARCHED_LIB":
                search = s.search()
                extra.extend(property.Property("<library-path>", sp) for sp in search)

        # It's possible that we have libraries in sources which did not came
        # from 'lib' target. For example, libraries which are specified
        # just as filenames as sources. We don't have xdll-path properties
        # for such target, but still need to add proper dll-path properties.
        extra_xdll_path = []
        for s in sources:
            if type.is_derived(s.type(), "SHARED_LIB") and not s.action():
                # Unfortunately, we don't have a good way to find the path
                # to a file, so use this nasty approach.
                p = s.project()
                location = path.root(s.name(), p.get("source-location")[0])
                extra_xdll_path.append(os.path.dirname(location))

        # Hardcode DLL paths only when linking executables.
        # Pros: do not need to relink libraries when installing.
        # Cons: "standalone" libraries (plugins, python extensions) can not
        # hardcode paths to dependent libraries.
        if prop_set.get("<hardcode-dll-paths>") == ["true"] and type.is_derived(self.target_types_[0], "EXE"):
            xdll_path = prop_set.get("<xdll-path>")
            extra.extend(property.Property("<dll-path>", sp) for sp in extra_xdll_path)
            extra.extend(property.Property("<dll-path>", sp) for sp in xdll_path)

        if extra:
            prop_set = prop_set.add_raw(extra)
        result = generators.Generator.run(self, project, name, prop_set, sources)

        if result:
            ur = self.extra_usage_requirements(result, prop_set)
            ur = ur.add(property_set.create(["<xdll-path>" + p for p in extra_xdll_path]))
        else:
            return None
        return (ur, result)
开发者ID:pombredanne,项目名称:mcsema,代码行数:43,代码来源:builtin.py

示例13: check

 def check(self, ps):
     assert isinstance(ps, property_set.PropertySet)
     # FIXME: this should not be hardcoded. Other checks might
     # want to consider different set of features as relevant.
     toolset = ps.get('toolset')[0]
     toolset_version_property = "<toolset-" + toolset + ":version>" ;
     relevant = ps.get_properties('target-os') + \
                ps.get_properties("toolset") + \
                ps.get_properties(toolset_version_property) + \
                ps.get_properties("address-model") + \
                ps.get_properties("architecture")
     rps = property_set.create(relevant)
     t = get_manager().targets().current()
     p = t.project()
     if builds(self.target, p, rps, "%s builds" % self.target):
         choosen = self.true_properties
     else:
         choosen = self.false_properties
     return property.evaluate_conditionals_in_context(choosen, ps)
开发者ID:zjutjsj1004,项目名称:third,代码行数:19,代码来源:configure.py

示例14: run

    def run(self, project, name, prop_set, sources):
        assert isinstance(project, targets.ProjectTarget)
        assert isinstance(name, basestring) or name is None
        assert isinstance(prop_set, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)

        # create a copy since this modifies the sources list
        sources = list(sources)
        sources.extend(prop_set.get("<library>"))

        result = generators.Generator.run(self, project, name, prop_set, sources)

        usage_requirements = []
        link = prop_set.get("<link>")
        if "static" in link:
            for t in sources:
                if type.is_derived(t.type(), "LIB"):
                    usage_requirements.append(property.Property("<library>", t))

        usage_requirements = property_set.create(usage_requirements)

        return usage_requirements, result
开发者ID:boostorg,项目名称:build,代码行数:22,代码来源:builtin.py

示例15: run_pch

    def run_pch(self, project, name, prop_set, sources):
        # Find the header in sources. Ignore any CPP sources.
        header = None
        for s in sources:
            if type.is_derived(s.type(), 'H'):
                header = s

        # Error handling: Base header file name should be the same as the base
        # precompiled header name.
        header_name = header.name()
        header_basename = os.path.basename(header_name).rsplit('.', 1)[0]
        if header_basename != name:
            location = project.project_module
            ###FIXME:
            raise Exception()
            ### errors.user-error "in" $(location)": pch target name `"$(name)"' should be the same as the base name of header file `"$(header-name)"'" ;

        pch_file = Generator.run(self, project, name, prop_set, [header])

        # return result of base class and pch-file property as usage-requirements
        # FIXME: what about multiple results from generator.run?
        return (property_set.create([Property('pch-file', pch_file[0]),
                                     Property('cflags', '-Winvalid-pch')]),
                pch_file)
开发者ID:MisterTea,项目名称:HyperNEAT,代码行数:24,代码来源:gcc.py


注:本文中的b2.build.property_set.create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。