[oe-commits] Ed Bartosh : wic: Use __file__ instead of sys.argv[0]
git at git.openembedded.org
git at git.openembedded.org
Mon Apr 13 21:34:39 UTC 2015
Module: openembedded-core.git
Branch: master
Commit: 7166262032648dbbc8b4b476c8770e35b1d4e234
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=7166262032648dbbc8b4b476c8770e35b1d4e234
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date: Thu Apr 9 15:54:35 2015 +0300
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.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/wic | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/wic b/scripts/wic
index dcf1a55..fd4a678 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -38,7 +38,7 @@ import optparse
import logging
# External modules
-scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
+scripts_path = os.path.abspath(os.path.dirname(__file__))
lib_path = scripts_path + '/lib'
bitbake_path = os.path.join(scripts_path, '../bitbake/lib')
sys.path = sys.path + [lib_path, bitbake_path]
More information about the Openembedded-commits
mailing list