diff mbox series

[2/6] lib/oe/cachedpath: add is_executable() functions

Message ID 20261019145837.2487873-2-ross.burton@arm.com
State New
Headers show
Series [1/6] lib/oe/sstatesig: cache the user/group lookups in OEOuthashBasic | expand

Commit Message

Ross Burton Oct. 19, 2026, 2:58 p.m. UTC
Add is_exexcutable(), which returns True if the path has any executable
bits set in the file mode.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oe/cachedpath.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/cachedpath.py b/meta/lib/oe/cachedpath.py
index 68c85807d9f..462094192d2 100644
--- a/meta/lib/oe/cachedpath.py
+++ b/meta/lib/oe/cachedpath.py
@@ -121,6 +121,12 @@  class CachedPath(object):
     def lstat(self, path):
         return self.calllstat(path)
 
+    def is_executable(self, path):
+        """
+        Test if the file has any executable bits set.
+        """
+        return bool(self.stat(path).st_mode & (statmod.S_IXUSR | statmod.S_IXGRP | statmod.S_IXOTH))
+
     def walk(self, top, topdown=True, onerror=None, followlinks=False):
         # Matches os.walk, not os.path.walk()