Patchwork [bitbake-devel,7/8] toaster start script allows for Django 1.6

login
register
mail settings
Submitter Alexandru DAMIAN
Date July 18, 2014, 12:15 p.m.
Message ID <7f5ce509f977fff964aa2bc30a13c5e7a326facc.1405685308.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/76057/
State New
Headers show

Comments

Alexandru DAMIAN - July 18, 2014, 12:15 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

We perform upgrade to Django 1.6 in order to keep using
a current Django version. In practice, this means
allowing for both 1.5 and 1.6 version in the toaster
start script. We also modify the suggestion
installation commands to remove "sudo" since now pip
can be used in a virtualenv.

Update requirements.txt to install the 1.6 Django release.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bin/toaster      | 13 ++++++++-----
 requirements.txt |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

Patch

diff --git a/bin/toaster b/bin/toaster
index 93d75b0..ce16de6 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -63,8 +63,10 @@  function webserverStartAll()
             retval=0
             python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
         fi
-        python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1
-	python $BBBASEDIR/lib/toaster/manage.py checksettings  || retval=1
+	if [ "x$TOASTER_MANAGED" == "x1" ]; then
+	        python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1
+		python $BBBASEDIR/lib/toaster/manage.py checksettings  || retval=1
+	fi
 	echo "Starting webserver"
         if [ $retval -eq 0 ]; then
             python $BBBASEDIR/lib/toaster/manage.py runserver 0.0.0.0:8000 </dev/null >${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid
@@ -140,6 +142,7 @@  if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th
         webserverKillAll
         RUNNING=0
     }
+    TOASTER_MANAGED=1
     export TOASTER_MANAGED=1
     webserverStartAll || (echo "Fail to start the web server, stopping" 1>&2 && exit 1)
     xdg-open http://0.0.0.0:8000/ >/dev/null 2>&1 &
@@ -163,13 +166,13 @@  fi
 
 # Verify prerequisites
 
-if ! echo "import django; print (1,5) == django.VERSION[0:2]" | python 2>/dev/null | grep True >/dev/null; then
-    echo -e "This program needs Django 1.5. Please install with\n\nsudo pip install django==1.5"
+if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (5,6)" | python 2>/dev/null | grep True >/dev/null; then
+    echo -e "This program needs Django 1.5 or 1.6. Please install with\n\npip install django==1.6"
     return 2
 fi
 
 if ! echo "import south; print [0,8,4] ==  map(int,south.__version__.split(\".\"))" | python 2>/dev/null | grep True >/dev/null; then
-    echo -e "This program needs South 0.8.4. Please install with\n\nsudo pip install south==0.8.4"
+    echo -e "This program needs South 0.8.4. Please install with\n\npip install south==0.8.4"
     return 2
 fi
 
diff --git a/requirements.txt b/requirements.txt
index 2bb07e6..19b5293 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@ 
-Django==1.5
+Django==1.6
 South==0.8.4
 argparse==1.2.1
 wsgiref==0.1.2