release note: SF Bug 1912 - Raptor should take python from the path [if not set with SBS_PYTHON or bundled with Raptor] fix
authorJon Chatten
Fri, 26 Feb 2010 14:51:57 +0000
branchfix
changeset 276 e80c44f576df
parent 275 b30e816f1d39
child 280 8ba60ea0ce9a
release note: SF Bug 1912 - Raptor should take python from the path [if not set with SBS_PYTHON or bundled with Raptor]
sbsv2/raptor/RELEASE-NOTES.txt
sbsv2/raptor/bin/sbs
sbsv2/raptor/bin/sbs.bat
--- a/sbsv2/raptor/RELEASE-NOTES.txt	Fri Feb 26 14:41:19 2010 +0000
+++ b/sbsv2/raptor/RELEASE-NOTES.txt	Fri Feb 26 14:51:57 2010 +0000
@@ -3,6 +3,7 @@
 next version
 
 Defect Fixes:
+- SF Bug 1912 - Raptor should take python from the path [if not set with SBS_PYTHON or bundled with Raptor]
 - SF Bug 2042 - [Raptor] component field empty in recipe
 - SF Bug 2007 - [Raptor] GCCE 4.4.1 builds require 4.3.1 and 4.3.2 SBS_GCCE???BIN env vars etc.
 - SF Bug 2000 - [Raptor] Talon fails when installed in a path containing the string '-c' (windows only)
--- a/sbsv2/raptor/bin/sbs	Fri Feb 26 14:41:19 2010 +0000
+++ b/sbsv2/raptor/bin/sbs	Fri Feb 26 14:51:57 2010 +0000
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -17,7 +17,7 @@
 #
 
 # If SBS_HOME is not set in the environment then work it out
-# from the path to this batch file
+# from the path to this script
 if [ -z "$SBS_HOME" ] ; then
 	temp=$0
 	SBS_HOME=$(cd ${temp%/*} && echo $PWD)
@@ -62,30 +62,44 @@
 fi
 
 if [ "$OSTYPE" == "cygwin" ]; then
-
-	SBS_HOME=${SBS_HOME//\\//}
-
 	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
 	__CYGWIN__=${SBS_CYGWIN:-$SBS_HOME/$HOSTPLATFORM_DIR/cygwin}
-	__PYTHON__=${SBS_PYTHON:-$SBS_HOME/$HOSTPLATFORM_DIR/python264/python.exe}
-	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python264}
 
-    # Command for unifying path strings. For example, "c:\some\path" and
-    # "/cygdrive/c/some/path" will both be converted into "c:/some/path".
+	# Command for unifying path strings. For example, "c:\some\path" and
+	# "/cygdrive/c/some/path" will both be converted into "c:/some/path".
 	u="$__CYGWIN__/bin/cygpath.exe -m"
-
+	
+	SBS_HOME=${SBS_HOME//\\//}
+	export SBS_HOME=$($u "$SBS_HOME")
+	
 	__MINGW__=$($u "$__MINGW__")
 	__CYGWIN__=$($u "$__MINGW__")
-	__PYTHON__=$($u "$__PYTHON__")
-
-	export SBS_HOME=$($u "$SBS_HOME")
-
 	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
 
 	# Tell Cygwin not to map unix security attributes to windows to
 	# prevent raptor from potentially creating read-only files:
 	export CYGWIN='nontsec nosmbntsec'
 
+	# The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
+	#  1. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
+	#  2. the python shipped locally with Raptor (if present)
+	#  3. the python on the system PATH and the PYTHONPATH set in the system environment
+
+	__LOCAL_PYTHON__=$SBS_HOME/win32/python264/python.exe
+
+	if [ -n "$SBS_PYTHON" ]; then
+		__PYTHON__=$SBS_PYTHON
+	elif [ -f "$__LOCAL_PYTHON__" ]; then
+		__PYTHON__=$__LOCAL_PYTHON__
+		export PYTHONPATH=
+	else
+		__PYTHON__=python.exe
+	fi
+	__PYTHON__=$($u "$__PYTHON__")		
+
+	if [ -n "$SBS_PYTHONPATH" ]; then
+		export PYTHONPATH=$($u "$SBS_PYTHONPATH")
+	fi
 else
 	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python262/lib}
 	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/python262/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
--- a/sbsv2/raptor/bin/sbs.bat	Fri Feb 26 14:41:19 2010 +0000
+++ b/sbsv2/raptor/bin/sbs.bat	Fri Feb 26 14:51:57 2010 +0000
@@ -1,5 +1,5 @@
 @rem
-@rem Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 @rem All rights reserved.
 @rem This component and the accompanying materials are made available
 @rem under the terms of the License "Eclipse Public License v1.0"
@@ -28,11 +28,27 @@
 @cd /d %WD%
 :foundhome 
 
-@REM Use the python set by the environment if possible
+@REM The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
+@REM 1. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
+@REM 2. the python shipped locally with Raptor (if present)
+@REM 3. the python on the system PATH and the PYTHONPATH set in the system environment
+
+@SET __LOCAL_PYTHON__=%SBS_HOME%\win32\python264\python.exe
+@IF NOT "%SBS_PYTHON%"=="" GOTO sbspython
+@IF EXIST %__LOCAL_PYTHON__% GOTO localpython
+@SET __PYTHON__=python.exe
+@GOTO sbspythonpath
+
+:sbspython
 @SET __PYTHON__=%SBS_PYTHON%
-@IF "%__PYTHON__%"=="" SET __PYTHON__=%SBS_HOME%\win32\python264\python.exe
-@SET PYTHONPATH=%SBS_PYTHONPATH%
-@IF "%PYTHONPATH%"=="" SET PYTHONPATH=%SBS_HOME%\win32\python264
+@GOTO sbspythonpath
+
+:localpython
+@SET __PYTHON__=%__LOCAL_PYTHON__%
+@SET PYTHONPATH=
+
+:sbspythonpath
+@IF NOT "%SBS_PYTHONPATH%"=="" SET PYTHONPATH=%SBS_PYTHONPATH%
 
 @REM Use the mingw set by the environment if possible
 @SET __MINGW__=%SBS_MINGW%