meta/files/toolchain-shar-relocate.sh: Detect different python binaries and select one that exists.
Although the relocate_sdk.sh supports python3, fc23 does not symlink /usr/bin/python3 to /usr/bin/python. Using exec instead of a call to the correct interpreter causes a failure on fc23 when python2 is not present. This uses 'which' to locate python, python2, then python3 and uses the first one that's found. (From OE-Core rev: 99d4d97f51b658d58a50789056b422e48df89ad9) Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
924e2c37a4
commit
92abb5f1ce
|
@ -13,8 +13,23 @@ if [ x$tdir = x ] ; then
|
||||||
echo "SDK relocate failed, could not create a temporary directory"
|
echo "SDK relocate failed, could not create a temporary directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "#!/bin/bash" > $tdir/relocate_sdk.sh
|
cat <<EOF >> $tdir/relocate_sdk.sh
|
||||||
echo exec ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files >> $tdir/relocate_sdk.sh
|
#!/bin/bash
|
||||||
|
for py in python python2 python3
|
||||||
|
do
|
||||||
|
PYTHON=\`which \${py} 2>/dev/null\`
|
||||||
|
if [ \$? -eq 0 ]; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x\${PYTHON} = "x" ]; then
|
||||||
|
echo "SDK could not be relocated. No python found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files
|
||||||
|
EOF
|
||||||
|
|
||||||
$SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh
|
$SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh
|
||||||
$SUDO_EXEC chmod 755 ${env_setup_script%/*}/relocate_sdk.sh
|
$SUDO_EXEC chmod 755 ${env_setup_script%/*}/relocate_sdk.sh
|
||||||
rm -rf $tdir
|
rm -rf $tdir
|
||||||
|
|
Loading…
Reference in New Issue