[oe-commits] Corneliu Stoicescu : scripts/test-remote-image: use the scriptpath module
git at git.openembedded.org
git at git.openembedded.org
Fri Jul 18 23:14:11 UTC 2014
Module: openembedded-core.git
Branch: master-next
Commit: 32c5b31d8a22bb8ba49db8a5c797ad0f421e67a3
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=32c5b31d8a22bb8ba49db8a5c797ad0f421e67a3
Author: Corneliu Stoicescu <corneliux.stoicescu at intel.com>
Date: Thu Jul 17 19:11:47 2014 +0300
scripts/test-remote-image: use the scriptpath module
Use the scripts/lib/scriptpath module in order to standardize the adding of bitbake/lib and meta/lib to sys.path.
Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/test-remote-image | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/test-remote-image b/scripts/test-remote-image
index 8120a62..f3a44eb 100755
--- a/scripts/test-remote-image
+++ b/scripts/test-remote-image
@@ -32,8 +32,15 @@ import logging
import shutil
from abc import ABCMeta, abstractmethod
+# Add path to scripts/lib in sys.path;
+scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
+lib_path = scripts_path + '/lib'
+sys.path = sys.path + [lib_path]
+
+import scriptpath
+
# Add meta/lib to sys.path
-sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'meta/lib')))
+scriptpath.add_oe_lib_path()
import oeqa.utils.ftools as ftools
from oeqa.utils.commands import runCmd, bitbake, get_bb_var
@@ -43,7 +50,10 @@ for path in get_bb_var('BBPATH').split(":"):
sys.path.insert(0, os.path.abspath(os.path.join(path, 'lib')))
# In order to import modules that contain target controllers, we need the bitbake libraries in sys.path .
-sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'bitbake/lib')))
+bitbakepath = scriptpath.add_bitbake_lib_path()
+if not bitbakepath:
+ sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
+ sys.exit(1)
# create a logger
def logger_create():
More information about the Openembedded-commits
mailing list