Merge lp:~mandel/ubuntu-sso-client/skip-lint into lp:ubuntu-sso-client

Proposed by Manuel de la Peña on 2012-01-19
Status: Merged
Approved by: Manuel de la Peña on 2012-01-19
Approved revision: 836
Merged at revision: 836
Proposed branch: lp:~mandel/ubuntu-sso-client/skip-lint
Merge into: lp:ubuntu-sso-client
Diff against target: 132 lines (+64/-14)
1 file modified
run-tests.bat (+64/-14)
To merge this branch: bzr merge lp:~mandel/ubuntu-sso-client/skip-lint
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve on 2012-01-19
Roberto Alsina (community) 2012-01-19 Approve on 2012-01-19
Review via email: mp+89257@code.launchpad.net

Commit message

Adds the possibility to skip the lint checks on windows when passing the /skip-lint parameter to run-tests.bat.

Description of the change

Adds the possibility to skip the lint checks on windows when passing the /skip-lint parameter to run-tests.bat. The script now works as follows:

run-tests.bat /skip-lint trial_params

The above will skip the lint checks and will forward the trial parameters to u1trial, ans example of this is:

run-tests.bat /skip-lint -t test_get_homedir

if /skip-lint is not provided the scripts works as it used to

run-tests.bat -t test_get_homedir

To post a comment you must log in.
Roberto Alsina (ralsina) wrote :

+1

review: Approve
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-01-18 13:15:59 +0000
3+++ run-tests.bat 2012-01-19 14:50:08 +0000
4@@ -1,6 +1,4 @@
5-:: Author: Manuel de la Pena <manuel@canonical.com>
6-::
7-:: Copyright 2010 Canonical Ltd.
8+:: Copyright 2010-12 Canonical Ltd.
9 ::
10 :: This program is free software: you can redistribute it and/or modify it
11 :: under the terms of the GNU General Public License version 3, as published
12@@ -13,57 +11,109 @@
13 ::
14 :: You should have received a copy of the GNU General Public License along
15 :: with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17 @ECHO off
18+
19 :: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
20 :: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
21+SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
22+SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
23+SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
24+SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
25 SET PYTHONEXEPATH=""
26+
27 :: This is very annoying; FOR /F will work differently depending on the output
28 :: of reg which is not consistent between OS versions (XP, 7). We must choose
29 :: the tokens according to OS version.
30+::
31 SET PYTHONPATHTOKENS=3
32 VER | FIND "XP" > nul
33-IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
34+IF %ERRORLEVEL% == 0 (
35+ SET PYTHONPATHTOKENS=4)
36+
37 ECHO Checking if python 2.7 is in the system
38+
39 :: Look for python 2.7
40-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
41-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
42+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
43+
44+IF NOT %PYTHONEXEPATH% == "" (
45+ GOTO :PYTHONPRESENT)
46+
47 ECHO Checking if python 2.6 is in the system
48 :: we do not have python 2.7 in the system, try to find 2.6
49-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
50-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
51+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
52+
53+IF NOT %PYTHONEXEPATH% == "" (
54+ GOTO :PYTHONPRESENT)
55
56 :: we do not have python (2.6 or 2.7) this could hapen in the case that the
57 :: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
58
59 :: Look for python 2.7 in WoW64
60 ECHO Checking if python 2.7 32 is in the system
61-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
62-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
63+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
64+
65+IF NOT %PYTHONEXEPATH% == "" (
66+ GOTO :PYTHONPRESENT)
67+
68 ECHO Checking if python 2.6 32 is in the system
69 :: we do not have python 2.7 in the system, try to find 2.6
70-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXEPATH=%%A
71-IF NOT %PYTHONEXEPATH% == "" GOTO :PYTHONPRESENT
72+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
73+IF NOT %PYTHONEXEPATH% == "" (
74+ GOTO :PYTHONPRESENT)
75
76 ECHO Please ensure you have python installed
77 GOTO :END
78
79
80 :PYTHONPRESENT
81+
82+:: throw the first parameter away if is /skip-lint,
83+:: the way we do this is to ensure that /skip-lint
84+:: is the first parameter and copy all the rest in a loop
85+:: the main reason for that is that %* is not affected
86+:: by SHIFT, that is, it allways have all passed parameters
87+
88+SET PARAMS=%*
89+SET SKIPLINT=0
90+IF "%1" == "/skip-lint" (
91+ SET SKIPLINT=1
92+ GOTO :CLEANPARAMS
93+)ELSE (
94+ GOTO :CONTINUEBATCH)
95+
96+:CLEANPARAMS
97+SHIFT
98+SET PARAMS=%1
99+:GETREST
100+SHIFT
101+if [%1]==[] (
102+ GOTO CONTINUEBATCH)
103+SET PARAMS=%PARAMS% %1
104+GOTO GETREST
105+:CONTINUEBATCH
106+
107 ECHO Python found, building auto-generated modules...
108 :: call setup.py build so that the qt uic is called
109 ::START "Build code" /D%CD% /WAIT "%PYTHONEXEPATH%\python.exe" setup.py build
110 "%PYTHONEXEPATH%\python.exe" setup.py build
111 ECHO Running tests
112 :: execute the tests with a number of ignored linux only modules
113-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py, test_txsecrets.py" -p "ubuntu_sso\gtk" --reactor=qt4 --gui %* ubuntu_sso
114+"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py, test_txsecrets.py" -p "ubuntu_sso\gtk" --reactor=qt4 --gui %PARAMS% ubuntu_sso
115 :: Clean the build from the setupt.py
116-ECHO Cleaning the generated code before running the style checks...
117+ECHO Cleaning the generated code
118 "%PYTHONEXEPATH%\python.exe" setup.py clean
119+
120+IF %SKIPLINT% == 1 (
121+ ECHO Skipping style checks
122+ GOTO :CLEAN)
123+
124 ECHO Performing style checks...
125 SET IGNORE_LINT="ubuntu_sso\gtk,ubuntu_sso\networkstate\linux.py,ubuntu_sso\main\linux.py,ubuntu_sso\main\tests\test_linux.py,ubuntu_sso\utils\txsecrets.py,ubuntu_sso\utils\tests\test_txsecrets.py,ubuntu_sso\tests\bin,bin\ubuntu-sso-login"
126 "%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" -i "%IGNORE_LINT%" ubuntu_sso
127 :: test for style if we can, if pep8 is not present, move to the end
128 "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat .
129+:CLEAN
130 :: Delete the temp folders
131 RMDIR /q /s _trial_temp
132 DEL /q .coverage

Subscribers

People subscribed via source and target branches