From: Zac Medico Date: Thu, 18 Oct 2007 21:08:40 +0000 (-0000) Subject: Handle EnvironmentError instead of OSError since open() X-Git-Tag: v2.2_pre1~596 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5bf0525011ad05b45c043d66f8c0cbc9e605a8f4;p=portage.git 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 --- 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" % \