summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-02-10 22:07:52 +0000
committerZac Medico <zmedico@gentoo.org>2006-02-10 22:07:52 +0000
commitd215e2a84591dd3568d13c5fcaa5ba309b4c7994 (patch)
tree097f5f5c2e90d30d482db90ca1ecd74e5fcdfa3e
parent664bcd1672bfe7d253c1e70e01d95cd369e0ad53 (diff)
downloadportage-d215e2a84591dd3568d13c5fcaa5ba309b4c7994.tar.gz
portage-d215e2a84591dd3568d13c5fcaa5ba309b4c7994.tar.bz2
portage-d215e2a84591dd3568d13c5fcaa5ba309b4c7994.zip
avoid unnecessary stat by catching ENOENT error instead of using os.path.exists()
svn path=/main/trunk/; revision=2690
-rw-r--r--pym/portage_checksum.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py
index f837966bc..a11dbc4f6 100644
--- a/pym/portage_checksum.py
+++ b/pym/portage_checksum.py
@@ -6,6 +6,7 @@
from portage_const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE
import os
+import errno
import shutil
import stat
import portage_exception
@@ -134,8 +135,13 @@ def perform_checksum(filename, hash_function=md5hash, calc_prelink=0):
myhash, mysize = hash_function(myfilename)
if calc_prelink and prelink_capable:
- if os.path.exists(prelink_tmpfile):
+ try:
os.unlink(prelink_tmpfile)
+ except OSError, oe:
+ if oe.errno == errno.ENOENT:
+ pass
+ else:
+ raise oe
portage_locks.unlockfile(mylock)
return (myhash,mysize)