From 5bf0525011ad05b45c043d66f8c0cbc9e605a8f4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 18 Oct 2007 21:08:40 +0000 Subject: Handle EnvironmentError instead of OSError since open() actually raises IOError. Also, treat a missing SLOT file as SLOT="" since it is currently possible to install an ebuild with an undefined SLOT even though repoman generates a SLOT.missing error with such an ebuild. svn path=/main/trunk/; revision=8174 --- pym/portage/dbapi/vartree.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index cca5ca9a3..45badc3e3 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1672,16 +1672,20 @@ class dblink(object): return 1 inforoot_slot_file = os.path.join(inforoot, "SLOT") + slot = None try: f = open(inforoot_slot_file) try: slot = f.read().strip() finally: f.close() - except OSError, e: - writemsg("!!! Error reading '%s': %s\n" % (inforoot_slot_file, e), - noiselevel=-1) - return 1 + except EnvironmentError, e: + if e.errno != errno.ENOENT: + raise + del e + + if slot is None: + slot = "" if slot != self.settings["SLOT"]: writemsg("!!! WARNING: Expected SLOT='%s', got '%s'\n" % \ -- cgit v1.2.3-1-g7c22