[pygccxml-commit] SF.net SVN: pygccxml:[1657]
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-02-03 20:42:23
|
Revision: 1657 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1657&view=rev Author: roman_yakovenko Date: 2009-02-03 20:42:16 +0000 (Tue, 03 Feb 2009) Log Message: ----------- enable pydsc Modified Paths: -------------- pydsc_dev/pydsc.py pygccxml_dev/unittests/autoconfig.py Modified: pydsc_dev/pydsc.py =================================================================== --- pydsc_dev/pydsc.py 2009-02-03 20:06:54 UTC (rev 1656) +++ pydsc_dev/pydsc.py 2009-02-03 20:42:16 UTC (rev 1657) @@ -23,6 +23,7 @@ import os import sys +import pdb import pprint import inspect import __builtin__ @@ -40,7 +41,7 @@ class FILTER_TYPE: """ defines few filter constants - + - *INCLUDE* - *EXCLUDE* """ @@ -150,7 +151,7 @@ return False #do not check already imported modules if self.filter: try: - source_file = inspect.getsourcefile(obj) + source_file = self.getsourcefile(obj) if source_file is None: source_file = inspect.getfile( obj ) return self.filter.check( source_file ) @@ -170,14 +171,21 @@ return True return False - def import_( self, name, globals=None, locals=None, fromlist=None ): + def import_( self, name, globals=None, locals=None, fromlist=None, level=-1 ): """Hook to import functionality""" - pymodule = self.__orig_import( name, globals, locals, fromlist ) + pymodule = self.__orig_import( name, globals, locals, fromlist, level ) if self.should_be_checked(pymodule): self.__already_imported.add( name ) self.__check( pymodule ) return pymodule + @staticmethod + def getsourcefile( obj ): + try: + return inspect.getsourcefile( obj ) + except TypeError: + pass + def __check_text_impl( self, obj, text, text_type ): if not text: return @@ -194,9 +202,9 @@ if not errors: return write = self.writer.write - if inspect.getsourcefile( inspect.getmodule( obj ) ): + if self.getsourcefile( inspect.getmodule( obj ) ): write( ' error details: %s' % os.linesep ) - write( ' file : %s%s' % ( inspect.getsourcefile( inspect.getmodule( obj ) ), os.linesep ) ) + write( ' file : %s%s' % ( self.getsourcefile( inspect.getmodule( obj ) ), os.linesep ) ) write( ' line : %d%s' % ( inspect.getsourcelines( obj )[1], os.linesep ) ) write( ' text type : %s%s' % ( text_type, os.linesep ) ) else: @@ -208,8 +216,11 @@ def __check_text( self, obj): self.__check_text_impl( obj, inspect.getdoc( obj ), 'documentation string' ) - if inspect.getsourcefile( obj ): - self.__check_text_impl( obj, inspect.getcomments( obj ), 'comment' ) + try: + if self.getsourcefile( obj ): + self.__check_text_impl( obj, inspect.getcomments( obj ), 'comment' ) + except TypeError: + pass def __check( self, module ): self.__check_text( module ) @@ -227,6 +238,8 @@ if 'PYDSC' in os.environ: if not 'sphinx' in os.environ['PYDSC']: doc_checker = checker_t( checker.SpellChecker( "en_US" ) ) +else: + doc_checker = checker_t( checker.SpellChecker( "en_US" ) ) def exclude( what ): """ Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2009-02-03 20:06:54 UTC (rev 1656) +++ pygccxml_dev/unittests/autoconfig.py 2009-02-03 20:42:16 UTC (rev 1657) @@ -7,12 +7,17 @@ import sys import getpass + + #~ os.environ['PYCHECKER'] = '--limit=1000 -q --no-argsused' #~ import pychecker.checker this_module_dir_path = os.path.abspath ( os.path.dirname( sys.modules[__name__].__file__) ) +sys.path.append( os.path.abspath( os.path.join( this_module_dir_path, '..', '..', 'pydsc_dev' ) ) ) +#~ import pydsc + data_directory = os.path.join( this_module_dir_path, 'data' ) build_directory = os.path.join( this_module_dir_path, 'temp' ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |