Replace RuntimeError by SystemExit.

This commit is contained in:
grossmj
2015-06-03 19:58:58 -06:00
parent 9b0f548336
commit ea8119f3ad
4 changed files with 10 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ import argparse
try:
from gns3.qt import QtCore, QtGui, QtWidgets, DEFAULT_BINDING
except ImportError:
raise RuntimeError("Can't import Qt modules: Qt and/or PyQt is probably not installed correctly...")
raise SystemExit("Can't import Qt modules: Qt and/or PyQt is probably not installed correctly...")
from gns3.main_window import MainWindow
from gns3.logger import init_logger
@@ -142,20 +142,20 @@ def main():
# we only support Python 3 version >= 3.4
if sys.version_info < (3, 4):
raise RuntimeError("Python 3.4 or higher is required")
raise SystemExit("Python 3.4 or higher is required")
def version(version_string):
return [int(i) for i in version_string.split('.')]
if version(QtCore.QT_VERSION_STR) < version("4.6"):
raise RuntimeError("Requirement is Qt version 4.6 or higher, got version {}".format(QtCore.QT_VERSION_STR))
raise SystemExit("Requirement is Qt version 4.6 or higher, got version {}".format(QtCore.QT_VERSION_STR))
# 4.8.3 because of QSettings (http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html)
if DEFAULT_BINDING == "PyQt4" and version(QtCore.BINDING_VERSION_STR) < version("4.8.3"):
raise RuntimeError("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
raise SystemExit("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
if DEFAULT_BINDING == "PyQt5" and version(QtCore.BINDING_VERSION_STR) < version("5.0.0"):
raise RuntimeError("Requirement is PyQt5 version 5.0.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
raise SystemExit("Requirement is PyQt5 version 5.0.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
# check for the correct locale
# (UNIX/Linux only)
@@ -177,7 +177,7 @@ def main():
import win32con
import win32gui
except ImportError:
raise RuntimeError("Python for Windows extensions must be installed.")
raise SystemExit("Python for Windows extensions must be installed.")
if not options.debug:
try:

View File

@@ -55,7 +55,7 @@ if DEFAULT_BINDING == 'PyQt5':
from PyQt5 import QtSvg
sys.modules[__name__ + '.QtSvg'] = QtSvg
except ImportError:
raise RuntimeError("Please install the PyQt5.QtSvg module")
raise SystemExit("Please install the PyQt5.QtSvg module")
try:
from PyQt5 import QtWebKit

View File

@@ -113,7 +113,7 @@ def recursive(function, path):
if __name__ == '__main__':
if not PYUIC or not PYRCC:
raise RuntimeError("pyuic5 or pyrcc5 could't be found, please install PyQt5 development tools (e.g. pyqt5-dev-tools)")
raise SystemExit("pyuic5 or pyrcc5 could't be found, please install PyQt5 development tools (e.g. pyqt5-dev-tools)")
cwd = os.path.dirname(os.path.abspath(__file__))
gns3_path = os.path.abspath(os.path.join(cwd, "../gns3/"))

View File

@@ -21,7 +21,8 @@ from setuptools.command.test import test as TestCommand
# we only support Python 3 version >= 3.4
if sys.version_info < (3, 4):
raise RuntimeError("Python 3.4 or higher is required")
raise SystemExit("Python 3.4 or higher is required")
class Tox(TestCommand):