From: Zac Medico Date: Fri, 23 Jun 2006 08:03:54 +0000 (-0000) Subject: Fix error handling for getlist(). X-Git-Tag: v2.1.1~415 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1c7726111cfcc3a87070492ec9e2e9f86f902703;p=portage.git Fix error handling for getlist(). svn path=/main/trunk/; revision=3622 --- diff --git a/bin/emerge b/bin/emerge index 89241d33d..b5e043190 100755 --- a/bin/emerge +++ b/bin/emerge @@ -853,20 +853,16 @@ def getlist(mode): mylines=portage.settings.packages elif mode=="world": try: - myfile = open(os.path.join(portage.root, portage.WORLD_FILE), "r") - mylines=myfile.readlines() + file_path = os.path.join(portage.root, portage.WORLD_FILE) + myfile = open(file_path, "r") + mylines = myfile.readlines() myfile.close() - except OSError: - print "!!! Couldn't open "+pfile+"; exiting." - sys.exit(1) - except IOError, e: - #Permission denied is a fatal error, as opposed to a missing file - if e.errno == errno.EACCES: - raise - else: - if "--quiet" not in myopts: - portage.writemsg(red("\n!!! ") + "Warning %s does not exist.\n" % os.path.join(portage.root, portage.WORLD_FILE) ) + except (OSError, IOError), e: + if e.errno == errno.ENOENT: + portage.writemsg("\n!!! World file does not exist: '%s'\n" % file_path) mylines=[] + else: + raise mynewlines=[] for x in mylines: myline=string.join(string.split(x))