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