summaryrefslogtreecommitdiffstats
path: root/pym/cache
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-03-18 17:23:09 +0000
committerZac Medico <zmedico@gentoo.org>2006-03-18 17:23:09 +0000
commit0afef340b341f8c91fe72dd9dd2999b30fb94b6e (patch)
tree4cce7ab0e097790a053e1cdcbfe4a6657df758c7 /pym/cache
parent7f54d6b7e48c68cb15182bda9e9e8c2f7f294b23 (diff)
downloadportage-0afef340b341f8c91fe72dd9dd2999b30fb94b6e.tar.gz
portage-0afef340b341f8c91fe72dd9dd2999b30fb94b6e.tar.bz2
portage-0afef340b341f8c91fe72dd9dd2999b30fb94b6e.zip
Replace hard coded number 2 in cache modules with errno.ENOENT.
svn path=/main/trunk/; revision=2938
Diffstat (limited to 'pym/cache')
-rw-r--r--pym/cache/flat_hash.py6
-rw-r--r--pym/cache/flat_list.py12
2 files changed, 7 insertions, 11 deletions
diff --git a/pym/cache/flat_hash.py b/pym/cache/flat_hash.py
index 1bdc7cd5b..605315c6d 100644
--- a/pym/cache/flat_hash.py
+++ b/pym/cache/flat_hash.py
@@ -5,7 +5,7 @@
import fs_template
import cache_errors
-import os, stat
+import errno, os, stat
from mappings import LazyLoad, ProtectedDict
from template import reconstruct_eclasses
# store the current key order *here*.
@@ -71,7 +71,7 @@ class database(fs_template.FsBased):
fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try: myf=open(fp, "w")
except IOError, ie:
- if ie.errno == 2:
+ if errno.ENOENT == ie.errno:
try:
self._ensure_dirs(cpv)
myf=open(fp,"w")
@@ -101,7 +101,7 @@ class database(fs_template.FsBased):
try:
os.remove(os.path.join(self.location,cpv))
except OSError, e:
- if e.errno == 2:
+ if errno.ENOENT == e.errno:
raise KeyError(cpv)
else:
raise cache_errors.CacheCorruption(cpv, e)
diff --git a/pym/cache/flat_list.py b/pym/cache/flat_list.py
index 944f7406d..135b31e39 100644
--- a/pym/cache/flat_list.py
+++ b/pym/cache/flat_list.py
@@ -1,6 +1,6 @@
import fs_template
import cache_errors
-import os, stat
+import errno, os, stat
# store the current key order *here*.
class database(fs_template.FsBased):
@@ -31,11 +31,7 @@ class database(fs_template.FsBased):
for k,v in zip(self.auxdbkey_order, myf):
d[k] = v.rstrip("\n")
except (OSError, IOError),e:
- if isinstance(e,IOError) and e.errno == 2:
-# print "caught for %s" % cpv, e
-# l=os.listdir(os.path.dirname(os.path.join(self._base,cpv)))
-# l.sort()
-# print l
+ if errno.ENOENT == e.errno:
raise KeyError(cpv)
raise cache_errors.CacheCorruption(cpv, e)
@@ -52,7 +48,7 @@ class database(fs_template.FsBased):
fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try: myf=open(fp, "w")
except (OSError, IOError), e:
- if e.errno == 2:
+ if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
myf=open(fp,"w")
@@ -79,7 +75,7 @@ class database(fs_template.FsBased):
try:
os.remove(os.path.join(self._base,cpv))
except OSError, e:
- if e.errno == 2:
+ if errno.ENOENT == e.errno:
raise KeyError(cpv)
else:
raise cache_errors.CacheCorruption(cpv, e)