Thread: [pygccxml-commit] SF.net SVN: pygccxml: [414] pydsc_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-08-16 18:31:05
|
Revision: 414 Author: roman_yakovenko Date: 2006-08-16 11:24:58 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=414&view=rev Log Message: ----------- replacing LF with CRLF Modified Paths: -------------- developer_scripts/clean_source_dir.py developer_scripts/file_system_iter.py pydsc_dev/setup.py pydsc_dev/unittests/tester.py pydsc_dev/unittests/to_be_tested.py pygccxml_dev/docs/apidocs/www_configuration.py pygccxml_dev/docs/download.rest pygccxml_dev/docs/example/example.py pygccxml_dev/docs/www_configuration.py pygccxml_dev/pygccxml/__init__.py pygccxml_dev/pygccxml/declarations/__init__.py pygccxml_dev/pygccxml/declarations/algorithm.py pygccxml_dev/pygccxml/declarations/call_invocation.py pygccxml_dev/pygccxml/declarations/calldef.py pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/cpptypes.py pygccxml_dev/pygccxml/declarations/decl_factory.py pygccxml_dev/pygccxml/declarations/decl_printer.py pygccxml_dev/pygccxml/declarations/decl_visitor.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/declarations/enumeration.py pygccxml_dev/pygccxml/declarations/filtering.py pygccxml_dev/pygccxml/declarations/matcher.py pygccxml_dev/pygccxml/declarations/matchers.py pygccxml_dev/pygccxml/declarations/mdecl_wrapper.py pygccxml_dev/pygccxml/declarations/namespace.py pygccxml_dev/pygccxml/declarations/pattern_parser.py pygccxml_dev/pygccxml/declarations/templates.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/declarations/type_visitor.py pygccxml_dev/pygccxml/declarations/typedef.py pygccxml_dev/pygccxml/declarations/variable.py pygccxml_dev/pygccxml/parser/__init__.py pygccxml_dev/pygccxml/parser/config.py pygccxml_dev/pygccxml/parser/declarations_cache.py pygccxml_dev/pygccxml/parser/directory_cache.py pygccxml_dev/pygccxml/parser/linker.py pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/parser/project_reader.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/pygccxml/utils/__init__.py pygccxml_dev/setup.py pygccxml_dev/unittests/autoconfig.py pygccxml_dev/unittests/bit_fields_tester.py pygccxml_dev/unittests/cache_enums_tester.py pygccxml_dev/unittests/cached_source_file_tester.py pygccxml_dev/unittests/call_invocation_tester.py pygccxml_dev/unittests/calldef_matcher_tester.py pygccxml_dev/unittests/complex_types_tester.py pygccxml_dev/unittests/core_tester.py pygccxml_dev/unittests/decl_printer_tester.py pygccxml_dev/unittests/declarations_cache_tester.py pygccxml_dev/unittests/declarations_tester.py pygccxml_dev/unittests/demangled_tester.py pygccxml_dev/unittests/file_cache_tester.py pygccxml_dev/unittests/filtering_tester.py pygccxml_dev/unittests/filters_tester.py pygccxml_dev/unittests/has_binary_operator_traits_tester.py pygccxml_dev/unittests/hierarchy_traveling.py pygccxml_dev/unittests/namespace_matcher_tester.py pygccxml_dev/unittests/parser_test_case.py pygccxml_dev/unittests/patcher_tester.py pygccxml_dev/unittests/profile_parser.py pygccxml_dev/unittests/start_with_declarations_tester.py pygccxml_dev/unittests/string_traits_tester.py pygccxml_dev/unittests/templates_tester.py pygccxml_dev/unittests/test_all.py pygccxml_dev/unittests/test_performance.py pygccxml_dev/unittests/timeit_test_parser.py pygccxml_dev/unittests/type_traits_tester.py pygccxml_dev/unittests/typedefs_tester.py pygccxml_dev/unittests/unnamed_classes_tester.py pygccxml_dev/unittests/unnamed_enums_bug_tester.py pygccxml_dev/unittests/variable_matcher_tester.py pygccxml_dev/unittests/vector_traits_tester.py pyplusplus_dev/contrib/arrayinfo/arrayinfo.py pyplusplus_dev/contrib/arrayinfo/cpptokenize.py pyplusplus_dev/contrib/arrayinfo/createarrayinfo.py pyplusplus_dev/contrib/pypp_api/generate_docs.py pyplusplus_dev/contrib/pypp_api/pypp_api/__init__.py pyplusplus_dev/contrib/pypp_api/pypp_api/argpolicy.py pyplusplus_dev/contrib/pypp_api/pypp_api/decltypes.py pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py pyplusplus_dev/contrib/pypp_api/pypp_api/modulebuilder.py pyplusplus_dev/contrib/pypp_api/pypp_api/selection.py pyplusplus_dev/contrib/pypp_api/pypp_api/treerange.py pyplusplus_dev/docs/comparisons/www_configuration.py pyplusplus_dev/docs/definition.rest pyplusplus_dev/docs/documentation/apidocs/www_configuration.py pyplusplus_dev/docs/documentation/www_configuration.py pyplusplus_dev/docs/download.rest pyplusplus_dev/docs/examples/boost/www_configuration.py pyplusplus_dev/docs/osdc2006/generate_docs.py pyplusplus_dev/docs/osdc2006/presentation-talk.rest pyplusplus_dev/docs/peps/www_configuration.py pyplusplus_dev/examples/custom_code_creator/generate_code.py pyplusplus_dev/examples/custom_code_creator/unittests/test_all.py pyplusplus_dev/examples/pyboost_dev/crc_example.py pyplusplus_dev/examples/pyboost_dev/date_time_example.py pyplusplus_dev/examples/pyboost_dev/dev/boost_random/random_settings.py pyplusplus_dev/examples/pyboost_dev/dev/crc/crc_settings.py pyplusplus_dev/examples/pyboost_dev/dev/crc/generate_code.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/customization_data.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/date_time_settings.py pyplusplus_dev/examples/pyboost_dev/dev/date_time/generate_code.py pyplusplus_dev/examples/pyboost_dev/dev/rational/generate_code.py pyplusplus_dev/examples/pyboost_dev/dev/rational/rational_settings.py pyplusplus_dev/examples/pyboost_dev/pyboost/__init__.py pyplusplus_dev/examples/pyboost_dev/pyboost/boost_random/__init__.py pyplusplus_dev/examples/pyboost_dev/pyboost/crc/__init__.py pyplusplus_dev/examples/pyboost_dev/pyboost/date_time/__init__.py pyplusplus_dev/examples/pyboost_dev/pyboost/rational/__init__.py pyplusplus_dev/examples/pyboost_dev/random_example.py pyplusplus_dev/examples/pyboost_dev/rational_example.py pyplusplus_dev/examples/pyboost_dev/unittestst/boost_random/test_all.py pyplusplus_dev/examples/pyboost_dev/unittestst/crc/test_all.py pyplusplus_dev/examples/pyboost_dev/unittestst/date_time/examples.py pyplusplus_dev/examples/pyboost_dev/unittestst/date_time/gregorian_tester.py pyplusplus_dev/examples/pyboost_dev/unittestst/date_time/local_time_tester.py pyplusplus_dev/examples/pyboost_dev/unittestst/date_time/posix_time_tester.py pyplusplus_dev/examples/pyboost_dev/unittestst/date_time/test_all.py pyplusplus_dev/examples/pyboost_dev/unittestst/rational/test_all.py pyplusplus_dev/examples/pyboost_dev/unittestst/test_all.py pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/build_setup.py pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/environment.py pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/generate_code.py pyplusplus_dev/examples/pyeasybmp_dev/unittests/grayscale.py pyplusplus_dev/pyplusplus/__init__.py pyplusplus_dev/pyplusplus/_logging_/__init__.py pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py pyplusplus_dev/pyplusplus/code_creators/__init__.py pyplusplus_dev/pyplusplus/code_creators/algorithm.py pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/code_creators/code_creator.py pyplusplus_dev/pyplusplus/code_creators/compound.py pyplusplus_dev/pyplusplus/code_creators/custom.py pyplusplus_dev/pyplusplus/code_creators/declaration_based.py pyplusplus_dev/pyplusplus/code_creators/enum.py pyplusplus_dev/pyplusplus/code_creators/global_variable.py pyplusplus_dev/pyplusplus/code_creators/include.py pyplusplus_dev/pyplusplus/code_creators/include_directories.py pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py pyplusplus_dev/pyplusplus/code_creators/instruction.py pyplusplus_dev/pyplusplus/code_creators/license.py pyplusplus_dev/pyplusplus/code_creators/member_variable.py pyplusplus_dev/pyplusplus/code_creators/module.py pyplusplus_dev/pyplusplus/code_creators/module_body.py pyplusplus_dev/pyplusplus/code_creators/namespace.py pyplusplus_dev/pyplusplus/code_creators/scoped.py pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py pyplusplus_dev/pyplusplus/code_creators/target_configuration.py pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py pyplusplus_dev/pyplusplus/code_repository/__init__.py pyplusplus_dev/pyplusplus/code_repository/array_1.py pyplusplus_dev/pyplusplus/decl_wrappers/__init__.py pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper_printer.py pyplusplus_dev/pyplusplus/decl_wrappers/enumeration_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py pyplusplus_dev/pyplusplus/decl_wrappers/namespace_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/user_text.py pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py pyplusplus_dev/pyplusplus/file_writers/__init__.py pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py pyplusplus_dev/pyplusplus/file_writers/multiple_files.py pyplusplus_dev/pyplusplus/file_writers/single_file.py pyplusplus_dev/pyplusplus/file_writers/writer.py pyplusplus_dev/pyplusplus/gui/__init__.py pyplusplus_dev/pyplusplus/gui/freeze.py pyplusplus_dev/pyplusplus/gui/ui.py pyplusplus_dev/pyplusplus/gui/ui_runner.py pyplusplus_dev/pyplusplus/gui/wizard.py pyplusplus_dev/pyplusplus/module_builder/__init__.py pyplusplus_dev/pyplusplus/module_builder/builder.py pyplusplus_dev/pyplusplus/module_builder/call_policies.py pyplusplus_dev/pyplusplus/module_creator/__init__.py pyplusplus_dev/pyplusplus/module_creator/call_policies_resolver.py pyplusplus_dev/pyplusplus/module_creator/class_organizer.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/pyplusplus/module_creator/types_database.py pyplusplus_dev/pyplusplus/utils/__init__.py pyplusplus_dev/setup.py pyplusplus_dev/tutorials/module_builder/generate_code.py pyplusplus_dev/unittests/__init__.py pyplusplus_dev/unittests/abstract_classes_tester.py pyplusplus_dev/unittests/abstract_tester.py pyplusplus_dev/unittests/algorithms_tester.py pyplusplus_dev/unittests/autoconfig.py pyplusplus_dev/unittests/call_policies_tester.py pyplusplus_dev/unittests/casting_tester.py pyplusplus_dev/unittests/class_order2_tester.py pyplusplus_dev/unittests/class_order3_tester.py pyplusplus_dev/unittests/class_order4_tester.py pyplusplus_dev/unittests/class_order_tester.py pyplusplus_dev/unittests/classes_tester.py pyplusplus_dev/unittests/cppexceptions_tester.py pyplusplus_dev/unittests/default_args_tester.py pyplusplus_dev/unittests/dwrapper_printer_tester.py pyplusplus_dev/unittests/enums_tester.py pyplusplus_dev/unittests/factory_tester.py pyplusplus_dev/unittests/finalizables_tester.py pyplusplus_dev/unittests/free_function_ignore_bug_tester.py pyplusplus_dev/unittests/free_functions_tester.py pyplusplus_dev/unittests/free_operators_tester.py pyplusplus_dev/unittests/fundamental_tester_base.py pyplusplus_dev/unittests/global_variables_tester.py pyplusplus_dev/unittests/gui_tester.py pyplusplus_dev/unittests/gui_wizard_tester.py pyplusplus_dev/unittests/hierarchy3_tester.py pyplusplus_dev/unittests/index_operator_tester.py pyplusplus_dev/unittests/indexing_suites2_tester.py pyplusplus_dev/unittests/indexing_suites_tester.py pyplusplus_dev/unittests/internal_classes_tester.py pyplusplus_dev/unittests/mdecl_wrapper_tester.py pyplusplus_dev/unittests/mem_fun_with_exception_tester.py pyplusplus_dev/unittests/member_functions_tester.py pyplusplus_dev/unittests/member_variables_tester.py pyplusplus_dev/unittests/module_body_tester.py pyplusplus_dev/unittests/module_properties_tester.py pyplusplus_dev/unittests/namespaces_tester.py pyplusplus_dev/unittests/noncopyable_tester.py pyplusplus_dev/unittests/operators_bug_tester.py pyplusplus_dev/unittests/operators_tester.py pyplusplus_dev/unittests/optional_bug_tester.py pyplusplus_dev/unittests/optional_tester.py pyplusplus_dev/unittests/pointer_as_arg_tester.py pyplusplus_dev/unittests/pointer_to_function_as_argument.py pyplusplus_dev/unittests/private_assign_tester.py pyplusplus_dev/unittests/protected_tester.py pyplusplus_dev/unittests/recursive_tester.py pyplusplus_dev/unittests/regression1_tester.py pyplusplus_dev/unittests/regression2_tester.py pyplusplus_dev/unittests/regression3_tester.py pyplusplus_dev/unittests/smart_pointers_tester.py pyplusplus_dev/unittests/special_operators_tester.py pyplusplus_dev/unittests/statics_tester.py pyplusplus_dev/unittests/temporary_variable_tester.py pyplusplus_dev/unittests/test_all.py pyplusplus_dev/unittests/tnfox_bugs_tester.py pyplusplus_dev/unittests/unnamed_classes_tester.py pyplusplus_dev/unittests/unnamed_enums_tester.py pyplusplus_dev/unittests/user_text_tester.py pyplusplus_dev/unittests/vector3_tester.py Modified: developer_scripts/clean_source_dir.py =================================================================== --- developer_scripts/clean_source_dir.py 2006-08-16 12:44:41 UTC (rev 413) +++ developer_scripts/clean_source_dir.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,25 +1,25 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -from file_system_iter import files_iterator, folders_iterator - -to_be_deleted_file_exts = [ - '*.pyc' - , '*.py~' - , '*.so' - , '*.os' - , '*.cpp~' - , '*.hpp~' - , '*.dll' - , '*.obj' - , '*.a' - , '*.def' - , '*.exp' - , '*.lib' - , '*.scons' +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +from file_system_iter import files_iterator, folders_iterator + +to_be_deleted_file_exts = [ + '*.pyc' + , '*.py~' + , '*.so' + , '*.os' + , '*.cpp~' + , '*.hpp~' + , '*.dll' + , '*.obj' + , '*.a' + , '*.def' + , '*.exp' + , '*.lib' + , '*.scons' , '*.bak' , '*.pdb' , '*.htm' @@ -27,19 +27,19 @@ , '*.pdb' , '*.dat' , '*.ncb' -] - -to_be_deleted_files = [ '.sconsign' ] - -if __name__ == '__main__': - sources_dir = os.path.join( os.path.abspath( os.curdir ), '..' ) - - for file in files_iterator( sources_dir, to_be_deleted_file_exts ): - print 'removing : ', file - os.remove( file ) - - for file in files_iterator( sources_dir ): - if os.path.split( file )[1] in to_be_deleted_files: - print 'removing : ', file - os.remove( file ) +] + +to_be_deleted_files = [ '.sconsign' ] + +if __name__ == '__main__': + sources_dir = os.path.join( os.path.abspath( os.curdir ), '..' ) + for file in files_iterator( sources_dir, to_be_deleted_file_exts ): + print 'removing : ', file + os.remove( file ) + + for file in files_iterator( sources_dir ): + if os.path.split( file )[1] in to_be_deleted_files: + print 'removing : ', file + os.remove( file ) + \ No newline at end of file Modified: developer_scripts/file_system_iter.py =================================================================== --- developer_scripts/file_system_iter.py 2006-08-16 12:44:41 UTC (rev 413) +++ developer_scripts/file_system_iter.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,141 +1,141 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -from types import * - -##If you want include files that doesn't have extension then use filter like '*.' - -def _make_list( argument ): - if type(argument) in StringTypes: - if argument: - return [argument] - else: - return [] - elif type(argument) is ListType: - return argument - else: - raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument ) - -class base_files_iterator: - def __init__(self, file_exts, is_include_exts = True): - self.__file_exts = _make_list( file_exts ) - self.__is_include_exts = is_include_exts - - def _is_to_skip(self, file_path): - if not self.__file_exts: - return 0 - file_ext = os.path.splitext( file_path )[1] - if not file_ext: - file_ext = '.' + file_ext - file_ext = '*' + file_ext - if file_ext.lower() in self.__file_exts: - return not self.__is_include_exts - else: - return self.__is_include_exts - - def _subfolders_and_files(self, folder_path): - files, folders = [], [] - folder_contents = os.listdir(folder_path) - for object_name in folder_contents: - object_path = os.path.join(folder_path, object_name) - if os.path.isfile( object_path ) and not self._is_to_skip( object_path ): - files.append( object_path ) - elif os.path.isdir( object_path ): - folders.append( object_path ) - else: - pass - return folders, files - - def __iter__(self): - raise NotImplementedError - - def next(self): - raise NotImplementedError - - def restart(self): - raise NotImplementedError - -class files_iterator_generator(base_files_iterator): - def __init__(self, folders, file_ext_filter = '', is_include_filter = True, is_recursive = True): - base_files_iterator.__init__(self, file_ext_filter, is_include_filter) - self.__folders = _make_list( folders ) - self.__is_recursive = is_recursive - self.__file_generator = None - - def __walk(self): - folders = self.__folders[:] - while folders: - sub_folders, files = self._subfolders_and_files( folders.pop(0) ) - if self.__is_recursive: - for folder in sub_folders: - folders.append( folder ) - for file_os in files: - yield file_os - - def __iter__(self): - self.__file_generator = self.__walk() - return self - - def next(self): - return self.__file_generator.next() - - def restart(self): - self.__file_generator = None - - -class folders_iterator_generator: - def __init__(self, folders, is_recursive = 1): - self.__folders = [] - for root in _make_list( folders ): - self.__folders.extend( self.__sub_folders( root ) ) - self.__is_recursive = is_recursive - self.__folder_generator = None - - def __sub_folders(self, folder_path): - sub_folders = [] - folder_contains = os.listdir(folder_path) - for object_in_folder in folder_contains: - full_path = os.path.join(folder_path, object_in_folder) - if os.path.isdir( full_path ): - sub_folders.append( full_path ) - return sub_folders - - def __walk(self): - folders = self.__folders[:] - for curr_folder in folders: - yield curr_folder - if self.__is_recursive: - for f in folders_iterator_generator( [curr_folder], True ): - yield f - - def __iter__(self): - self.__folder_generator = self.__walk() - return self - - def next(self): - return self.__folder_generator.next() - - def restart(self): - self.__folder_generator = None - -#preserving backward computability names -file_iter = files_iterator_generator -folder_iter = folders_iterator_generator -#new names -files_iterator = files_iterator_generator -folders_iterator = folders_iterator_generator - -if '__main__' == __name__: - #lFileCount = 0 - #for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False): - #print file_os - #lFileCount += 1 - #print lFileCount - - for folder in folders_iterator( '/home/roman/language-binding', False ): - print folder - for folder in folders_iterator( '/home/roman/language-binding', True ): +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +from types import * + +##If you want include files that doesn't have extension then use filter like '*.' + +def _make_list( argument ): + if type(argument) in StringTypes: + if argument: + return [argument] + else: + return [] + elif type(argument) is ListType: + return argument + else: + raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument ) + +class base_files_iterator: + def __init__(self, file_exts, is_include_exts = True): + self.__file_exts = _make_list( file_exts ) + self.__is_include_exts = is_include_exts + + def _is_to_skip(self, file_path): + if not self.__file_exts: + return 0 + file_ext = os.path.splitext( file_path )[1] + if not file_ext: + file_ext = '.' + file_ext + file_ext = '*' + file_ext + if file_ext.lower() in self.__file_exts: + return not self.__is_include_exts + else: + return self.__is_include_exts + + def _subfolders_and_files(self, folder_path): + files, folders = [], [] + folder_contents = os.listdir(folder_path) + for object_name in folder_contents: + object_path = os.path.join(folder_path, object_name) + if os.path.isfile( object_path ) and not self._is_to_skip( object_path ): + files.append( object_path ) + elif os.path.isdir( object_path ): + folders.append( object_path ) + else: + pass + return folders, files + + def __iter__(self): + raise NotImplementedError + + def next(self): + raise NotImplementedError + + def restart(self): + raise NotImplementedError + +class files_iterator_generator(base_files_iterator): + def __init__(self, folders, file_ext_filter = '', is_include_filter = True, is_recursive = True): + base_files_iterator.__init__(self, file_ext_filter, is_include_filter) + self.__folders = _make_list( folders ) + self.__is_recursive = is_recursive + self.__file_generator = None + + def __walk(self): + folders = self.__folders[:] + while folders: + sub_folders, files = self._subfolders_and_files( folders.pop(0) ) + if self.__is_recursive: + for folder in sub_folders: + folders.append( folder ) + for file_os in files: + yield file_os + + def __iter__(self): + self.__file_generator = self.__walk() + return self + + def next(self): + return self.__file_generator.next() + + def restart(self): + self.__file_generator = None + + +class folders_iterator_generator: + def __init__(self, folders, is_recursive = 1): + self.__folders = [] + for root in _make_list( folders ): + self.__folders.extend( self.__sub_folders( root ) ) + self.__is_recursive = is_recursive + self.__folder_generator = None + + def __sub_folders(self, folder_path): + sub_folders = [] + folder_contains = os.listdir(folder_path) + for object_in_folder in folder_contains: + full_path = os.path.join(folder_path, object_in_folder) + if os.path.isdir( full_path ): + sub_folders.append( full_path ) + return sub_folders + + def __walk(self): + folders = self.__folders[:] + for curr_folder in folders: + yield curr_folder + if self.__is_recursive: + for f in folders_iterator_generator( [curr_folder], True ): + yield f + + def __iter__(self): + self.__folder_generator = self.__walk() + return self + + def next(self): + return self.__folder_generator.next() + + def restart(self): + self.__folder_generator = None + +#preserving backward computability names +file_iter = files_iterator_generator +folder_iter = folders_iterator_generator +#new names +files_iterator = files_iterator_generator +folders_iterator = folders_iterator_generator + +if '__main__' == __name__: + #lFileCount = 0 + #for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False): + #print file_os + #lFileCount += 1 + #print lFileCount + + for folder in folders_iterator( '/home/roman/language-binding', False ): + print folder + for folder in folders_iterator( '/home/roman/language-binding', True ): print folder \ No newline at end of file Modified: pydsc_dev/setup.py =================================================================== --- pydsc_dev/setup.py 2006-08-16 12:44:41 UTC (rev 413) +++ pydsc_dev/setup.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,16 +1,16 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -from distutils import sysconfig -from distutils.core import setup - -setup( name="pydsc" - , description="Python documentation and comments spell checker" - , author="Roman Yakovenko" - , author_email="rom...@gm..." - , url='http://pygccxml.sourceforge.net' - , py_modules=[ 'pydsc' ] -) +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +from distutils import sysconfig +from distutils.core import setup + +setup( name="pydsc" + , description="Python documentation and comments spell checker" + , author="Roman Yakovenko" + , author_email="rom...@gm..." + , url='http://pygccxml.sourceforge.net' + , py_modules=[ 'pydsc' ] +) \ No newline at end of file Modified: pydsc_dev/unittests/tester.py =================================================================== --- pydsc_dev/unittests/tester.py 2006-08-16 12:44:41 UTC (rev 413) +++ pydsc_dev/unittests/tester.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,7 +1,7 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import pydsc -import to_be_tested +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import pydsc +import to_be_tested \ No newline at end of file Modified: pydsc_dev/unittests/to_be_tested.py =================================================================== --- pydsc_dev/unittests/to_be_tested.py 2006-08-16 12:44:41 UTC (rev 413) +++ pydsc_dev/unittests/to_be_tested.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,107 +1,107 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import types - -class code_creator_t(object): - """ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import types + +class code_creator_t(object): + """ code_creator_t is the base class for all code creators. This class defines interface that every code creator should implement. - Also it provides few convinience functions. - """ - PYPLUSPLUS_NS_NAME = 'pyplusplus' - __INDENTATION = ' ' - LINE_LENGTH = 80 - def __init__(self, parent=None): + Also it provides few convinience functions. + """ + PYPLUSPLUS_NS_NAME = 'pyplusplus' + __INDENTATION = ' ' + LINE_LENGTH = 80 + def __init__(self, parent=None): object.__init__(self) if parent: - assert isinstance( parent, code_creator_t ) - self._parent = parent - self._target_configuration = None - - def _get_parent( self ): - return self._parent + assert isinstance( parent, code_creator_t ) + self._parent = parent + self._target_configuration = None + + def _get_parent( self ): + return self._parent def _set_parent( self, new_parent ): if new_parent: - assert isinstance( new_parent, code_creator_t ) - self._parent = new_parent - """parent - reference to parent code creator""" - parent = property( _get_parent, _set_parent ) - - def _get_target_configuration( self ): - return self._target_configuration - def _set_target_configuration( self, config ): - self._target_configuration = config - """target_configuration - reference to target_configuration_t class instance""" - target_configuration = property( _get_target_configuration, _set_target_configuration ) - - def _get_top_parent(self): - parent = self.parent - me = self - while True: - if not parent: - return me - else: - me = parent - parent = me.parent - """top_parent - reference to top parent code creator""" - top_parent = property( _get_top_parent ) - - def _create_impl(self): - """ - function that all derived classes should implement. This function - actually creates code and returns it. Return value of this function is - string. - """ - raise NotImplementedError() - - def create(self): - """ - this function should be used in order to get code that should be - generated. - """ - code = self._create_impl() - assert isinstance( code, types.StringTypes ) - return self.beautify( code ) - - def beautify( self, code ): - """ - function that returns code without leading and trailing whitespaces. - """ - assert isinstance( code, types.StringTypes ) - return code.strip() - - @staticmethod - def indent( code, size=1 ): - """ - function that implements code indent algorithm. - """ - assert isinstance( code, types.StringTypes ) - return code_creator_t.__INDENTATION * size\ - + code.replace( os.linesep - , os.linesep + code_creator_t.__INDENTATION * size ) - - @staticmethod - def unindent( code ): - """ - function that implements code unindent algorithm. - """ - assert isinstance( code, types.StringTypes ) - if code.startswith(code_creator_t.__INDENTATION): - code = code[ len( code_creator_t.__INDENTATION ):] - return code.replace( os.linesep + code_creator_t.__INDENTATION - , os.linesep ) + assert isinstance( new_parent, code_creator_t ) + self._parent = new_parent + """parent - reference to parent code creator""" + parent = property( _get_parent, _set_parent ) + + def _get_target_configuration( self ): + return self._target_configuration + def _set_target_configuration( self, config ): + self._target_configuration = config + """target_configuration - reference to target_configuration_t class instance""" + target_configuration = property( _get_target_configuration, _set_target_configuration ) + + def _get_top_parent(self): + parent = self.parent + me = self + while True: + if not parent: + return me + else: + me = parent + parent = me.parent + """top_parent - reference to top parent code creator""" + top_parent = property( _get_top_parent ) - @staticmethod - def is_comment( line ): - """ - function that returns true if content of the line is comment, otherwise - false. + def _create_impl(self): """ - assert isinstance( line, types.StringTypes ) + function that all derived classes should implement. This function + actually creates code and returns it. Return value of this function is + string. + """ + raise NotImplementedError() + + def create(self): + """ + this function should be used in order to get code that should be + generated. + """ + code = self._create_impl() + assert isinstance( code, types.StringTypes ) + return self.beautify( code ) + + def beautify( self, code ): + """ + function that returns code without leading and trailing whitespaces. + """ + assert isinstance( code, types.StringTypes ) + return code.strip() + + @staticmethod + def indent( code, size=1 ): + """ + function that implements code indent algorithm. + """ + assert isinstance( code, types.StringTypes ) + return code_creator_t.__INDENTATION * size\ + + code.replace( os.linesep + , os.linesep + code_creator_t.__INDENTATION * size ) + + @staticmethod + def unindent( code ): + """ + function that implements code unindent algorithm. + """ + assert isinstance( code, types.StringTypes ) + if code.startswith(code_creator_t.__INDENTATION): + code = code[ len( code_creator_t.__INDENTATION ):] + return code.replace( os.linesep + code_creator_t.__INDENTATION + , os.linesep ) + + @staticmethod + def is_comment( line ): + """ + function that returns true if content of the line is comment, otherwise + false. + """ + assert isinstance( line, types.StringTypes ) l = line.lstrip() - #1q2w3e4r-------------- - return l.startswith( '//' ) or l.startswith( '/*' ) + #1q2w3e4r-------------- + return l.startswith( '//' ) or l.startswith( '/*' ) \ No newline at end of file Modified: pygccxml_dev/docs/apidocs/www_configuration.py =================================================================== --- pygccxml_dev/docs/apidocs/www_configuration.py 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/docs/apidocs/www_configuration.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,2 +1,2 @@ -name = 'API docs' +name = 'API docs' main_html_file = 'index.html' \ No newline at end of file Modified: pygccxml_dev/docs/download.rest =================================================================== --- pygccxml_dev/docs/download.rest 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/docs/download.rest 2006-08-16 18:24:58 UTC (rev 414) @@ -1,56 +1,56 @@ -================= -pygccxml download -================= - -.. contents:: Table of contents - -------------------------- -pygccxml on SourceForge -------------------------- - -`pygccxml`_ project is hosted on SourceForge. Using SourceForge services you -can: - -1) get access to source code -2) get access to latest release version of `pygccxml`_ +================= +pygccxml download +================= +.. contents:: Table of contents +------------------------- +pygccxml on SourceForge +------------------------- + +`pygccxml`_ project is hosted on SourceForge. Using SourceForge services you +can: + +1) get access to source code +2) get access to latest release version of `pygccxml`_ + + ----------------- Subversion access ----------------- http://sourceforge.net/svn/?group_id=118209 - --------- -Download --------- - -https://sourceforge.net/project/showfiles.php?group_id=118209 - ------------- -Installation ------------- - -In command prompt or shell change current directory to be "pygccxml-X.Y.Z". -"X.Y.Z" is version of `pygccxml`_. Type next command: - -| ``python setup.py install`` - -After this command complete, you should have installed `pygccxml`_ package. - ------------- -Dependencies ------------- - -* `GCC-XML`_ - -.. _`pygccxml` : ./../pygccxml/pygccxml.html -.. _`GCC-XML`: http://www.gccxml.org -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - End: +-------- +Download +-------- + +https://sourceforge.net/project/showfiles.php?group_id=118209 + +------------ +Installation +------------ + +In command prompt or shell change current directory to be "pygccxml-X.Y.Z". +"X.Y.Z" is version of `pygccxml`_. Type next command: + +| ``python setup.py install`` + +After this command complete, you should have installed `pygccxml`_ package. + +------------ +Dependencies +------------ + +* `GCC-XML`_ + +.. _`pygccxml` : ./../pygccxml/pygccxml.html +.. _`GCC-XML`: http://www.gccxml.org + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: \ No newline at end of file Modified: pygccxml_dev/docs/example/example.py =================================================================== --- pygccxml_dev/docs/example/example.py 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/docs/example/example.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,26 +1,26 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import sys -sys.path.append('../..') #adding pygccxml to the path - -from pygccxml import parser -from pygccxml import declarations - -#configure GCC-XML parser -config = parser.config_t( gccxml_path='/home/roman/gccxml-build/bin/gccxml' ) - -#parsing source file -decls = parser.parse( ['core_class_hierarchy.hpp'], config ) -global_ns = declarations.get_global_namespace( decls ) - -#printing all declarations found in file and its includes -declarations.print_declarations( global_ns ) - -#print all base and derived class names -for class_ in global_ns.classes(): +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import sys +sys.path.append('../..') #adding pygccxml to the path + +from pygccxml import parser +from pygccxml import declarations + +#configure GCC-XML parser +config = parser.config_t( gccxml_path='/home/roman/gccxml-build/bin/gccxml' ) + +#parsing source file +decls = parser.parse( ['core_class_hierarchy.hpp'], config ) +global_ns = declarations.get_global_namespace( decls ) + +#printing all declarations found in file and its includes +declarations.print_declarations( global_ns ) + +#print all base and derived class names +for class_ in global_ns.classes(): print class_.name print '\tbases: ', `[base.related_class.name for base in class_.bases]` - print '\tderived: ', `[derive.related_class.name for derive in class_.derived]` + print '\tderived: ', `[derive.related_class.name for derive in class_.derived]` \ No newline at end of file Modified: pygccxml_dev/docs/www_configuration.py =================================================================== --- pygccxml_dev/docs/www_configuration.py 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/docs/www_configuration.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,3 +1,3 @@ -name = 'pygccxml' +name = 'pygccxml' files_to_skip = ['definition.rest'] names = { 'query_interface' : 'query interface' } \ No newline at end of file Modified: pygccxml_dev/pygccxml/__init__.py =================================================================== --- pygccxml_dev/pygccxml/__init__.py 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/pygccxml/__init__.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,38 +1,38 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""Python GCC-XML front end. - -This package provides functionality to extract and inspect -declarations from C/C++ header files. This is accomplished -by invoking the external tool U{gccxml<http://www.gccxml.org/>} -which parses a header file and dumps the declarations as a -XML file. This XML file is then read by pygccxml and the contents -are made available as appropriate Python objects. - -To parse a set of C/C++ header files you use the -L{parse()<parser.parse>} function in the L{parser} sub package which -returns a tree that contains all declarations found in the header -files. The root of the tree represents the main namespace C{::} and -the children nodes represent the namespace contents such as other -namespaces, classes, functions, etc. Each node in the tree is an -object of a type derived from the -L{declaration_t<declarations.declaration_t>} base class. An inner -node is always either a namespace (L{namespace_t<declarations.namespace_t>}) -or a class (L{class_t<declarations.class_t>}) which are both derived -from L{scopedef_t<declarations.scopedef_t>}. Everything else (free functions, -member functions, enumerations, variables, etc.) is always a leaf. -You will find all those declaration classes in the L{declarations} -sub-package. - -""" - -import pygccxml.declarations as declarations -import pygccxml.parser as parser -import pygccxml.utils as utils - -#TODO: -# 1. Write documentation for filtering functionality. -# 2. Add "explicit" property for constructors +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""Python GCC-XML front end. + +This package provides functionality to extract and inspect +declarations from C/C++ header files. This is accomplished +by invoking the external tool U{gccxml<http://www.gccxml.org/>} +which parses a header file and dumps the declarations as a +XML file. This XML file is then read by pygccxml and the contents +are made available as appropriate Python objects. + +To parse a set of C/C++ header files you use the +L{parse()<parser.parse>} function in the L{parser} sub package which +returns a tree that contains all declarations found in the header +files. The root of the tree represents the main namespace C{::} and +the children nodes represent the namespace contents such as other +namespaces, classes, functions, etc. Each node in the tree is an +object of a type derived from the +L{declaration_t<declarations.declaration_t>} base class. An inner +node is always either a namespace (L{namespace_t<declarations.namespace_t>}) +or a class (L{class_t<declarations.class_t>}) which are both derived +from L{scopedef_t<declarations.scopedef_t>}. Everything else (free functions, +member functions, enumerations, variables, etc.) is always a leaf. +You will find all those declaration classes in the L{declarations} +sub-package. + +""" + +import pygccxml.declarations as declarations +import pygccxml.parser as parser +import pygccxml.utils as utils + +#TODO: +# 1. Write documentation for filtering functionality. +# 2. Add "explicit" property for constructors \ No newline at end of file Modified: pygccxml_dev/pygccxml/declarations/__init__.py =================================================================== --- pygccxml_dev/pygccxml/declarations/__init__.py 2006-08-16 12:44:41 UTC (rev 413) +++ pygccxml_dev/pygccxml/declarations/__init__.py 2006-08-16 18:24:58 UTC (rev 414) @@ -1,163 +1,163 @@ -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -contains classes that describe different C++ declarations -""" - -from declaration import location_t -from declaration import declaration_t -from scopedef import scopedef_t -from enumeration import enumeration_t -from namespace import namespace_t - -from class_declaration import class_t -from class_declaration import CLASS_TYPES -from class_declaration import ACCESS_TYPES -from class_declaration import hierarchy_info_t -from class_declaration import class_declaration_t - -from typedef import typedef_t - -from cpptypes import type_t -from cpptypes import dummy_type_t -from cpptypes import unknown_t -from cpptypes import fundamental_t -from cpptypes import void_t -from cpptypes import char_t -from cpptypes import unsigned_char_t -from cpptypes import wchar_t -from cpptypes import short_int_t -from cpptypes import short_unsigned_int_t -from cpptypes import bool_t -from cpptypes import int_t -from cpptypes import unsigned_int_t -from cpptypes import long_int_t -from cpptypes import long_unsigned_int_t -from cpptypes import long_long_int_t -from cpptypes import long_long_unsigned_int_t -from cpptypes import float_t -from cpptypes import double_t -from cpptypes import long_double_t -from cpptypes import FUNDAMENTAL_TYPES -from cpptypes import compound_t -from cpptypes import volatile_t -from cpptypes import const_t -from cpptypes import pointer_t -from cpptypes import reference_t -from cpptypes import array_t -from cpptypes import calldef_type_t -from cpptypes import free_function_type_t -from cpptypes import member_function_type_t -from cpptypes import member_variable_type_t -from cpptypes import declarated_t -from cpptypes import type_qualifiers_t -#java types -from cpptypes import java_fundamental_t -from cpptypes import jbyte_t -from cpptypes import jshort_t -from cpptypes import jint_t -from cpptypes import jlong_t -from cpptypes import jfloat_t -from cpptypes import jdouble_t -from cpptypes import jchar_t -from cpptypes import jboolean_t - - - -from variable import variable_t - -from algorithm import full_name -from algorithm import make_flatten -from algorithm import apply_visitor -from algorithm import declaration_path -from algorithm import find_declaration -from algorithm import match_declaration_t -from algorithm import find_all_declarations -from algorithm import find_first_declaration -from algorithm import declaration_files -from algorithm import visit_function_has_not_been_found_t -from algorithm import get_global_namespace - -from calldef import VIRTUALITY_TYPES -from calldef import FUNCTION_VIRTUALITY_TYPES -from calldef import argument_t -from calldef import calldef_t -from calldef import member_calldef_t -from calldef import free_calldef_t -from calldef import operator_t -from calldef import member_function_t -from calldef import constructor_t -from calldef import destructor_t -from calldef import member_operator_t -from calldef import casting_operator_t -from calldef import free_function_t -from calldef import free_operator_t - -from decl_visitor import decl_visitor_t -from type_visitor import type_visitor_t - -from type_traits import decompose_type -from type_traits import decompose_class - - -from type_traits import is_enum -from type_traits import enum_declaration -from type_traits import enum_traits - -from type_traits import is_class -from type_traits import class_traits -from type_traits import is_class_declaration -from type_traits import class_declaration_traits - - -from type_traits import is_same -from type_traits import is_void -from type_traits import is_void_pointer -from type_traits import is_const -from type_traits import base_type -from type_traits import is_array -from type_traits import is_pointer -from type_traits import is_volatile -from type_traits import is_integral -from type_traits import is_reference -from type_traits import is_arithmetic -from type_traits import is_fundamental -from type_traits import is_floating_point -from type_traits import is_base_and_derived -from type_traits import is_convertible -from type_traits import is_noncopyable +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +contains classes that describe different C++ declarations +""" + +from declaration import location_t +from declaration import declaration_t +from scopedef import scopedef_t +from enumeration import enumeration_t +from namespace import namespace_t + +from class_declaration import class_t +from class_declaration import CLASS_TYPES +from class_declaration import ACCESS_TYPES +from class_declaration import hierarchy_info_t +from class_declaration import class_declaration_t + +from typedef import typedef_t + +from cpptypes import type_t +from cpptypes import dummy_type_t +from cpptypes import unknown_t +from cpptypes import fundamental_t +from cpptypes import void_t +from cpptypes import char_t +from cpptypes import unsigned_char_t +from cpptypes import wchar_t +from cpptypes import short_int_t +from cpptypes import short_unsigned_int_t +from cpptypes import bool_t +from cpptypes import int_t +from cpptypes import unsigned_int_t +from cpptypes import long_int_t +from cpptypes import long_unsigned_int_t +from cpptypes import long_long_int_t +from cpptypes import long_long_unsigned_int_t +from cpptypes import float_t +from cpptypes import double_t +from cpptypes import long_double_t +from cpptypes import FUNDAMENTAL_TYPES +from cpptypes import compound_t +from cpptypes import volatile_t +from cpptypes import const_t +from cpptypes import pointer_t +from cpptypes import reference_t +from cpptypes import array_t +from cpptypes import calldef_type_t +from cpptypes import free_function_type_t +from cpptypes import member_function_type_t +from cpptypes import member_variable_type_t +from cpptypes import declarated_t +from cpptypes import type_qualifiers_t +#java types +from cpptypes import java_fundamental_t +from cpptypes import jbyte_t +from cpptypes import jshort_t +from cpptypes import jint_t +from cpptypes import jlong_t +from cpptypes import jfloat_t +from cpptypes import jdouble_t +from cpptypes import jchar_t +from cpptypes import jboolean_t + + + +from variable import variable_t + +from algorithm import full_name +from algorithm import make_flatten +from algorithm import apply_visitor +from algorithm import declaration_path +from algorithm import find_declaration +from algorithm import match_declaration_t +from algorithm import find_all_declarations +from algorithm import find_first_declaration +from algorithm import declaration_files +from algorithm import visit_function_has_not_been_found_t +from algorithm import get_global_namespace + +from calldef import VIRTUALITY_TYPES +from calldef import FUNCTION_VIRTUALITY_TYPES +from calldef import argument_t +from calldef import calldef_t +from calldef import member_calldef_t +from calldef import free_calldef_t +from calldef import operator_t +from calldef import member_function_t +from calldef import constructor_t +from calldef import destructor_t +from calldef import member_operator_t +from calldef import casting_operator_t +from calldef import free_function_t +from calldef import free_operator_t + +from decl_visitor import decl_visitor_t +from type_visitor import type_visitor_t + +from type_traits import decompose_type +from type_traits import decompose_class + + +from type_traits import is_enum +from type_traits import enum_declaration +from type_traits import enum_traits + +from type_traits import is_class +from type_traits import class_traits +from type_traits import is_class_declaration +from type_traits import class_declaration_traits + + +from type_traits import is_same +from type_traits import is_void +from type_traits import is_void_pointer +from type_traits import is_const +from type_traits import base_type +from type_traits import is_array +from type_traits import is_pointer +from type_traits import is_volatile +from type_traits import is_integral +from type_traits import is_reference +from type_traits import is_arithmetic +from type_traits import is_fundamental +from type_traits import is_floating_point +from type_traits import is_base_and_derived +from type_traits import is_convertible +from type_traits import is_noncopyable from type_traits import is_std_string from type_traits import is_std_wstring - -from type_traits import is_unary_operator -from type_traits import is_binary_operator - -from type_traits import array_size -from type_traits import array_item_type - -from type_traits import remove_cv -from type_traits import remove_const -from type_traits import remove_alias -from type_traits import remove_pointer -from type_traits import remove_volatile -from type_traits import remove_reference -from type_traits import remove_declarated - -from type_traits import has_destructor -from type_traits import has_public_less -from type_traits import has_trivial_copy -from type_traits import has_public_equal -from type_traits import has_public_assign -from type_traits import has_public_destructor -from type_traits import has_public_constructor -from type_traits import has_trivial_constructor -from type_traits import find_trivial_constructor -from type_traits import has_public_binary_operator -from type_traits import has_any_non_copyconstructor +from type_traits import is_unary_operator +from type_traits import is_binary_operator + +from type_traits import array_size +from type_traits import array_item_type + +from type_traits import remove_cv +from type_traits import remove_const +from type_traits import remove_alias +from type_traits import remove_pointer +from type_traits import remove_volatile +from type_traits import remove_reference +from type_traits import remove_declarated + +from type_traits import has_destructor +from type_traits import has_public_less +from type_traits import has_trivial_copy +from type_traits import has_public_equal +from type_traits import has_public_assign +from type_traits import has_public_destructor +from type_traits import has_public_constructor +from type_traits import has_trivial_constructor +from type_traits import find_trivial_constructor +from type_traits import has_public_binary_operator +from type_traits import has_any_non_copyconstructor + from type_traits import smart_pointer_traits from container_traits import list_traits @@ -173,127 +173,126 @@ from container_traits import set_traits from container_traits import hash_set_traits from container_traits import multiset_traits -from container_traits import hash_multiset_traits - -all_container_traits = [ - list_traits - , deque_traits - , queue_traits - , priority_queue - , vector_traits - , stack_traits - , map_traits - , multimap_traits - , hash_map_traits - , hash_multimap_traits - , set_traits - , hash_set_traits - , multiset_traits - , hash_multiset_traits +from container_traits import hash_multiset_traits + +all_container_traits = [ + list_traits + , deque_traits + , queue_traits + , priority_queue + , vector_traits + , stack_traits + , map_traits + , multimap_traits + , hash_map_traits + , hash_multimap_traits + , set_traits + , hash_set_traits + , multiset_traits + , hash_multiset_traits ] - -import templates -import call_invocation - -from filtering import filtering - -from decl_factory import decl_factory_t - -from matchers import matcher_base_t -from matchers import or_matcher_t -from matchers import and_matcher_t -from matchers import not_matcher_t -from matchers import declaration_matcher_t -from matchers import calldef_matcher_t -from matchers import namespace_matcher_t -from matchers import variable_matcher_t -from matchers import regex_matcher_t -from matchers import access_type_matcher_t -from matchers import operator_matcher_t -from matchers import custom_matcher_t -from matchers import virtuality_type_matcher_t + +import templates +import call_invocation + +from filtering import filtering + +from decl_factory import decl_factory_t + +from matchers import matcher_base_t +from matchers import or_matcher_t +from matchers import and_matcher_t +from matchers import not_matcher_t +from matchers import declaration_matcher_t +from matchers import calldef_matcher_t +from matchers import namespace_matcher_t +from matchers import variable_matcher_t +from matchers import regex_matcher_t +from matchers import access_type_matcher_t +from matchers import operator_matcher_t +from matchers import custom_matcher_t +from matchers import virtuality_type_matcher_t from matcher import matcher from mdecl_wrapper import mdecl_wrapper_t from decl_printer import decl_printer_t -from decl_printer import print_declarations - - -#implementation details: I need this trick in order to prevent recursive imports -import scopedef - -scopedef.scopedef_t._impl_all_decl_types = [ - scopedef.scopedef_t - , enumeration_t - , namespace_t - , class_t - , class_declaration_t - , typedef_t - , variable_t - , calldef_t - , member_calldef_t - , free_calldef_t - , operator_t - , member_function_t - , constructor_t - , destructor_t - , member_operator_t - , casting_operator_t - , free_function_t - , free_operator_t -] - -impl_matchers = scopedef.scopedef_t._impl_matchers -impl_decl_types = scopedef.scopedef_t._impl_decl_types - -impl_matchers[ scopedef.scopedef_t.decl ] = declaration_matcher_t - -impl_matchers[ scopedef.scopedef_t.class_ ] = declaration_matcher_t -impl_decl_types[ scopedef.scopedef_t.class_ ] = class_t - -impl_matchers[ scopedef.scopedef_t.variable ] = variable_matcher_t - -impl_matchers[ scopedef.scopedef_t.calldef ] = calldef_matcher_t -impl_decl_types[ scopedef.scopedef_t.calldef ] = calldef_t - -impl_matchers[ scopedef.scopedef_t.operator ] = operator_matcher_t -impl_decl_types[ scopedef.scopedef_t.operator ] = operator_t - -impl_matchers[ scopedef.scopedef_t.member_function ] = calldef_matcher_t -impl_decl_types[ scopedef.scopedef_t.member_function ] = member_function_t - -impl_matchers[ scopedef.scopedef_t.constructor ] = calldef_matcher_t -impl_decl_types[ scopedef.scopedef_t.constructor ] = constructor_t - -impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t -impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t - -impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t -impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t - -impl_matchers[ scopedef.scopedef_t.casting_operator ] = calldef_matcher_t -impl_decl_types[ scopedef.scopedef_t.casting_operator ] = casting_operator_t - -impl_matchers[ scopedef.scopedef_t.enumeration ] = declaration_matcher_t -impl_decl_types[ scopedef.scopedef_t.enumeration ] = enumeration_t - -impl_matchers[ scopedef.scopedef_t.typedef ] = declaration_matcher_t -impl_decl_types[ scopedef.scopedef_t.typedef ] = typedef_t - -impl_matchers[ namespace_t.namespace ] = namesp... [truncated message content] |
From: <rom...@us...> - 2006-08-17 03:44:41
|
Revision: 417 Author: roman_yakovenko Date: 2006-08-16 20:44:31 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=417&view=rev Log Message: ----------- moving pydsc.py one directory up, for setup.py script Added Paths: ----------- pydsc_dev/pydsc.py Removed Paths: ------------- pydsc_dev/pydsc/ Copied: pydsc_dev/pydsc.py (from rev 415, pydsc_dev/pydsc/pydsc.py) =================================================================== --- pydsc_dev/pydsc.py (rev 0) +++ pydsc_dev/pydsc.py 2006-08-17 03:44:31 UTC (rev 417) @@ -0,0 +1,272 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +Python Documentation Spell Checker. + +The pydsc module contains functionality needed to check documentation strings +and comments for spelling errors, within Python code. The pydsc module depends +on PyEnchant spell checker. PyEnchant provides interface for different spell +engines: + * ispell + * aspell + * OpenOffice + +The use of the pydsc module is very simple - just import pydsc and all modules +that will be imported after it will be checked. By default all spelling errors +will be printed to sys.stdout. The pydsc checker could be customized in many +different ways: + * you can define set of files/directories that should be included/excluded + from check process + * you can redefine error messages destination + * you can redefine and/or re-configurate spell checker + +Install: +python setup.py install + +Usage example: + +import pydsc +import readline #errors will be printed to standart output + +more complex example ( taken from pygccxml project ): + +import pydsc +#test only pygccxml +#package_directory defined earlier +pydsc.doc_checker.filter.append( package_directory ) +pydsc.doc_checker.filter_type = pydsc.FILTER_TYPE.INCLUDE +# +map( pydsc.doc_checker.speller.ignore_always + , [ 'org' + , 'http' + , 'bool' + , 'str' + , 'www' + , 'param' + , 'txt' + , 'decl' + , 'decls' + , 'namespace' + , 'enum' + , 'const' + , 'GCC' + , 'xcc' + , 'TODO' + , 'typedef' + , 'os' + , 'normcase' + , 'normpath' ] ) + +""" + +__version__ = '0.1' +__author__ = 'Roman Yakovenko <rom...@gm...>' +__url__ = 'http://sourceforge.net/projects/pygccxml/' +__license__ = 'Boost Software License <http://boost.org/more/license_info.html>' + +import os +import sys +import pprint +import inspect +import __builtin__ +from enchant import checker + + +#TODO: source code encoding +# -*- coding: encoding -*- +# -*- coding: iso-8859-15 -*- + +def normalize_path( some_path ): + """return os.path.normcase( os.path.normpath( some_path ) )""" + return os.path.normcase( os.path.normpath( some_path ) ) + +class filter_by_path_t: + class FILTER_TYPE: + """defines few filter constants""" + INCLUDE = 'include' + EXCLUDE = 'exclude' + + def __init__( self, what, ftype ): + self.what = what + if None is self.what: + self.what = [] + elif isinstance( self.what, str ): + self.what = [self.what] + self.what = map( normalize_path, self.what ) + self.ftype = ftype + + @staticmethod + def contains_parent_dir( path, dirs ): + """ + returns true if one of the directories is root directory for the path, + false otherwise + + @param path: path + @type path: str + + @param dirs: list of directories and\\or files + @type dirs: [ str ] + + @return: bool + """ + #precondition: dirs and fpath should be normalize_path'ed before calling this function + return bool( filter( lambda dir: path.startswith( dir ), dirs ) ) + + def check( self, source_file ): + source_file = normalize_path( source_file ) + if source_file in self.what or self.contains_parent_dir( source_file, self.what ): + return self.ftype == self.FILTER_TYPE.INCLUDE + else: + return self.ftype == self.FILTER_TYPE.EXCLUDE + +def exclude( what ): + return filter_by_path_t( what, filter_t.FILTER_TYPE.EXCLUDE ) + +def include( what ): + return filter_by_path_t( what, filter_t.FILTER_TYPE.INCLUDE ) + + +class checker_t( object ): + """ + applies spell check process on every imported module + + This is the main class of this module. This class applies spell check + process on every imported module. Every documentation string within the + module will be checked. Some comments will be checked too. You should read + inspect module documentation, in order to find out which comments will be + checked. + """ + + def __init__( self + , speller + , writer=None + , filter=None + , ignore_identifiers=True ): + """ + initialization method + + During this method, reference to __builtin__.__import__ function is + saved in one of the members of the class, and replaced with import_ + member function. + + @param speller: reference to enchant.checker.SpellChecker object + @type speller: enchant.checker.SpellChecker + + @param writer: reference to instance of class that has write method. + By default sys.stdout will be used. + + @param filter: list of files or directories + @type filter: [ str ] + + @param filter_type: provides interpretation for content of filter parameter + @type filter_type: L{FILTER_TYPE} + + @param ignore_identifiers: often comments/documentation strings contains + class\\method\\function names. Those names, + usually introduce spell error. If ignore_identifiers + set to True, those names will be ignored. + @type ignore_identifiers: bool + """ + object.__init__( self ) + self.__checked = set() + self.__orig_import = __builtin__.__import__ + __builtin__.__import__ = self.import_ + self.__already_imported = set( sys.modules.keys() ) + self.__checked = set() + self.speller = speller + self.writer = writer + if self.writer is None: + self.writer = sys.stdout + self.filter = filter + self.identifiers = set() + self.ignore_identifiers = ignore_identifiers + + def should_be_checked( self, obj, module=None ): + if id(obj) in self.__checked: + return False + if inspect.isbuiltin( obj ): + return False + if inspect.ismodule( obj ): + if obj.__name__ in self.__already_imported: + return False #do not check already imported modules + if self.filter: + try: + source_file = inspect.getsourcefile(obj) + if source_file is None: + source_file = inspect.getfile( obj ) + return self.filter.check( source_file ) + except TypeError: + return False #built in module + else: + return True + obj_module = inspect.getmodule( obj ) + if not obj_module is module: + return False + if inspect.isclass( obj ) \ + or inspect.ismethod( obj ) \ + or inspect.isfunction( obj ) \ + or inspect.isroutine( obj ) \ + or inspect.ismethoddescriptor( obj ) \ + or inspect.isdatadescriptor( obj ): + return True + return False + + def import_( self, name, globals=None, locals=None, fromlist=None ): + pymodule = self.__orig_import( name, globals, locals, fromlist ) + if self.should_be_checked(pymodule): + #write = self.writer.write + #write( 'inspecting %s%s' % ( inspect.getsourcefile( pymodule ), os.linesep ) ) + self.__already_imported.add( name ) + self.check( pymodule ) + #write( 'inspecting %s done%s' % ( inspect.getsourcefile( pymodule ), os.linesep ) ) + return pymodule + + def __check_text_impl( self, obj, text, text_type ): + if not text: + return + if self.ignore_identifiers and hasattr( obj, '__name__' ) and obj.__name__: + self.identifiers.add( obj.__name__ ) + errors = {} + self.speller.set_text( text ) + for error in self.speller: + if error.word in self.identifiers: + continue + if not errors.has_key( error.word ): + errors[ error.word ] = [] + errors[ error.word ] = self.speller.suggest() + if not errors: + return + write = self.writer.write + if inspect.getsourcefile( inspect.getmodule( obj ) ): + write( ' error details: %s' % os.linesep ) + write( ' file : %s%s' % ( inspect.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: + write( ' error details: %s' % os.linesep ) + write( ' text type : %s%s' % ( text_type, os.linesep ) ) + for word, suggestions in errors.items(): + write( ' misspelled word: %s%s' % ( word, os.linesep ) ) + write( ' suggestions : %s%s' % ( `suggestions`, os.linesep ) ) + + 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' ) + + def check( self, module ): + self.check_text( module ) + to_be_checked = map( lambda x: x[1], inspect.getmembers( module ) ) + while to_be_checked: + member = to_be_checked.pop(0) + if not self.should_be_checked( member, module ): + continue + self.check_text( member ) + to_be_checked.extend( map( lambda x: x[1], inspect.getmembers( member ) ) ) + self.__checked.add( id(member) ) + +"""documentation spell checker instance""" +doc_checker = checker_t( checker.SpellChecker( "en_US" ) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-17 05:07:24
|
Revision: 418 Author: roman_yakovenko Date: 2006-08-16 22:07:08 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=418&view=rev Log Message: ----------- Updating pydsc, docs and new test cases has been added Modified Paths: -------------- pydsc_dev/docs/pydsc.rest pydsc_dev/pydsc.py pydsc_dev/setup.py pydsc_dev/unittests/tester.py pydsc_dev/unittests/to_be_tested.py Added Paths: ----------- pydsc_dev/unittests/do_not_check/ pydsc_dev/unittests/do_not_check/__init__.py Modified: pydsc_dev/docs/pydsc.rest =================================================================== --- pydsc_dev/docs/pydsc.rest 2006-08-17 03:44:31 UTC (rev 417) +++ pydsc_dev/docs/pydsc.rest 2006-08-17 05:07:08 UTC (rev 418) @@ -7,21 +7,21 @@ .. meta:: :description: Python documentation string spell checker :keywords: Python, docstring, documentation, spell, check - , документация, спеллер, орфографическая коррекция, - + , документация, спеллер, орфографическая коррекция, + -------------- What is pydsc? -------------- -.. include:: ./definition.rest +.. include:: ./definition.rest ---------------------- What it is useful for? ---------------------- Well, this project was born to solve real problem - I made a lot of mistakes, -when I write source code documentation for my projects. I needed some way to -check all the documentation strings. My goal was simplicity + easy customization. +when I write source code documentation for my projects. I needed some way to +check all the documentation strings. My goal was simplicity + easy customization. I achieved it. Here is example of usage of pydsc: | ``import pydsc`` @@ -33,8 +33,8 @@ Spell checking -------------- -I did not reinvent the wheel. I use external spell checking engine. I checked -around and found few spell check engines available from Python. I decided to use +I did not reinvent the wheel. I use external spell checking engine. I checked +around and found few spell check engines available from Python. I decided to use `PyEnchant`_. It is cross platform, has clean interface and responsive author. ------------- @@ -47,12 +47,12 @@ * exclude(include) files from(to) spell checking process by file location ( very useful option in multi-project environment ) -More complex example: +"More complex" example: | ``import pydsc`` -| ``pydsc.doc_checker.filter.append( "/home/roman/pygccxml" )`` -| ``pydsc.doc_checker.filter_type = pydsc.FILTER_TYPE.INCLUDE`` -| ``map( pydsc.doc_checker.speller.ignore_always, [ 'normcase', 'normpath' ] )`` +| #check for spell errors only in files under "/home/roman/pygccxml" directory +| ``pydsc.include( "/home/roman/pygccxml" )`` +| ``pydsc.ignore( [ 'normcase', 'normpath' ] )`` | ``import readline`` -------- Modified: pydsc_dev/pydsc.py =================================================================== --- pydsc_dev/pydsc.py 2006-08-17 03:44:31 UTC (rev 417) +++ pydsc_dev/pydsc.py 2006-08-17 05:07:08 UTC (rev 418) @@ -62,10 +62,10 @@ """ -__version__ = '0.1' -__author__ = 'Roman Yakovenko <rom...@gm...>' -__url__ = 'http://sourceforge.net/projects/pygccxml/' -__license__ = 'Boost Software License <http://boost.org/more/license_info.html>' +__version__ = '0.2' #current version +__author__ = 'Roman Yakovenko <rom...@gm...>' #Don't you want to know who is guilty? +__url__ = 'http://www.language-binding.net' #project home +__license__ = 'Boost Software License <http://boost.org/more/license_info.html>' #license import os import sys @@ -84,12 +84,18 @@ return os.path.normcase( os.path.normpath( some_path ) ) class filter_by_path_t: + """The instance of this class will help user to define filter, that will + exclude modules from being checked""" class FILTER_TYPE: """defines few filter constants""" INCLUDE = 'include' EXCLUDE = 'exclude' def __init__( self, what, ftype ): + """ + what - list of paths, could contain file and directory names + ftype - FILTER_TYPE constant + """ self.what = what if None is self.what: self.what = [] @@ -116,19 +122,13 @@ return bool( filter( lambda dir: path.startswith( dir ), dirs ) ) def check( self, source_file ): + """returns True if source_file should be checked, False otherwise""" source_file = normalize_path( source_file ) if source_file in self.what or self.contains_parent_dir( source_file, self.what ): return self.ftype == self.FILTER_TYPE.INCLUDE else: return self.ftype == self.FILTER_TYPE.EXCLUDE -def exclude( what ): - return filter_by_path_t( what, filter_t.FILTER_TYPE.EXCLUDE ) - -def include( what ): - return filter_by_path_t( what, filter_t.FILTER_TYPE.INCLUDE ) - - class checker_t( object ): """ applies spell check process on every imported module @@ -181,10 +181,12 @@ if self.writer is None: self.writer = sys.stdout self.filter = filter - self.identifiers = set() + self.ignored_words = set() self.ignore_identifiers = ignore_identifiers def should_be_checked( self, obj, module=None ): + """returns True, if obj should be checked, False otherwise""" + if id(obj) in self.__checked: return False if inspect.isbuiltin( obj ): @@ -215,24 +217,22 @@ return False def import_( self, name, globals=None, locals=None, fromlist=None ): + """Hook to import functionality""" pymodule = self.__orig_import( name, globals, locals, fromlist ) if self.should_be_checked(pymodule): - #write = self.writer.write - #write( 'inspecting %s%s' % ( inspect.getsourcefile( pymodule ), os.linesep ) ) self.__already_imported.add( name ) - self.check( pymodule ) - #write( 'inspecting %s done%s' % ( inspect.getsourcefile( pymodule ), os.linesep ) ) + self.__check( pymodule ) return pymodule def __check_text_impl( self, obj, text, text_type ): if not text: return if self.ignore_identifiers and hasattr( obj, '__name__' ) and obj.__name__: - self.identifiers.add( obj.__name__ ) + self.ignored_words.add( obj.__name__ ) errors = {} self.speller.set_text( text ) for error in self.speller: - if error.word in self.identifiers: + if error.word in self.ignored_words: continue if not errors.has_key( error.word ): errors[ error.word ] = [] @@ -252,21 +252,50 @@ write( ' misspelled word: %s%s' % ( word, os.linesep ) ) write( ' suggestions : %s%s' % ( `suggestions`, os.linesep ) ) - def check_text( self, obj): + 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' ) - def check( self, module ): - self.check_text( module ) + def __check( self, module ): + self.__check_text( module ) to_be_checked = map( lambda x: x[1], inspect.getmembers( module ) ) while to_be_checked: member = to_be_checked.pop(0) if not self.should_be_checked( member, module ): continue - self.check_text( member ) + self.__check_text( member ) to_be_checked.extend( map( lambda x: x[1], inspect.getmembers( member ) ) ) self.__checked.add( id(member) ) """documentation spell checker instance""" doc_checker = checker_t( checker.SpellChecker( "en_US" ) ) + +def exclude( what ): + """ + Convenience function. It will exclude all modules, that their source file or + parent directory belongs to "what". + + what - list of paths, could contain file and directory names + """ + doc_checker.filter = filter_by_path_t( what, filter_by_path_t.FILTER_TYPE.EXCLUDE ) + +def include( what ): + """ + Convenience function. It will include only modules, that their source file + or parent directory belongs to "what". + + what - list of paths, could contain file and directory names + """ + doc_checker.filter = filter_by_path_t( what, filter_by_path_t.FILTER_TYPE.INCLUDE ) + +def ignore( what ): + """Adds word or list of words to the ignore list. + + what - word(string) or list of words(strings) to be ignored. + """ + if isinstance( what, str ): + doc_checker.ignored_words.add( what ) + else: + map( doc_checker.ignored_words.add, what ) + Modified: pydsc_dev/setup.py =================================================================== --- pydsc_dev/setup.py 2006-08-17 03:44:31 UTC (rev 417) +++ pydsc_dev/setup.py 2006-08-17 05:07:08 UTC (rev 418) @@ -4,13 +4,59 @@ # http://www.boost.org/LICENSE_1_0.txt) import os -from distutils import sysconfig +import sys + from distutils.core import setup +from distutils.cmd import Command +def generate_doc(): + """Generate the epydoc reference manual. + """ + print "Generating epydoc files..." + + from epydoc.docbuilder import build_doc_index + from epydoc.docwriter.html import HTMLWriter + + docindex = build_doc_index(['pydsc']) + html_writer = HTMLWriter( docindex + , prj_name='pydsc' + , prj_url='http://www.language-binding.net' + , include_sourcecode=False #This will decrease the size of generated documentation + , show_private=False + , show_frames=False) + + html_writer.write( os.path.join('docs', 'apidocs') ) + +class doc_cmd(Command): + """This is a new distutils command 'doc' to build the epydoc manual. + """ + + description = 'build the API reference using epydoc' + user_options = [('no-doc', None, "don't run epydoc")] + boolean_options = ['no-doc'] + + def initialize_options (self): + self.no_doc = 0 + + def finalize_options (self): + pass + + def run(self): + if self.no_doc: + return + generate_doc() + + +# Generate the doc when a source distribution is created +if sys.argv[-1]=="sdist": + generate_doc() + setup( name="pydsc" + , version = "0.2" , description="Python documentation and comments spell checker" , author="Roman Yakovenko" , author_email="rom...@gm..." - , url='http://pygccxml.sourceforge.net' + , url='http://www.language-binding.net' , py_modules=[ 'pydsc' ] -) \ No newline at end of file + , cmdclass = {"doc" : doc_cmd} +) Added: pydsc_dev/unittests/do_not_check/__init__.py =================================================================== --- pydsc_dev/unittests/do_not_check/__init__.py (rev 0) +++ pydsc_dev/unittests/do_not_check/__init__.py 2006-08-17 05:07:08 UTC (rev 418) @@ -0,0 +1,11 @@ +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import types + +def test(): + "qwoeithawytrqwueryqweytrqweytrqweytroqweytrqoweytroqwueytrqowutroqweytroqw" + pass Modified: pydsc_dev/unittests/tester.py =================================================================== --- pydsc_dev/unittests/tester.py 2006-08-17 03:44:31 UTC (rev 417) +++ pydsc_dev/unittests/tester.py 2006-08-17 05:07:08 UTC (rev 418) @@ -3,5 +3,14 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import os +import sys +sys.path.append( '..' ) + import pydsc -import to_be_tested \ No newline at end of file + +pydsc.exclude( os.path.abspath( os.path.join( os.curdir, 'do_not_check' ) ) ) +pydsc.ignore( 'abracadabra' ) + +import to_be_tested +import do_not_check Modified: pydsc_dev/unittests/to_be_tested.py =================================================================== --- pydsc_dev/unittests/to_be_tested.py 2006-08-17 03:44:31 UTC (rev 417) +++ pydsc_dev/unittests/to_be_tested.py 2006-08-17 05:07:08 UTC (rev 418) @@ -8,8 +8,8 @@ class code_creator_t(object): """ - code_creator_t is the base class for all code creators. - This class defines interface that every code creator should implement. + code_creator_t is the base class for all code creators. + This class defines interface that every code creator should implement. Also it provides few convinience functions. """ PYPLUSPLUS_NS_NAME = 'pyplusplus' @@ -21,23 +21,23 @@ assert isinstance( parent, code_creator_t ) self._parent = parent self._target_configuration = None - + def _get_parent( self ): - return self._parent + return self._parent def _set_parent( self, new_parent ): if new_parent: assert isinstance( new_parent, code_creator_t ) self._parent = new_parent """parent - reference to parent code creator""" parent = property( _get_parent, _set_parent ) - + def _get_target_configuration( self ): return self._target_configuration def _set_target_configuration( self, config ): self._target_configuration = config """target_configuration - reference to target_configuration_t class instance""" target_configuration = property( _get_target_configuration, _set_target_configuration ) - + def _get_top_parent(self): parent = self.parent me = self @@ -52,15 +52,15 @@ def _create_impl(self): """ - function that all derived classes should implement. This function + function that all derived classes should implement. This function actually creates code and returns it. Return value of this function is string. """ raise NotImplementedError() - + def create(self): """ - this function should be used in order to get code that should be + this function should be used in order to get code that should be generated. """ code = self._create_impl() @@ -73,21 +73,21 @@ """ assert isinstance( code, types.StringTypes ) return code.strip() - + @staticmethod def indent( code, size=1 ): """ - function that implements code indent algorithm. + function that implements code indent algorithm. """ assert isinstance( code, types.StringTypes ) return code_creator_t.__INDENTATION * size\ + code.replace( os.linesep , os.linesep + code_creator_t.__INDENTATION * size ) - - @staticmethod + + @staticmethod def unindent( code ): """ - function that implements code unindent algorithm. + function that implements code unindent algorithm. """ assert isinstance( code, types.StringTypes ) if code.startswith(code_creator_t.__INDENTATION): @@ -95,7 +95,7 @@ return code.replace( os.linesep + code_creator_t.__INDENTATION , os.linesep ) - @staticmethod + @staticmethod def is_comment( line ): """ function that returns true if content of the line is comment, otherwise @@ -104,4 +104,10 @@ assert isinstance( line, types.StringTypes ) l = line.lstrip() #1q2w3e4r-------------- - return l.startswith( '//' ) or l.startswith( '/*' ) \ No newline at end of file + return l.startswith( '//' ) or l.startswith( '/*' ) + + + def do_nothing( self ): + """abracadabra""" + pass + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2006-08-26 07:43:51
|
Revision: 472 Author: roman_yakovenko Date: 2006-08-26 00:43:43 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=472&view=rev Log Message: ----------- incrementing versions Modified Paths: -------------- pydsc_dev/setup.py pygccxml_dev/setup.py pyplusplus_dev/setup.py Modified: pydsc_dev/setup.py =================================================================== --- pydsc_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pydsc_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -52,7 +52,7 @@ generate_doc() setup( name="pydsc" - , version = "0.2" + , version = "0.3" , description="Python documentation and comments spell checker" , author="Roman Yakovenko" , author_email="rom...@gm..." Modified: pygccxml_dev/setup.py =================================================================== --- pygccxml_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pygccxml_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -53,7 +53,7 @@ setup( name = "pygccxml", - version = "0.8.1", + version = "0.8.2", description = "GCC-XML generated file reader", author = "Roman Yakovenko", author_email = "rom...@gm...", Modified: pyplusplus_dev/setup.py =================================================================== --- pyplusplus_dev/setup.py 2006-08-26 07:32:22 UTC (rev 471) +++ pyplusplus_dev/setup.py 2006-08-26 07:43:43 UTC (rev 472) @@ -87,7 +87,7 @@ setup( name = "Py++", - version = "0.8.1", + version = "0.8.2", description="Py++ is a framework of components for creating C++ code generator for Boost.Python library", author="Roman Yakovenko", author_email="rom...@gm...", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |