[pygccxml-commit] SF.net SVN: pygccxml: [1050] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-06-03 13:29:58
|
Revision: 1050 http://svn.sourceforge.net/pygccxml/?rev=1050&view=rev Author: roman_yakovenko Date: 2007-06-03 06:29:46 -0700 (Sun, 03 Jun 2007) Log Message: ----------- adding ability to select compiler Modified Paths: -------------- pygccxml_dev/pygccxml/parser/config.py pygccxml_dev/pygccxml/parser/source_reader.py pygccxml_dev/unittests/autoconfig.py Modified: pygccxml_dev/pygccxml/parser/config.py =================================================================== --- pygccxml_dev/pygccxml/parser/config.py 2007-06-03 07:40:11 UTC (rev 1049) +++ pygccxml_dev/pygccxml/parser/config.py 2007-06-03 13:29:46 UTC (rev 1050) @@ -29,7 +29,8 @@ , include_paths=None , define_symbols=None , undefine_symbols=None - , cflags=""): + , cflags="" + , compiler=None): """Constructor. """ object.__init__( self ) @@ -49,6 +50,8 @@ self.__cflags = cflags + self.__compiler = compiler + def clone(self): raise NotImplementedError( self.__class__.__name__ ) @@ -58,23 +61,32 @@ self.__working_directory=working_dir working_directory = property( __get_working_directory, __set_working_directory ) - def __get_include_paths(self): + @property + def include_paths(self): + """list of include paths to look for header files""" return self.__include_paths - include_paths = property( __get_include_paths ) - def __get_define_symbols(self): + @property + def define_symbols(self): + """list of "define" directives """ return self.__define_symbols - define_symbols = property( __get_define_symbols ) - def __get_undefine_symbols(self): + @property + def undefine_symbols(self): + """list of "undefine" directives """ return self.__undefine_symbols - undefine_symbols = property( __get_undefine_symbols ) - + + @property + def compiler(self): + """compiler name to simulate""" + return self.__compiler + def __get_cflags(self): return self.__cflags def __set_cflags(self, val): self.__cflags = val - cflags = property( __get_cflags, __set_cflags ) + cflags = property( __get_cflags, __set_cflags + , doc="additional flags to pass to compiler" ) def __ensure_dir_exists( self, dir_path, meaning ): if os.path.isdir( dir_path ): @@ -87,6 +99,7 @@ def raise_on_wrong_settings( self ): + """validates the configuration settings and raises RuntimeError on error""" self.__ensure_dir_exists( self.working_directory, 'working directory' ) map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' ) , self.include_paths ) @@ -106,7 +119,8 @@ , undefine_symbols=None , start_with_declarations=None , ignore_gccxml_output=False - , cflags=""): + , cflags="" + , compiler=None): """Constructor. """ parser_configuration_t.__init__( self @@ -114,7 +128,9 @@ , include_paths=include_paths , define_symbols=define_symbols , undefine_symbols=undefine_symbols - , cflags=cflags) + , cflags=cflags + , compiler=compiler) + self.__gccxml_path = gccxml_path if not start_with_declarations: @@ -130,17 +146,20 @@ return self.__gccxml_path def __set_gccxml_path(self, new_path ): self.__gccxml_path = new_path - gccxml_path = property( __get_gccxml_path, __set_gccxml_path ) + gccxml_path = property( __get_gccxml_path, __set_gccxml_path + , doc="gccxml binary location" ) - def __get_start_with_declarations(self): + @property + def start_with_declarations(self): + """list of declarations gccxml should start with, when it dumps declaration tree""" return self.__start_with_declarations - start_with_declarations = property( __get_start_with_declarations ) def __get_ignore_gccxml_output(self): return self.__ignore_gccxml_output def __set_ignore_gccxml_output(self, val=True): self.__ignore_gccxml_output = val - ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output ) + ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output + , doc="set this property to True, if you want pygccxml to ignore any error\\warning that comes from gccxml" ) def raise_on_wrong_settings( self ): @@ -182,7 +201,8 @@ , include_paths=None , define_symbols=None , undefine_symbols=None - , cflags=""): + , cflags="" + , compiler=None): """Constructor. """ parser_configuration_t.__init__( self @@ -190,7 +210,8 @@ , include_paths=include_paths , define_symbols=define_symbols , undefine_symbols=undefine_symbols - , cflags=cflags) + , cflags=cflags + , compiler=compiler) def clone(self): return copy.deepcopy( self ) Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2007-06-03 07:40:11 UTC (rev 1049) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-06-03 13:29:46 UTC (rev 1050) @@ -99,6 +99,7 @@ cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) ) else: cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) ) + # Add all cflags passed if self.__config.cflags != "": cmd.append(" %s "%self.__config.cflags) @@ -113,7 +114,9 @@ cmd.append( '-fxml="%s"' % xmlfile ) if self.__config.start_with_declarations: cmd.append( '-fxml-start="%s"' % ','.join( self.__config.start_with_declarations ) ) - + # Specify compiler if asked to + if self.__config.compiler: + cmd.append( " --gccxml-compiler %s" % self.__config.compiler ) cmd_line = ' '.join(cmd) if 'win32' in sys.platform : cmd_line = '"%s"' % cmd_line Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2007-06-03 07:40:11 UTC (rev 1049) +++ pygccxml_dev/unittests/autoconfig.py 2007-06-03 13:29:46 UTC (rev 1050) @@ -10,12 +10,14 @@ #__pychecker__ = 'limit=1000' #import pychecker.checker +compiler = None gccxml_path = '' data_directory = os.path.abspath( os.path.join( os.curdir, 'data' ) ) build_dir = os.path.abspath( os.path.join( os.curdir, 'temp' ) ) if 'roman' in getpass.getuser(): if sys.platform == 'win32': + compiler = 'msvc71' gccxml_path = r'd:/dev/gccxml_cvs/gccxml-bin/bin/release/gccxml.exe' else: gccxml_path = '/home/roman/gccxml/bin/gccxml' @@ -32,7 +34,8 @@ class cxx_parsers_cfg: gccxml = pygccxml.parser.gccxml_configuration_t( gccxml_path=gccxml_path - , working_directory=data_directory ) + , working_directory=data_directory + , compiler=compiler ) synopsis = pygccxml.parser.synopsis_configuration_t( working_directory=data_directory ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |