diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-06-23 08:03:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-06-23 08:03:54 +0000 |
commit | 1c7726111cfcc3a87070492ec9e2e9f86f902703 (patch) | |
tree | a193fd5a680a35962a7e7e90708835d5d53c4bfc | |
parent | 5935cdf7ccaf96302378a0e3b47c7a0b85368220 (diff) | |
download | portage-1c7726111cfcc3a87070492ec9e2e9f86f902703.tar.gz portage-1c7726111cfcc3a87070492ec9e2e9f86f902703.tar.bz2 portage-1c7726111cfcc3a87070492ec9e2e9f86f902703.zip |
Fix error handling for getlist().
svn path=/main/trunk/; revision=3622
-rwxr-xr-x | bin/emerge | 20 |
1 files changed, 8 insertions, 12 deletions
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)) |