summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-04-09 15:54:35 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-13 22:33:20 +0100
commit7141e488092f9833e349ce95f856dd9e26aa0f7b (patch)
treea97e27c16455b2b11fa87cebff80cb00acbaa9f5
parentd0d0ab85c49d7a874bef8b8d8844bbe9b1dc0c49 (diff)
downloadpoky-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>
-rwxr-xr-xscripts/wic2
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
38import logging 38import logging
39 39
40# External modules 40# External modules
41scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) 41scripts_path = os.path.abspath(os.path.dirname(__file__))
42lib_path = scripts_path + '/lib' 42lib_path = scripts_path + '/lib'
43bitbake_path = os.path.join(scripts_path, '../bitbake/lib') 43bitbake_path = os.path.join(scripts_path, '../bitbake/lib')
44sys.path = sys.path + [lib_path, bitbake_path] 44sys.path = sys.path + [lib_path, bitbake_path]