From 1c7726111cfcc3a87070492ec9e2e9f86f902703 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 23 Jun 2006 08:03:54 +0000 Subject: Fix error handling for getlist(). svn path=/main/trunk/; revision=3622 --- bin/emerge | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'bin/emerge') 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)) -- cgit v1.2.3-1-g7c22