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
1=== modified file 'run-tests.bat'
2--- run-tests.bat 2012-04-18 20:08:00 +0000
3+++ run-tests.bat 2012-04-20 10:52:20 +0000
4@@ -27,36 +27,66 @@
5 :: version. If you delete this exception statement from all source
6 :: files in the program, then also delete it here.
7 @ECHO off
8+
9 :: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
10 :: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
11-SET PYTHONPATH=""
12+SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
13+SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
14+SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
15+SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
16+SET PYTHONEXEPATH=""
17+
18 :: This is very annoying; FOR /F will work differently depending on the output
19 :: of reg which is not consistent between OS versions (XP, 7). We must choose
20 :: the tokens according to OS version.
21+::
22 SET PYTHONPATHTOKENS=3
23 VER | FIND "XP" > nul
24-IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
25+IF %ERRORLEVEL% == 0 (
26+ SET PYTHONPATHTOKENS=4)
27+
28 ECHO Checking if python 2.7 is in the system
29+
30 :: Look for python 2.7
31-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONPATH=%%A
32-IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
33+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
34+
35+IF NOT %PYTHONEXEPATH% == "" (
36+ GOTO :PYTHONPRESENT)
37+
38 ECHO Checking if python 2.6 is in the system
39 :: we do not have python 2.7 in the system, try to find 2.6
40-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONPATH=%%A
41-IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
42-:: we do not have python (2.6 or 2.7), therefore we go to end
43+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
44+
45+IF NOT %PYTHONEXEPATH% == "" (
46+ GOTO :PYTHONPRESENT)
47+
48+:: we do not have python (2.6 or 2.7) this could hapen in the case that the
49+:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
50+
51+:: Look for python 2.7 in WoW64
52+ECHO Checking if python 2.7 32 is in the system
53+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
54+
55+IF NOT %PYTHONEXEPATH% == "" (
56+ GOTO :PYTHONPRESENT)
57+
58+ECHO Checking if python 2.6 32 is in the system
59+:: we do not have python 2.7 in the system, try to find 2.6
60+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
61+IF NOT %PYTHONEXEPATH% == "" (
62+ GOTO :PYTHONPRESENT)
63+
64 ECHO Please ensure you have python installed
65 GOTO :END
66
67-
68 :PYTHONPRESENT
69 ECHO Python found, executing the tests...
70 :: execute the tests with a number of ignored linux only modules
71-"%PYTHONPATH%\python.exe" bin/u1trial --reactor=twisted -c ubuntuone
72-"%PYTHONPATH%\python.exe" bin/u1lint
73+"%PYTHONEXEPATH%\python.exe" bin/u1trial --reactor=twisted -c ubuntuone
74+"%PYTHONEXEPATH%\python.exe" bin/u1lint
75 :: test for style if we can, if pep8 is not present, move to the end
76-IF EXIST "%PYTHONPATH%Scripts\pep8.exe"
77-START "Pep8" /B "%PYTHONPATH%\Scripts\pep8.exe" --repeat
78+IF EXIST "%PYTHONEXEPATH%Scripts\pep8.exe"
79+START "Pep8" /B "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat
80 ELSE
81 ECHO Style checks were not done
82 :: Delete the temp folders

Subscribers

People subscribed via source and target branches

to all changes: