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


Python module_builder.module_builder_t函数代码示例

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


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

示例1: test

    def test(self):
        fpath = os.path.join( autoconfig.data_directory, 'already_exposed_to_be_exported.hpp' )
        mb = module_builder.module_builder_t( [module_builder.create_source_fc( fpath )]
                                              , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )

        mb.global_ns.exclude()
        mb.namespace( 'already_exposed' ).include()
        mb.build_code_creator( 'already_exposed' )

        already_exposed_dir = os.path.join( autoconfig.build_directory, 'already_exposed' )
        mb.write_module( os.path.join( already_exposed_dir, 'already_exposed.cpp' ) )

        #-----------------------------------------------------------------------

        fpath = os.path.join( autoconfig.data_directory, 'already_exposed_2to_be_exported.hpp' )
        mb = module_builder.module_builder_t( [module_builder.create_source_fc( fpath )]
                                              , gccxml_path=autoconfig.gccxml.executable
                                              , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )

        mb.global_ns.exclude()
        mb.namespace( 'to_be_exposed' ).include()
        mb.build_code_creator( 'to_be_exposed' )

        mb.register_module_dependency( already_exposed_dir )

        mb.build_code_creator( 'to_be_exposed' )
        to_be_exposed_dir = os.path.join( autoconfig.build_directory, 'to_be_exposed' )
        mb.write_module( os.path.join( to_be_exposed_dir, 'to_be_exposed.cpp' ) )

        body = mb.code_creator.body
        self.failUnless( 2 == len( body.creators ) )
        ae_derived_code = body.creators[0].create()
        self.failUnless( mb.class_( 'ae_base' ).decl_string in ae_derived_code )
开发者ID:asford,项目名称:pyplusplus,代码行数:33,代码来源:already_exposed_tester.py

示例2: _generate_code

    def _generate_code(self):
        global save_header_name
        
        try:
            config = self._parser_configurator.parser_configuration()
            header_file = self._header_file_configurator.header_file()
            if not header_file or not os.path.isfile( header_file ):
                raise RuntimeError( 'Header file "%s" does not exist or should be valid file name.' % header_file )
            gui_config_t.save_header_name( header_file )
            config.include_paths.append( os.path.split( header_file )[0] )
            
            start_time = time.clock()        
            mb = module_builder.module_builder_t( 
                    [ header_file ]
                    , gccxml_path=config.gccxml_path
                    , working_directory=os.path.split( header_file )[0]
                    , include_paths=config.include_paths
                    , define_symbols=config.define_symbols )

            parsed_time = time.clock() - start_time

            mb.build_code_creator( "pyplusplus" )
            mb.code_creator.user_defined_directories.extend( config.include_paths )
            code = mb.code_creator.create()
            code = code.replace( '\n\r', '\n' )
            code = code.replace( '\r\n', '\n' )
            code_generated_time = time.clock() - start_time - parsed_time
            self._generated_code.set_generated_code( code )
            self._statistics.set_parse_time( parsed_time )
            self._statistics.set_code_generation_time( code_generated_time )
        except Exception, error:
            user_msg = [ 'Error occured during code generation process!' ]
            user_msg.append( 'Error:' )
            user_msg.append( str( error ) )
            self._generated_code.set_generated_code( '\n'.join( user_msg ) )
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:35,代码来源:ui.py

示例3: __init__

 def __init__(self, files):
     # Parse code generation parameters from (optional) command line arguments
     # Otherwise hard code paths from my particular dev machine... (yuck)
     parser = argparse.ArgumentParser(description='Generates boost-python wrapping code for an OSG module.')
     parser.add_argument('--gccxml_path', 
                         default="C:/Program Files (x86)/gccxml/bin/gccxml.exe", 
                         help="path to the GCCXML executable program",)
     parser.add_argument('--osg_include_path', 
                         default="C:/Program Files (x86)/OpenSceneGraph323vs2008/include", 
                         help="path to the OpenSceneGraph C++ header files",)
     default_compiler = "msvc9"
     parser.add_argument('--gccxml_compiler', 
                         default=default_compiler, 
                         help="name of C++ compiler",)
     args = parser.parse_args()
     #
     gccxml_path = args.gccxml_path
     osg_include_path = args.osg_include_path
     compiler = args.gccxml_compiler
     #
     self.max_arity = 18
     define_symbols = []
     if compiler == 'msvc9':
         define_symbols.append("_HAS_TR1=0") # avoid boost compiler errors on windows
     define_symbols.append("BOOST_PYTHON_MAX_ARITY=%d" % self.max_arity)
     #
     self.mb = module_builder.module_builder_t(
         files = files,
         gccxml_path = gccxml_path,
         include_paths = [osg_include_path,],
         define_symbols=define_symbols,
         indexing_suite_version=2,
         compiler=compiler,
     )
     self.mb.BOOST_PYTHON_MAX_ARITY = self.max_arity # Prevents warnings on 10-18 argument methods
开发者ID:cmbruns,项目名称:osgpyplusplus,代码行数:35,代码来源:wrap_helpers.py

示例4: _create_extension_source_file

    def _create_extension_source_file(self):
        global LICENSE
        
        #xml_file = os.path.split( self.__to_be_exported_header )[1]
        #xml_file = os.path.join( autoconfig.build_dir, xml_file + '.xml' )
        #xml_cached_fc = parser.create_cached_source_fc( self.__to_be_exported_header, xml_file )

        #mb = module_builder.module_builder_t( [xml_cached_fc]
        mb = module_builder.module_builder_t( [self.__to_be_exported_header]
                                              , gccxml_path=autoconfig.gccxml.executable
                                              , include_paths=[autoconfig.boost.include]
                                              , undefine_symbols=['__MINGW32__']
                                              , indexing_suite_version=self.__indexing_suite_version)
        for decl in mb.decls():
            decl.documentation = '"documentation"'
        self.customize( mb )
        doc_extractor = lambda decl: decl.documentation
        if not mb.has_code_creator():
            mb.build_code_creator( self.__module_name, doc_extractor=doc_extractor )
        mb.code_creator.std_directories.extend( autoconfig.scons_config.cpppath )
        mb.code_creator.user_defined_directories.append( autoconfig.data_directory )
        mb.code_creator.precompiled_header = "boost/python.hpp"
        mb.code_creator.license = LICENSE
        self.generate_source_files( mb )
        self.__test_already_exposed( mb )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:25,代码来源:fundamental_tester_base.py

示例5: test

 def test(self):
     
     code = """
         namespace xyz{
             struct Y;
             
             struct X{
                 X();
                 X( const X& );       
                 X( Y* );
             };
         }
     """
     
     mb = module_builder.module_builder_t( 
             [ module_builder.create_text_fc( code ) ]
             , gccxml_path=autoconfig.gccxml.executable )
     
     x = mb.class_( 'X' )
     x.include()
     x.constructors().body = '    //all constructors body'
     x.null_constructor_body = '    //null constructor body'
     x.copy_constructor_body = '    //copy constructor body'
     
     mb.build_code_creator( 'XXX' )
     code = mb.code_creator.create()
     tmp = code.split( x.null_constructor_body )
     self.failUnless( len( tmp ) == 2 )
     tmp = code.split( x.copy_constructor_body )
     self.failUnless( len( tmp ) == 2 )
     tmp = code.split( '    //all constructors body' )
     self.failUnless( len( tmp ) == 2 )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:32,代码来源:algorithms_tester.py

示例6: test

    def test(self):
        module_builder.set_logger_level( logging.CRITICAL )
        messages.disable( *messages.all_warning_msgs )

        xml_file = parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'particleuniverse.xml' ) )

        mb = module_builder.module_builder_t(
                [ xml_file ]
                , gccxml_path=autoconfig.gccxml.executable
                , indexing_suite_version=2
                , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())

        mb.global_ns.exclude()
        mb.namespace('ParticleUniverse').include()
        mb.namespace('Ogre').include()
        mb.namespace('Ogre').classes().already_exposed = True

        target_dir = os.path.join( autoconfig.build_directory, 'particle_universe' )
        #~ if os.path.exists( target_dir ):
            #~ shutil.rmtree( target_dir )
        #~ os.mkdir( target_dir )
        psp = mb.class_( '::ParticleUniverse::ParticleScriptParser' )
        declarations.print_declarations( psp )
        mb.build_code_creator( 'PU' )
        mb.split_module( target_dir )
开发者ID:asford,项目名称:pyplusplus,代码行数:25,代码来源:particle_universe_generate_tester.py

示例7: test

    def test(self):
        module_builder.set_logger_level( logging.CRITICAL )
        messages.disable( *messages.all_warning_msgs )

        ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' )
        ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) )

        mb = module_builder.module_builder_t(
                [ ogre_file ]
                , gccxml_path=autoconfig.gccxml.executable
                , indexing_suite_version=2
                , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())

        mb.global_ns.exclude()
        mb.namespace('Ogre').include()

        x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name )
        for y in x:
            print y.name
            print y.partial_name
            print declarations.full_name( y, with_defaults=False )

        target_dir = os.path.join( autoconfig.build_directory, 'ogre' )
        #~ if os.path.exists( target_dir ):
            #~ shutil.rmtree( target_dir )
        #~ os.mkdir( target_dir )

        mb.build_code_creator( 'Ogre3d' )
        mb.split_module( target_dir )
开发者ID:CTrauma,项目名称:pypp11,代码行数:29,代码来源:ogre_generate_tester.py

示例8: create_module

def create_module():
    parser_config = parser.config_t( )

    fx_xml = os.path.join( settings.xml_files, 'fx.xml' )
    mb = module_builder.module_builder_t( [ parser.create_cached_source_fc( 'fx.h', fx_xml ) ]
                                          , gccxml_path=settings.gccxml_path
                                          , include_paths=[settings.boost_path, settings.tnfox_include_path]
                                          , define_symbols=settings.defined_symbols_gccxml )
    mb.run_query_optimizer()
    print 'filtering declarations'
    filter_decls( mb )
    print 'filtering declarations - done'
    print 'set call policies'
    set_call_policies( mb )
    print 'set call policies - done'
    print 'customize declarations'
    customize_decls( mb )
    print 'customize declarations - done'
    print 'creating module'
    mb.build_code_creator(settings.module_name )
    print 'creating module - done'
    print 'customizing module'
    customize_module( mb )
    print 'customizing module - done'
    return mb
开发者ID:ned14,项目名称:tnfox,代码行数:25,代码来源:create_tnfox.py

示例9: gen_cpp

def gen_cpp(params, q_result, q_error):
    '''
    Generate cpp (Boost.Python) code
    @param params: List of parameters [gccxml,incPath,macros]
    @param q_result: python queue to put result in
    @param q_error: python queue to put error in
    @return None (isn't evaluated)
    '''
    try:
        header_file = params[3]
    
        include_paths = params[1]
        include_paths.append( os.path.split( header_file )[0] )
        
        mb = module_builder.module_builder_t( 
                [ header_file ]
                , gccxml_path=params[0]
                , working_directory=os.path.split( header_file )[0]
                , include_paths=include_paths
                , define_symbols=params[2] )
    
        mb.build_code_creator( "pyplusplus" )
        mb.code_creator.user_defined_directories.extend( include_paths )
        code = mb.code_creator.create()
        code = code.replace( '\n\r', '\n' )
        code = code.replace( '\r\n', '\n' )

        q_result.put( code )
    except Exception, error:
        q_result.put(str( error ))
        q_error.put(str( error ))
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:31,代码来源:code_generator.py

示例10: test

 def test(self):
     mb = module_builder.module_builder_t( self._get_files()
                                           , gccxml_path=autoconfig.gccxml.executable
                                           , include_paths=[autoconfig.boost.include]
                                           , undefine_symbols=['__MINGW32__'])
     writer = lambda decl: None
     module_builder.print_declarations( mb.global_ns, writer=writer )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:7,代码来源:dwrapper_printer_tester.py

示例11: _create_extension_source_file

    def _create_extension_source_file(self):
        global LICENSE

        if os.path.exists( self.__generated_source_file_name + '.xml' ):
            os.remove( self.__generated_source_file_name + '.xml' )

        test_header_cfg \
            = pygccxml.parser.create_cached_source_fc( self.__to_be_exported_header
                                                       , self.__generated_source_file_name + '.xml' )

        mb = module_builder.module_builder_t( [ test_header_cfg ]
                                              #, undefine_symbols=['__MINGW32__']
                                              , indexing_suite_version=self.__indexing_suite_version
                                              , gccxml_config=autoconfig.cxx_parsers_cfg.gccxml)
        for decl in mb.decls():
            decl.documentation = '"documentation"'
        self.customize( mb )
        doc_extractor = lambda decl: decl.documentation
        if not mb.has_code_creator():
            mb.build_code_creator( self.__module_name, doc_extractor=doc_extractor )
        mb.code_creator.std_directories.extend( autoconfig.scons_config.cpppath )
        mb.code_creator.user_defined_directories.append( autoconfig.data_directory )
        mb.code_creator.precompiled_header = "boost/python.hpp"
        mb.code_creator.license = LICENSE
        self.generate_source_files( mb )
        self.__test_already_exposed( mb )
开发者ID:CTrauma,项目名称:pypp11,代码行数:26,代码来源:fundamental_tester_base.py

示例12: __init__

    def __init__(self,
                 module_name = '',
                 call_policies = (),
                 function_call_policies = (),
                 excluded_classes = (),
                 excluded_members = (),
                 included_members = (),
                 excluded_constructors = (),
                 already_exposed = (),
                 headers = [],
                 extra_headers = [],
                 extra_declarations = [],
                 extra_registrations = [],
                 extra_member_registrations = [],
                 held_types = [],
                 ownership_transfers = [],
                 ):
        self.module_name = module_name
        self.headers = headers
        self.call_policies = call_policies
        self.function_call_policies = function_call_policies
        self.excluded_classes = excluded_classes
        self.excluded_members = excluded_members
        self.included_members = included_members
        self.excluded_constructors = excluded_constructors
        self.already_exposed = already_exposed
        self.extra_headers = extra_headers
        self.extra_declarations = extra_declarations
        self.extra_member_registrations = extra_member_registrations
        self.extra_registrations = extra_registrations
        self.held_types = held_types
        self.ownership_transfers = ownership_transfers
        self.bindings_dir = "."


        # If only generating the list of dependences, do not create
        # the module builder, because it would compile all the headers
        # with gccxml.
        if len(sys.argv) == 2 and sys.argv[1] == '--generate-dependences':
            pass
	else:
            #try:
            #    os.mkdir(self.bindings_dir)
            #except OSError:
            #    pass
            
            hh = map(os.path.abspath, headers)
            header_file_name = "%s/%s_headers.hpp" % (self.bindings_dir,
                                                     self.module_name)
            f = open(header_file_name, 'w')
            for h in hh:
                f.write('#include <%s>\n'% h)
            f.close()
            self.module_builder = module_builder.module_builder_t(
                [os.path.abspath(header_file_name)]
                , gccxml_path=r"/usr/bin/gccxml" 
                , include_paths=include_paths
                , define_symbols=['TCE_PYTHON_BINDINGS']
                , indexing_suite_version=2)
开发者ID:alekob,项目名称:tce,代码行数:59,代码来源:binding_generator.py

示例13: test

 def test(self):
     mb = module_builder.module_builder_t(
             [ module_builder.create_text_fc( 'namespace enums{ enum { OK=1 }; }' ) ]
             , gccxml_path=autoconfig.gccxml.executable
             , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() )
     mb.namespace( name='::enums' ).include()
     mb.build_code_creator('dummy')
     flatten = code_creators.make_flatten(mb.code_creator.creators)
     self.failUnless( [inst for inst in flatten if isinstance( inst, code_creators.unnamed_enum_t )] )
开发者ID:asford,项目名称:pyplusplus,代码行数:9,代码来源:algorithms_tester.py

示例14: test

    def test(self):
        mb = module_builder.module_builder_t(
                        [ module_builder.create_text_fc( 'struct x{};' ) ]
                        , gccxml_path=autoconfig.gccxml.executable
                        , encoding='UTF-8'
                        , compiler=autoconfig.cxx_parsers_cfg.gccxml.compiler)

        mb.build_code_creator( module_name='unicode_bug' )
        mb.code_creator.license = "//абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
        mb.write_module( os.path.join( autoconfig.build_dir, 'unicode_bug.cpp' ) )
开发者ID:asford,项目名称:pyplusplus,代码行数:10,代码来源:unicode_bug.py

示例15: __init__

    def __init__(self):
        self.__file = os.path.join(crc_settings.working_dir, "crc_export.hpp")

        self.__mb = module_builder.module_builder_t(
            [parser.create_cached_source_fc(self.__file, os.path.join(crc_settings.generated_files_dir, "crc.xml"))],
            gccxml_path=crc_settings.gccxml.executable,
            include_paths=[crc_settings.boost.include],
            define_symbols=crc_settings.defined_symbols,
            undefine_symbols=crc_settings.undefined_symbols,
            indexing_suite_version=2,
        )
开发者ID:ISoirar,项目名称:pypp11,代码行数:11,代码来源:generate_code.py


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