diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-11-09 10:33:42 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:18 +0000 |
commit | abb55ab304af91f68a4e09176ce9c6b995d903e0 (patch) | |
tree | 4cef8b212dec4af7eb373f9313064c2146122d04 /meta/lib/oeqa/core/utils/path.py | |
parent | 08714d3b7e744b19dde2b102ed4d80fc171f07a1 (diff) | |
download | poky-abb55ab304af91f68a4e09176ce9c6b995d903e0.tar.gz |
oeqa/core: Add utils module for OEQA framework
misc: Functions for transform object to other types.
path: Functions for path handling.
test: Functions for operations related to test cases and suites.
[YOCTO #10232]
(From OE-Core rev: 102d04ccca3ca89d41b76a8c44e0ca0f436b7004)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/utils/path.py')
-rw-r--r-- | meta/lib/oeqa/core/utils/path.py | 19 |
1 files changed, 19 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..a21caad5cb --- /dev/null +++ b/meta/lib/oeqa/core/utils/path.py | |||
@@ -0,0 +1,19 @@ | |||
1 | # Copyright (C) 2016 Intel Corporation | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | import sys | ||
6 | |||
7 | def findFile(file_name, directory): | ||
8 | """ | ||
9 | Search for a file in directory and returns its complete path. | ||
10 | """ | ||
11 | for r, d, f in os.walk(directory): | ||
12 | if file_name in f: | ||
13 | return os.path.join(r, file_name) | ||
14 | return None | ||
15 | |||
16 | def remove_safe(path): | ||
17 | if os.path.exists(path): | ||
18 | os.remove(path) | ||
19 | |||