summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/utils/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/core/utils/path.py')
-rw-r--r--meta/lib/oeqa/core/utils/path.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/utils/path.py b/meta/lib/oeqa/core/utils/path.py
new file mode 100644
index 0000000000..c086dcb0b0
--- /dev/null
+++ b/meta/lib/oeqa/core/utils/path.py
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2016 Intel Corporation
+#
+# SPDX-License-Identifier: MIT
+#
+
+import os
+import sys
+
+def findFile(file_name, directory):
+ """
+ Search for a file in directory and returns its complete path.
+ """
+ for r, d, f in os.walk(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)
+