[pygccxml-commit] source/pygccxml/utils __init__.py,1.7,1.8
Brought to you by:
mbaas,
roman_yakovenko
From: Roman <rom...@us...> - 2006-03-02 05:53:21
|
Update of /cvsroot/pygccxml/source/pygccxml/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23403/pygccxml/utils Modified Files: __init__.py Log Message: Index: __init__.py =================================================================== RCS file: /cvsroot/pygccxml/source/pygccxml/utils/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 2 May 2005 03:31:06 -0000 1.7 --- __init__.py 2 Mar 2006 05:53:15 -0000 1.8 *************** *** 1,40 **** ! # 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 tempfile ! ! __REPOTED_TODOS = [] ! ! def TODO_LAUD( msg, report_once=True ): ! global __REPOTED_TODOS ! if not report_once or msg not in __REPOTED_TODOS: ! print 'TODO: ', msg ! __REPOTED_TODOS.append( msg ) ! ! def TODO_SILENT( msg, report_once=True ): ! __REPOTED_TODOS.append( msg ) ! ! try: ! import pygccxml ! TODO = TODO_SILENT ! except: ! TODO = TODO_LAUD ! ! ! def remove_file_no_raise(file_name ): ! try: ! if os.path.exists(file_name): ! os.remove( file_name ) ! except Exception, error: ! print "error ocured while removing temprorary created file('%s'): %s" % ( file_name, str( error ) ) ! ! def create_temp_file_name(suffix, prefix=None, dir=None): ! if not prefix: ! prefix = tempfile.template ! fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir ) ! file_obj = os.fdopen( fd ) ! file_obj.close() ! return name --- 1,35 ---- ! # 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 sys ! import logging ! import tempfile ! ! ! logger = logging.getLogger('pygccxml') ! __handler = logging.StreamHandler(sys.stdout) ! __handler.setFormatter( logging.Formatter('%(asctime)s %(levelname)s %(message)s') ) ! logger.addHandler(__handler) ! logger.setLevel(logging.DEBUG) ! ! def remove_file_no_raise(file_name ): ! try: ! if os.path.exists(file_name): ! os.remove( file_name ) ! except Exception, error: ! logger.debug( "Error ocured while removing temprorary created file('%s'): %s" ! % ( file_name, str( error ) ) ) ! ! def create_temp_file_name(suffix, prefix=None, dir=None): ! if not prefix: ! prefix = tempfile.template ! fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir ) ! file_obj = os.fdopen( fd ) ! file_obj.close() ! return name ! ! def normalize_path( some_path ): ! return os.path.normpath( os.path.normcase( some_path ) ) |