From 3b5633913d18e06c5c36c103b9f160cce114ad9e Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 24 Sep 2017 14:06:36 +0200 Subject: Use os.access() in get_defconfig_filename() ...instead of os.path.exists(). This more closely mimics the test in the C implementation, which boils down to fopen(file, "r") == NULL. Could open(filename) and catch exceptions too, but it might be overkilling things. --- kconfiglib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index d87f9cc..f726c60 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -309,13 +309,13 @@ class Config(object): for filename, cond_expr in self.defconfig_sym.def_exprs: if self._eval_expr(cond_expr) != "n": filename = self._expand_sym_refs(filename) - if os.path.exists(filename): + if os.access(filename, os.R_OK): return filename # defconfig not found. If the path is a relative path and # $srctree is set, we also look in $srctree. if not os.path.isabs(filename) and self.srctree is not None: filename = os.path.join(self.srctree, filename) - if os.path.exists(filename): + if os.access(filename, os.R_OK): return filename return None -- cgit v1.2.3