Catch an exception instead of using a redundant os.access call.
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Dec 2006 22:29:13 +0000 (22:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Dec 2006 22:29:13 +0000 (22:29 -0000)
svn path=/main/trunk/; revision=5209

pym/portage.py

index 13c851ab0e1f95c18fa111ee586861f6f55a1b04..e51934b765500fd80b9d491552d7f8d59f5d222b 100644 (file)
@@ -4795,14 +4795,14 @@ class vardbapi(dbapi):
                results = []
                for x in wants:
                        myfn = self.root+VDB_PATH+"/"+str(mycpv)+"/"+str(x)
-                       if os.access(myfn,os.R_OK):
+                       try:
                                myf = open(myfn, "r")
                                myd = myf.read()
                                myf.close()
                                myd = re.sub("[\n\r\t]+"," ",myd)
                                myd = re.sub(" +"," ",myd)
                                myd = string.strip(myd)
-                       else:
+                       except (IOError, OSError):
                                myd = ""
                        results.append(myd)
                if "EAPI" in wants: