# HG changeset patch
# User William Stein <wstein@gmail.com>
# Date 1279237436 -7200
# Node ID e9a1810be45d270c99d903d038fd97577473762f
# Parent  5a64441a36d275f39b6b3bc2355111c491170fcd
trac 9507: if spkg-install is a Python script, first check that SAGE_LOCAL/bin/python exists.

diff -r 5a64441a36d2 -r e9a1810be45d sage-spkg
--- a/sage-spkg	Sat Jul 17 15:05:17 2010 +0200
+++ b/sage-spkg	Fri Jul 16 01:43:56 2010 +0200
@@ -314,6 +314,24 @@
 fi
 echo "****************************************************"
 
+
+##################################################################
+# If spkg-install is a Python script, verify that the Sage Python
+# has already been installed.
+##################################################################
+# Check the first line of the file for the string "python".
+head -1 spkg-install | grep python > /dev/null
+if [ $? -eq 0 ]; then   # if it is found, then the exit code will be 0
+    if [ ! -f "$SAGE_LOCAL"/bin/python ]; then   # now check if the python program is in local/bin/
+         # if so, exit with an error.  
+         echo "The spkg-install script depends on the Sage Python package,"
+         echo "but the Sage Python package is not yet installed.  This may be"
+         echo "a bug in the Sage build system dependency file.  Please"
+         echo "update the $SAGE_ROOT/spkg/standard/deps makefile."
+         exit 1
+    fi 
+fi
+
 BASEDIR=`pwd`
 if [ -n "$DEBIAN_RELEASE" ]; then
     SAGE_CHECK=''
