summaryrefslogtreecommitdiff
path: root/portato/gui/windows/main.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-01-15 13:29:30 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-01-15 13:29:30 +0100
commit199a2ec3b17bc59e6854db2a96ed223d21803ce7 (patch)
treeafe43205298d4df838087dc778fd68fa9b6b8409 /portato/gui/windows/main.py
parent2aa260c13d2b23141a6644af6b27da243d1f3641 (diff)
downloadportato-199a2ec3b17bc59e6854db2a96ed223d21803ce7.tar.gz
portato-199a2ec3b17bc59e6854db2a96ed223d21803ce7.tar.bz2
portato-199a2ec3b17bc59e6854db2a96ed223d21803ce7.zip
Add prerequisite checking before startup
Diffstat (limited to '')
-rw-r--r--portato/gui/windows/main.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 08c2033..970dcba 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -3,7 +3,7 @@
# File: portato/gui/windows/main.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006-2008 René 'Necoro' Neumann
+# Copyright (C) 2006-2009 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
@@ -38,6 +38,7 @@ from ..views import LogView, HighlightView, InstalledOnlyView, LazyStoreView
from ..dialogs import (blocked_dialog, changed_flags_dialog, io_ex_dialog,
nothing_found_dialog, queue_not_empty_dialog, remove_deps_dialog,
remove_queue_dialog, remove_updates_dialog, unmask_dialog)
+from ..exceptions import PreReqError
# even more GUI stuff
from .basic import Window, Popup
@@ -424,6 +425,8 @@ class MainWindow (Window):
@type splash: SplashScreen
"""
+ self.check_prereqs()
+
if splash is None:
splash = lambda x: True
@@ -1865,7 +1868,24 @@ class MainWindow (Window):
Calls main_quit().
"""
gtk.main_quit()
-
+
+ def check_prereqs (self):
+
+ def fail (m):
+ error("PreReqError: %s", m)
+ raise PreReqError(m)
+
+ pdir = system.get_global_settings("PORTDIR")
+
+ if not os.path.exists(pdir):
+ fail(_("The portage tree is not existing."))
+
+ ls = os.listdir(system.get_global_settings("PORTDIR"))
+ if not "eclass" in ls:
+ fail(_("The portage tree seems to be empty."))
+
+ debug("All prereqs matched. Fine :)")
+
def main (self):
"""
Main.