Merge lp:~mandel/ubuntuone-dev-tools/fix-runtests into lp:ubuntuone-dev-tools

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 66
Merged at revision: 64
Proposed branch: lp:~mandel/ubuntuone-dev-tools/fix-runtests
Merge into: lp:ubuntuone-dev-tools
Diff against target: 82 lines (+42/-12)
1 file modified
run-tests.bat (+42/-12)
To merge this branch: bzr merge lp:~mandel/ubuntuone-dev-tools/fix-runtests
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Review via email: mp+102828@code.launchpad.net

Commit message

- Changed the way in which python is found and ensured that we use PYTHONEXEPATH to not override the PYTHONPATH value (LP: #986125).

Description of the change

- Changed the way in which python is found and ensured that we use PYTHONEXEPATH to not override the PYTHONPATH value (LP: #986125).

To post a comment you must log in.
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'run-tests.bat'
--- run-tests.bat 2012-04-18 20:08:00 +0000
+++ run-tests.bat 2012-04-20 10:52:20 +0000
@@ -27,36 +27,66 @@
27:: version. If you delete this exception statement from all source27:: version. If you delete this exception statement from all source
28:: files in the program, then also delete it here.28:: files in the program, then also delete it here.
29@ECHO off29@ECHO off
30
30:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,31:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
31:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.32:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
32SET PYTHONPATH=""33SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
34SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
35SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
36SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
37SET PYTHONEXEPATH=""
38
33:: This is very annoying; FOR /F will work differently depending on the output39:: This is very annoying; FOR /F will work differently depending on the output
34:: of reg which is not consistent between OS versions (XP, 7). We must choose40:: of reg which is not consistent between OS versions (XP, 7). We must choose
35:: the tokens according to OS version.41:: the tokens according to OS version.
42::
36SET PYTHONPATHTOKENS=343SET PYTHONPATHTOKENS=3
37VER | FIND "XP" > nul44VER | FIND "XP" > nul
38IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=445IF %ERRORLEVEL% == 0 (
46 SET PYTHONPATHTOKENS=4)
47
39ECHO Checking if python 2.7 is in the system48ECHO Checking if python 2.7 is in the system
49
40:: Look for python 2.750:: Look for python 2.7
41FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONPATH=%%A51FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
42IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT52
53IF NOT %PYTHONEXEPATH% == "" (
54 GOTO :PYTHONPRESENT)
55
43ECHO Checking if python 2.6 is in the system56ECHO Checking if python 2.6 is in the system
44:: we do not have python 2.7 in the system, try to find 2.657:: we do not have python 2.7 in the system, try to find 2.6
45FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONPATH=%%A58FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
46IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT59
47:: we do not have python (2.6 or 2.7), therefore we go to end60IF NOT %PYTHONEXEPATH% == "" (
61 GOTO :PYTHONPRESENT)
62
63:: we do not have python (2.6 or 2.7) this could hapen in the case that the
64:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
65
66:: Look for python 2.7 in WoW64
67ECHO Checking if python 2.7 32 is in the system
68FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
69
70IF NOT %PYTHONEXEPATH% == "" (
71 GOTO :PYTHONPRESENT)
72
73ECHO Checking if python 2.6 32 is in the system
74:: we do not have python 2.7 in the system, try to find 2.6
75FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
76IF NOT %PYTHONEXEPATH% == "" (
77 GOTO :PYTHONPRESENT)
78
48ECHO Please ensure you have python installed79ECHO Please ensure you have python installed
49GOTO :END80GOTO :END
5081
51
52:PYTHONPRESENT82:PYTHONPRESENT
53ECHO Python found, executing the tests...83ECHO Python found, executing the tests...
54:: execute the tests with a number of ignored linux only modules84:: execute the tests with a number of ignored linux only modules
55"%PYTHONPATH%\python.exe" bin/u1trial --reactor=twisted -c ubuntuone85"%PYTHONEXEPATH%\python.exe" bin/u1trial --reactor=twisted -c ubuntuone
56"%PYTHONPATH%\python.exe" bin/u1lint86"%PYTHONEXEPATH%\python.exe" bin/u1lint
57:: test for style if we can, if pep8 is not present, move to the end87:: test for style if we can, if pep8 is not present, move to the end
58IF EXIST "%PYTHONPATH%Scripts\pep8.exe"88IF EXIST "%PYTHONEXEPATH%Scripts\pep8.exe"
59START "Pep8" /B "%PYTHONPATH%\Scripts\pep8.exe" --repeat89START "Pep8" /B "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat
60ELSE90ELSE
61ECHO Style checks were not done91ECHO Style checks were not done
62:: Delete the temp folders92:: Delete the temp folders

Subscribers

People subscribed via source and target branches

to all changes: