summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-01-12 04:28:10 +0000
committerAlec Warner <antarus@gentoo.org>2007-01-12 04:28:10 +0000
commitc36a8aae71e6ee7324a0d3312a351ed43c63e876 (patch)
treea4036b62bebee0b53a034964c1a591a8ddfcf4ce /pym
parentdde872be2a572069da77497fac27f50e32e8c817 (diff)
downloadportage-c36a8aae71e6ee7324a0d3312a351ed43c63e876.tar.gz
portage-c36a8aae71e6ee7324a0d3312a351ed43c63e876.tar.bz2
portage-c36a8aae71e6ee7324a0d3312a351ed43c63e876.zip
os.cwd can return OSError (maybe IOError with wrong perms for ./, will test actually), load_mod should be IMportError, nuke a stupid try except around shuffle which used to break years ago with old glibcs, remove try except around what appears to be a regex? and make the try except around the unlink a bit cleaner
svn path=/main/trunk/; revision=5587
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py41
1 files changed, 11 insertions, 30 deletions
diff --git a/pym/portage.py b/pym/portage.py
index be8f58e5a..e0ebefcf9 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -153,9 +153,7 @@ def getcwd():
"this fixes situations where the current directory doesn't exist"
try:
return os.getcwd()
- except SystemExit, e:
- raise
- except:
+ except OSError: #dir doesn't exist
os.chdir("/")
return "/"
getcwd()
@@ -1537,7 +1535,7 @@ class config:
best_mod = best_from_dict(property_string,self.modules,self.module_priority)
try:
mod = load_mod(best_mod)
- except:
+ except ImportError:
dump_traceback(red("Error: Failed to import module '%s'") % best_mod, noiselevel=0)
sys.exit(1)
return mod
@@ -2284,17 +2282,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
thirdpartymirrors[mirrorname].remove(cmirr)
# now try the official mirrors
if thirdpartymirrors.has_key(mirrorname):
- try:
- shuffle(thirdpartymirrors[mirrorname])
- except SystemExit, e:
- raise
- except:
- writemsg(red("!!! YOU HAVE A BROKEN PYTHON/GLIBC.\n"), noiselevel=-1)
- writemsg( "!!! You are most likely on a pentium4 box and have specified -march=pentium4\n")
- writemsg( "!!! or -fpmath=sse2. GCC was generating invalid sse2 instructions in versions\n")
- writemsg( "!!! prior to 3.2.3. Please merge the latest gcc or rebuid python with either\n")
- writemsg( "!!! -march=pentium3 or set -mno-sse2 in your cflags.\n\n\n")
- time.sleep(10)
+ shuffle(thirdpartymirrors[mirrorname])
for locmirr in thirdpartymirrors[mirrorname]:
filedict[myfile].append(locmirr+"/"+myuri[eidx+1:])
@@ -2547,21 +2535,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
# Fetch failed... Try the next one... Kill 404 files though.
if (mystat[stat.ST_SIZE]<100000) and (len(myfile)>4) and not ((myfile[-5:]==".html") or (myfile[-4:]==".htm")):
html404=re.compile("<title>.*(not found|404).*</title>",re.I|re.M)
- try:
- if html404.search(open(mysettings["DISTDIR"]+"/"+myfile).read()):
- try:
- os.unlink(mysettings["DISTDIR"]+"/"+myfile)
- writemsg(">>> Deleting invalid distfile. (Improper 404 redirect from server.)\n")
- fetched = 0
- continue
- except SystemExit, e:
- raise
- except:
- pass
- except SystemExit, e:
- raise
- except:
- pass
+ if html404.search(open(mysettings["DISTDIR"]+"/"+myfile).read()):
+ try:
+ os.unlink(mysettings["DISTDIR"]+"/"+myfile)
+ writemsg(">>> Deleting invalid distfile. (Improper 404 redirect from server.)\n")
+ fetched = 0
+ continue
+ except (IOError, OSError):
+ pass
fetched = 1
continue
if not fetchonly: