[OE-core] [PATCHv2 17/32] oeqa/utils/path: Add remove_safe function

Aníbal Limón anibal.limon at linux.intel.com
Wed Dec 7 20:32:22 UTC 2016


Checks if path exists before try to remove of avoid exception.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 meta/lib/oeqa/core/utils/path.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/lib/oeqa/core/utils/path.py b/meta/lib/oeqa/core/utils/path.py
index cb06523..a21caad 100644
--- a/meta/lib/oeqa/core/utils/path.py
+++ b/meta/lib/oeqa/core/utils/path.py
@@ -12,3 +12,8 @@ def findFile(file_name, directory):
         if file_name in f:
             return os.path.join(r, file_name)
     return None
+
+def remove_safe(path):
+    if os.path.exists(path):
+        os.remove(path)
+
-- 
2.1.4




More information about the Openembedded-core mailing list