Back to index

apport  2.4
__init__.py
Go to the documentation of this file.
00001 from apport.report import Report
00002 
00003 from apport.packaging_impl import impl as packaging
00004 
00005 Report  # pyflakes
00006 packaging  # pyflakes
00007 
00008 import sys
00009 
00010 # fix gettext to output proper unicode strings
00011 import gettext
00012 
00013 
00014 def unicode_gettext(str):
00015     trans = gettext.gettext(str)
00016     if type(trans) == type(b''):
00017         return trans.decode('UTF-8')
00018     else:
00019         return trans
00020 
00021 
00022 def fatal(msg, *args):
00023     '''Print out an error message and exit the program.'''
00024 
00025     error(msg, *args)
00026     sys.exit(1)
00027 
00028 
00029 def error(msg, *args):
00030     '''Print out an error message.'''
00031 
00032     sys.stderr.write('ERROR: ')
00033     sys.stderr.write(msg % args)
00034     sys.stderr.write('\n')
00035 
00036 
00037 def warning(msg, *args):
00038     '''Print out an warning message.'''
00039 
00040     sys.stderr.write('WARNING: ')
00041     sys.stderr.write(msg % args)
00042     sys.stderr.write('\n')