summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-04-22 12:07:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-25 13:51:45 +0100
commit2b4e1506f054fded57dd361c347bdb25ddd9e245 (patch)
tree3572b1196bac1686df976507e0081e76de9dd2e7 /scripts/contrib
parent3c7b5ec1cae6186a64e0be2c05b64b05add08c97 (diff)
downloadpoky-2b4e1506f054fded57dd361c347bdb25ddd9e245.tar.gz
scripts: consolidate code to find bitbake path
Several of these scripts were using duplicated code (and slightly different methods) to find the path to bitbake and add its lib subdirectory to the Python import path. Add some common code to do this and change the scripts to use it. Fixes [YOCTO #5076]. (From OE-Core rev: 0b5e94e168819134dcda0433c8ae893df4ab13ce) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/list-packageconfig-flags.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py
index 371033a3d8..615f91fdc7 100755
--- a/scripts/contrib/list-packageconfig-flags.py
+++ b/scripts/contrib/list-packageconfig-flags.py
@@ -23,26 +23,19 @@ import sys
23import getopt 23import getopt
24import os 24import os
25 25
26def search_bitbakepath(): 26
27 bitbakepath = "" 27scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
28 28lib_path = os.path.abspath(scripts_path + '/../lib')
29 # Search path to bitbake lib dir in order to load bb modules 29sys.path = sys.path + [lib_path]
30 if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')): 30
31 bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib') 31import scriptpath
32 bitbakepath = os.path.abspath(bitbakepath)
33 else:
34 # Look for bitbake/bin dir in PATH
35 for pth in os.environ['PATH'].split(':'):
36 if os.path.exists(os.path.join(pth, '../lib/bb')):
37 bitbakepath = os.path.abspath(os.path.join(pth, '../lib'))
38 break
39 if not bitbakepath:
40 sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
41 sys.exit(1)
42 return bitbakepath
43 32
44# For importing the following modules 33# For importing the following modules
45sys.path.insert(0, search_bitbakepath()) 34bitbakepath = scriptpath.add_bitbake_lib_path()
35if not bitbakepath:
36 sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
37 sys.exit(1)
38
46import bb.cache 39import bb.cache
47import bb.cooker 40import bb.cooker
48import bb.providers 41import bb.providers