diff options
Diffstat (limited to 'scripts/contrib/list-packageconfig-flags.py')
-rwxr-xr-x | scripts/contrib/list-packageconfig-flags.py | 29 |
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 | |||
23 | import getopt | 23 | import getopt |
24 | import os | 24 | import os |
25 | 25 | ||
26 | def search_bitbakepath(): | 26 | |
27 | bitbakepath = "" | 27 | scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) |
28 | 28 | lib_path = os.path.abspath(scripts_path + '/../lib') | |
29 | # Search path to bitbake lib dir in order to load bb modules | 29 | sys.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') | 31 | import 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 |
45 | sys.path.insert(0, search_bitbakepath()) | 34 | bitbakepath = scriptpath.add_bitbake_lib_path() |
35 | if 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 | |||
46 | import bb.cache | 39 | import bb.cache |
47 | import bb.cooker | 40 | import bb.cooker |
48 | import bb.providers | 41 | import bb.providers |