From c0baf7867408484ba85046da742ce0b47d5594dc Mon Sep 17 00:00:00 2001 From: gladman Date: Wed, 9 Jun 2010 11:36:46 +0000 Subject: [PATCH] Improve Python detection in Jason's Windows batch build --- build.vc10/make.bat | 18 ++++++------------ build.vc9/make.bat | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/build.vc10/make.bat b/build.vc10/make.bat index b8413ec1..24ff13ac 100644 --- a/build.vc10/make.bat +++ b/build.vc10/make.bat @@ -76,22 +76,16 @@ if errorlevel 1 ( exit /b 1 ) cd mpir-tests -python --version >nul 2>&1 +@echo off +for /f "usebackq tokens=1*" %%f in (`reg query HKCR\Python.File\shell\open\command`) do (set _my_=%%f %%g) if not errorlevel 1 goto :got -if exist c:\Python26 ( - set "PATH=%PATH%;c:\Python26" - python --version >nul 2>&1 - if not errorlevel 1 goto :got -) -if exist c:\Python30 ( - set "PATH=%PATH%;c:\Python30" - python --version >nul 2>&1 - if not errorlevel 1 goto :got -) echo ERROR Could not find PYTHON exit /b 1 :got -python run-tests.py noenter +set _res_=%_my_:*REG_SZ=% +set _end_=%_res_:*exe"=% +call set _python_=%%_res_:%_end_%=%% +call %_python_% run-tests.py noenter set RET=%ERRORLEVEL% cd .. exit /b %RET% diff --git a/build.vc9/make.bat b/build.vc9/make.bat index 15c73ca3..db082d20 100644 --- a/build.vc9/make.bat +++ b/build.vc9/make.bat @@ -67,22 +67,16 @@ if errorlevel 1 ( exit /b 1 ) cd mpir-tests -python --version >nul 2>&1 +@echo off +for /f "usebackq tokens=1*" %%f in (`reg query HKCR\Python.File\shell\open\command`) do (set _my_=%%f %%g) if not errorlevel 1 goto :got -if exist c:\Python26 ( - set "PATH=%PATH%;c:\Python26" - python --version >nul 2>&1 - if not errorlevel 1 goto :got -) -if exist c:\Python30 ( - set "PATH=%PATH%;c:\Python30" - python --version >nul 2>&1 - if not errorlevel 1 goto :got -) echo ERROR Could not find PYTHON exit /b 1 :got -python run-tests.py noenter +set _res_=%_my_:*REG_SZ=% +set _end_=%_res_:*exe"=% +call set _python_=%%_res_:%_end_%=%% +call %_python_% run-tests.py noenter set RET=%ERRORLEVEL% cd .. exit /b %RET%