[Yum-devel] [PATCH 1/2] Add a non-exceptional stat wrapper
James Antill
james at and.org
Thu Jul 22 19:11:54 UTC 2010
---
yum/misc.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/yum/misc.py b/yum/misc.py
index 9d3180b..0f80d7d 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -901,6 +901,15 @@ def unlink_f(filename):
if e.errno != errno.ENOENT:
raise
+def stat_f(filename):
+ """ Call os.stat(), but don't die if the file isn't there. Returns None. """
+ try:
+ return os.stat(filename)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ return None
+
def _getloginuid():
""" Get the audit-uid/login-uid, if available. None is returned if there
was a problem. Note that no caching is done here. """
--
1.7.1.1
More information about the Yum-devel
mailing list