* [wic][PATCH] wic: Use __file__ instead of sys.argv[0]
@ 2015-04-09 12:54 Ed Bartosh
0 siblings, 0 replies; only message in thread
From: Ed Bartosh @ 2015-04-09 12:54 UTC (permalink / raw)
To: openembedded-core
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@linux.intel.com>
---
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]
--
2.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-09 12:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-09 12:54 [wic][PATCH] wic: Use __file__ instead of sys.argv[0] Ed Bartosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox