diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-04-22 12:07:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-25 13:51:45 +0100 |
commit | 2b4e1506f054fded57dd361c347bdb25ddd9e245 (patch) | |
tree | 3572b1196bac1686df976507e0081e76de9dd2e7 /scripts/bitbake-whatchanged | |
parent | 3c7b5ec1cae6186a64e0be2c05b64b05add08c97 (diff) | |
download | poky-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/bitbake-whatchanged')
-rwxr-xr-x | scripts/bitbake-whatchanged | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/bitbake-whatchanged b/scripts/bitbake-whatchanged index e4497e03a8..55cfe4b234 100755 --- a/scripts/bitbake-whatchanged +++ b/scripts/bitbake-whatchanged | |||
@@ -27,17 +27,17 @@ import warnings | |||
27 | import subprocess | 27 | import subprocess |
28 | from optparse import OptionParser | 28 | from optparse import OptionParser |
29 | 29 | ||
30 | # Figure out where is the bitbake/lib/bb since we need bb.siggen and bb.process | 30 | scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0]))) |
31 | p = subprocess.Popen("bash -c 'echo $(dirname $(which bitbake-diffsigs | grep -v \'^alias\'))/../lib'", | 31 | lib_path = scripts_path + '/lib' |
32 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 32 | sys.path = sys.path + [lib_path] |
33 | 33 | ||
34 | err = p.stderr.read() | 34 | import scriptpath |
35 | if err: | ||
36 | print("ERROR: Failed to locate bitbake-diffsigs:", file=sys.stderr) | ||
37 | print(err, file=sys.stderr) | ||
38 | sys.exit(1) | ||
39 | 35 | ||
40 | sys.path.insert(0, p.stdout.read().rstrip('\n')) | 36 | # Figure out where is the bitbake/lib/bb since we need bb.siggen and bb.process |
37 | bitbakepath = scriptpath.add_bitbake_lib_path() | ||
38 | if not bitbakepath: | ||
39 | sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n") | ||
40 | sys.exit(1) | ||
41 | 41 | ||
42 | import bb.siggen | 42 | import bb.siggen |
43 | import bb.process | 43 | import bb.process |