1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

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>
This commit is contained in:
Paul Eggleton
2014-04-22 12:07:35 +01:00
committed by Richard Purdie
parent 3c7b5ec1ca
commit 2b4e1506f0
4 changed files with 74 additions and 43 deletions
+9 -9
View File
@@ -27,18 +27,18 @@ import warnings
import subprocess
from optparse import OptionParser
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
# Figure out where is the bitbake/lib/bb since we need bb.siggen and bb.process
p = subprocess.Popen("bash -c 'echo $(dirname $(which bitbake-diffsigs | grep -v \'^alias\'))/../lib'",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
err = p.stderr.read()
if err:
print("ERROR: Failed to locate bitbake-diffsigs:", file=sys.stderr)
print(err, file=sys.stderr)
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)
sys.path.insert(0, p.stdout.read().rstrip('\n'))
import bb.siggen
import bb.process