diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-04-09 15:54:35 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-13 22:33:20 +0100 |
commit | 7141e488092f9833e349ce95f856dd9e26aa0f7b (patch) | |
tree | a97e27c16455b2b11fa87cebff80cb00acbaa9f5 /scripts/wic | |
parent | d0d0ab85c49d7a874bef8b8d8844bbe9b1dc0c49 (diff) | |
download | poky-7141e488092f9833e349ce95f856dd9e26aa0f7b.tar.gz |
wic: Use __file__ instead of sys.argv[0]
Using __file__ makes the code work independently of the way
it's loaded. In some cases wic can be imported by another
program without executing it. sys.argv[0] would not contain
path to the wic in such a cases.
This is an enabler for unit testing with nose framework.
(From OE-Core rev: 7166262032648dbbc8b4b476c8770e35b1d4e234)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-x | scripts/wic | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/wic b/scripts/wic index dcf1a5520e..fd4a67892b 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -38,7 +38,7 @@ import optparse | |||
38 | import logging | 38 | import logging |
39 | 39 | ||
40 | # External modules | 40 | # External modules |
41 | scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) | 41 | scripts_path = os.path.abspath(os.path.dirname(__file__)) |
42 | lib_path = scripts_path + '/lib' | 42 | lib_path = scripts_path + '/lib' |
43 | bitbake_path = os.path.join(scripts_path, '../bitbake/lib') | 43 | bitbake_path = os.path.join(scripts_path, '../bitbake/lib') |
44 | sys.path = sys.path + [lib_path, bitbake_path] | 44 | sys.path = sys.path + [lib_path, bitbake_path] |