try:
mysize = os.stat(myfile_path).st_size
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
mysize = 0
try:
os.unlink(myfile_path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
os.symlink(readonly_file, myfile_path)
" %(file)s\n" % {"file":myfile}))
break
except (IOError, OSError), e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
try:
mystat = os.stat(myfile_path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
else:
try:
mysize = os.stat(myfile_path).st_size
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
mysize = 0
try:
mystat = os.stat(myfile_path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
fetched = 0
try:
os.unlink(myfile_path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in \
+ (errno.ENOENT, errno.ESTALE):
raise
del e
fetched = 0
try:
mystat = os.stat(myfile_path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
fetched = 0
if os.stat(lockfilename).st_gid != portage_gid:
os.chown(lockfilename, -1, portage_gid)
except OSError, e:
- if e.errno == errno.ENOENT: # No such file or directory
+ if e.errno in (errno.ENOENT, errno.ESTALE):
return lockfile(mypath,
wantnewlockfile=wantnewlockfile,
unlinkfile=unlinkfile, waiting_msg=waiting_msg,
try:
return os.fstat(fd).st_nlink
except EnvironmentError, e:
- if e.errno == errno.ENOENT:
+ if e.errno in (errno.ENOENT, errno.ESTALE):
# Some filesystems such as CIFS return
# ENOENT which means st_nlink == 0.
return 0