diff options
| -rwxr-xr-x | scripts/contrib/list-packageconfig-flags.py | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py index 149922dc53..371033a3d8 100755 --- a/scripts/contrib/list-packageconfig-flags.py +++ b/scripts/contrib/list-packageconfig-flags.py | |||
| @@ -23,8 +23,26 @@ import sys | |||
| 23 | import getopt | 23 | import getopt |
| 24 | import os | 24 | import os |
| 25 | 25 | ||
| 26 | def search_bitbakepath(): | ||
| 27 | bitbakepath = "" | ||
| 28 | |||
| 29 | # Search path to bitbake lib dir in order to load bb modules | ||
| 30 | if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')): | ||
| 31 | bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib') | ||
| 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 | |||
| 26 | # For importing the following modules | 44 | # For importing the following modules |
| 27 | sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '../../bitbake/lib')) | 45 | sys.path.insert(0, search_bitbakepath()) |
| 28 | import bb.cache | 46 | import bb.cache |
| 29 | import bb.cooker | 47 | import bb.cooker |
| 30 | import bb.providers | 48 | import bb.providers |
| @@ -39,12 +57,12 @@ OPTION: | |||
| 39 | -p, --prefer list pkgs with preferred version | 57 | -p, --prefer list pkgs with preferred version |
| 40 | 58 | ||
| 41 | EXAMPLE: | 59 | EXAMPLE: |
| 42 | list-packageconfig-flags.py poky/meta poky/meta-yocto | 60 | list-packageconfig-flags.py |
| 43 | list-packageconfig-flags.py -f poky/meta poky/meta-yocto | 61 | list-packageconfig-flags.py -f |
| 44 | list-packageconfig-flags.py -a poky/meta poky/meta-yocto | 62 | list-packageconfig-flags.py -a |
| 45 | list-packageconfig-flags.py -p poky/meta poky/meta-yocto | 63 | list-packageconfig-flags.py -p |
| 46 | list-packageconfig-flags.py -f -p poky/meta poky/meta-yocto | 64 | list-packageconfig-flags.py -f -p |
| 47 | list-packageconfig-flags.py -a -p poky/meta poky/meta-yocto | 65 | list-packageconfig-flags.py -a -p |
| 48 | ''' | 66 | ''' |
| 49 | 67 | ||
| 50 | def usage(): | 68 | def usage(): |
