- fix exception handling errors (at least part of them)
This commit is contained in:
@@ -27,7 +27,7 @@ def handle_exception(exception, value, tb):
|
||||
from pisi.xmlext import XmlError
|
||||
|
||||
ui = pisi.cli.CLI()
|
||||
traceback = False
|
||||
show_traceback = False
|
||||
if exception == exceptions.KeyboardInterrupt:
|
||||
ui.error(_("\nKeyboardInterrupt: Exiting...\n"))
|
||||
sys.exit(1)
|
||||
@@ -36,18 +36,18 @@ def handle_exception(exception, value, tb):
|
||||
sys.exit(1)
|
||||
elif exception == pisi.Error:
|
||||
ui.error(_("Fatal Error:"))
|
||||
traceback = ctx.options and ctx.options.debug
|
||||
show_traceback = ctx.options and ctx.options.debug
|
||||
elif exception == pisi.Exception:
|
||||
traceback = True
|
||||
show_traceback = True
|
||||
else:
|
||||
# For any other exception (possibly Python exceptions) show
|
||||
# the traceback!
|
||||
traceback = True
|
||||
show_traceback = True
|
||||
|
||||
ui.error("%s" %exception)
|
||||
ui.error("%s\n" %value)
|
||||
|
||||
if traceback:
|
||||
if show_traceback:
|
||||
ui.error(_("""
|
||||
Internal PISI Error:
|
||||
Please file a bug report! (http://bugs.uludag.org.tr)
|
||||
|
||||
@@ -23,26 +23,32 @@ from pisi.actionsapi.shelltools import system, can_access_file
|
||||
from pisi.actionsapi.pisitools import dodoc
|
||||
|
||||
class CompileError(pisi.actionsapi.Error):
|
||||
def __init__(self, Exception):
|
||||
ctx.ui.error(Exception)
|
||||
def __init__(self, value=''):
|
||||
pisi.actionsapi.Error.__init__(self, value)
|
||||
self.value = value
|
||||
ctx.ui.error(value)
|
||||
|
||||
class InstallError(pisi.actionsapi.Error):
|
||||
def __init__(self, Exception):
|
||||
ctx.ui.error(Exception)
|
||||
def __init__(self, value=''):
|
||||
pisi.actionsapi.Error.__init__(self, value)
|
||||
self.value = value
|
||||
ctx.ui.error(value)
|
||||
|
||||
class RunTimeError(pisi.actionsapi.Error):
|
||||
def __init__(self, Exception):
|
||||
ctx.ui.error(Exception)
|
||||
def __init__(self, value=''):
|
||||
pisi.actionsapi.Error.__init__(self, value)
|
||||
self.value = value
|
||||
ctx.ui.error(value)
|
||||
|
||||
def compile(parameters = ''):
|
||||
'''compile source with given parameters.'''
|
||||
if system('python setup.py build %s' % (get.installDIR(), parameters)):
|
||||
raise CompileError('!!! Make failed...\n')
|
||||
raise CompileError, '!!! Make failed...\n'
|
||||
|
||||
def install(parameters = ''):
|
||||
'''does python setup.py install'''
|
||||
if system('python setup.py install --root=%s --no-compile %s' % (get.installDIR(), parameters)):
|
||||
raise InstallError('!!! Install failed...\n')
|
||||
raise InstallError, '!!! Install failed...\n'
|
||||
|
||||
DDOCS = 'CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS PKG-INFO \
|
||||
CONTRIBUTORS LICENSE COPYING* Change* MANIFEST* README*'
|
||||
@@ -54,4 +60,4 @@ def install(parameters = ''):
|
||||
def run(parameters = ''):
|
||||
'''executes parameters with python'''
|
||||
if system('python %s' % (parameters)):
|
||||
raise RunTimeError('!!! Running %s failed...\n' % parameters)
|
||||
raise RunTimeError, '!!! Running %s failed...\n' % parameters
|
||||
|
||||
Reference in New Issue
Block a user