def main(): '''Generates a python api documentation website.''' if FileHandler('documentation').is_directory(): current_working_directory = FileHandler() index_file = FileHandler('documentation/source/index.rst') modules_to_document = '\ninit' FileHandler( location='%sinit.rst' % index_file.directory.path ).content = ( (79 * '=') + '\n{name}\n' + (79 * '=') + '\n\n.. automodule::' + ' {name}\n :members:' ).format(name=current_working_directory.name) for file in FileHandler(): if Module.is_package(file.path): modules_to_document += '\n %s' % file.name FileHandler(location='%s%s.rst' % ( index_file.directory.path, file.name )).content = ( (79 * '=') + '\n{name}.{package}\n' + (79 * '=') + '\n\n.. automodule:: {name}.{package}\n' ' :members:' ).format( name=current_working_directory.name, package=file.name) for module in __get_all_modules__(file.path): modules_to_document += '\n %s.%s' % (file.name, module) FileHandler(location='%s%s.%s.rst' % ( index_file.directory.path, file.name, module )).content = ( (79 * '=') + '\n{name}.{package}.{module}\n' + (79 * '=') + '\n\n.. automodule:: {name}.{package}.' '{module}\n :members:' ).format( name=current_working_directory.name, package=file.name, module=module) index_file.content = regularExpression.compile( '\n ([a-z][a-zA-Z]+\n)+$', regularExpression.DOTALL ).sub(modules_to_document, index_file.content) Platform.run('/usr/bin/env git add --all', error=False, log=True) FileHandler('documentation').change_working_directory() makefile = FileHandler('Makefile') # # python3.5 FileHandler('MakefilePython3').copy(makefile) FileHandler('MakefilePython2').copy(makefile) Platform.run( command='make html', native_shell=True, error=False, log=True) makefile.remove_file() FileHandler('build/html').path = '../apiDocumentation' FileHandler('build').remove_deep()
def _handle_aspects(self, handler): # # '''Iterates through each aspect matching current function call.''' from boostnode.extension.native import Module context_path = Module.get_context_path(path=inspect.getfile( self.__func__)) if self.class_object: context_path += '.' + self.class_object.__name__ context_path += '.' + self.__func__.__name__ result = True for aspect in ASPECTS: # # python3.5 # # if('point_cut' not in aspect or # # regularExpression.compile(aspect['point_cut']).fullmatch( # # context_path)): if('point_cut' not in aspect or regularExpression.compile( aspect['point_cut'] ).match('(?:%s)$' % context_path)): # # for advice in aspect['advice']: if handler(advice) is False: result = False return result
# # endregion # endregion # endregion # region footer ''' Preset some variables given by introspection letting the linter know what \ globale variables are available. ''' __logger__ = __exception__ = __module_name__ = __file_path__ = \ __test_mode__ = __test_buffer__ = __test_folder__ = __test_globals__ = None ''' Extends this module with some magic environment variables to provide \ better introspection support. A generic command line interface for some \ code preprocessing tools is provided by default. ''' if __name__ == '__main__': Module.default( name=__name__, frame=inspect.currentframe(), default_caller=False) # endregion # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: # endregion
# # endregion # endregion # endregion # region footer ''' Preset some variables given by introspection letting the linter know what \ globale variables are available. ''' __logger__ = __exception__ = __module_name__ = __file_path__ = \ __test_mode__ = __test_buffer__ = __test_folder__ = __test_globals__ = None ''' Extends this module with some magic environment variables to provide \ better introspection support. A generic command line interface for some \ code preprocessing tools is provided by default. ''' Module.default( name=__name__, frame=inspect.currentframe(), default_caller=Browser.__name__) # endregion # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: # endregion
# # '''Merges all readme file.''' global CONTENT if not is_file_ignored(file): if file.basename == 'readme': __logger__.info('Handle "%s".', file.path) if CONTENT: CONTENT += '\n' CONTENT += file.content return True # endregion # region footer ''' Preset some variables given by introspection letting the linter know what \ globale variables are available. ''' __logger__ = __exception__ = __module_name__ = __file_path__ = \ __test_mode__ = __test_buffer__ = __test_folder__ = __test_globals__ = None ''' Extends this module with some magic environment variables to provide \ better introspection support. A generic command line interface for some \ code preprocessing tools is provided by default. ''' Module.default(name=__name__, frame=inspect.currentframe()) # endregion # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: # endregion
''' if __name__ != '__main__': from boostnode.aspect.signature import add_check as add_signature_check from boostnode.extension.native import Module # # python3.5 # # pass builtins.reload(sys) sys.setdefaultencoding(ENCODING) # # try: ''' Add signature checking for all functions and methods with joint \ points in this package. ''' add_signature_check(point_cut='%s\..*' % Module.get_package_name( frame=inspect.currentframe())) except WindowsError as exception: # # python3.5 # # logging.error( # # 'Running subprocesses on windows without being administrator ' # # "isn't possible. %s: %s", exception.__class__.__name__, # # builtins.str(exception)) logging.error( 'Running subprocesses on windows without being administrator ' "isn't possible. %s: %s", exception.__class__.__name__, convert_to_unicode(exception)) # # sys.exit(1) # endregion