bitbake: toaster: rework checking of Django version
Checked django version considering information from toaster-requirements.txt, e.g. if requirements file contains line "Django>1.8,<1.9" toaster should be able to check that requirement correctly. (Bitbake rev: 49976eca4a6e37e7653814c569badcd3e0fb719a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
4a78416943
commit
4ff0d60ea8
|
@ -156,16 +156,15 @@ notify_chldexit() {
|
||||||
|
|
||||||
|
|
||||||
verify_prereq() {
|
verify_prereq() {
|
||||||
# Verify prerequisites
|
# Verify Django version
|
||||||
regex="([0-9])\.([0-9])"
|
reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
|
||||||
for line in `cat $BBBASEDIR/toaster-requirements.txt | grep Django` ; do
|
exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/'
|
||||||
[[ `echo $line` =~ $regex ]]
|
exp=$exp'import sys,django;version=django.get_version().split(".");'
|
||||||
required_major_version="${BASH_REMATCH[1]}"
|
exp=$exp'sys.exit(not (version \1 "\2".split(".") and version \3 "\4".split(".")))/p'
|
||||||
required_minor_version="${BASH_REMATCH[2]}"
|
if ! sed -n "$exp" $reqfile | python - ; then
|
||||||
done
|
req=`grep ^Django $reqfile`
|
||||||
|
echo "This program needs $req"
|
||||||
if ! echo "import django; print ($required_major_version,) == django.VERSION[0:1] and django.VERSION[1:2][0] in ($required_minor_version,)" | python 2>/dev/null | grep True >/dev/null; then
|
echo "Please install with pip install -r $reqfile"
|
||||||
printf "This program needs Django $required_major_version.$required_minor_version. Please install with\n\npip install -r $BBBASEDIR/toaster-requirements.txt\n"
|
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -265,10 +264,7 @@ if [ "$1" = 'restart-bitbake' ] ; then
|
||||||
return $rc
|
return $rc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! verify_prereq; then
|
verify_prereq || return 1
|
||||||
echo "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We make sure we're running in the current shell and in a good environment
|
# We make sure we're running in the current shell and in a good environment
|
||||||
if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
|
if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Django==1.8.6
|
Django>1.8,<1.9
|
||||||
argparse==1.2.1
|
argparse==1.2.1
|
||||||
wsgiref==0.1.2
|
wsgiref==0.1.2
|
||||||
beautifulsoup4>=4.4.0
|
beautifulsoup4>=4.4.0
|
||||||
|
|
Loading…
Reference in New Issue