~mvo/ubuntu-sso-client/strawman-lp711413

812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
1
:: Copyright 2010-12 Canonical Ltd.
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
2
::
3
:: This program is free software: you can redistribute it and/or modify it
4
:: under the terms of the GNU General Public License version 3, as published
5
:: by the Free Software Foundation.
6
::
7
:: This program is distributed in the hope that it will be useful, but
8
:: WITHOUT ANY WARRANTY; without even the implied warranties of
9
:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
10
:: PURPOSE.  See the GNU General Public License for more details.
11
::
12
:: You should have received a copy of the GNU General Public License along
13
:: with this program.  If not, see <http://www.gnu.org/licenses/>.
812.129.1 by Rodney Dawes
Add OpenSSL license exception
14
::
15
:: In addition, as a special exception, the copyright holders give
16
:: permission to link the code of portions of this program with the
17
:: OpenSSL library under certain conditions as described in each
18
:: individual source file, and distribute linked combinations
19
:: including the two.
20
:: You must obey the GNU General Public License in all respects
21
:: for all of the code used other than OpenSSL.  If you modify
22
:: file(s) with this exception, you may extend this exception to your
23
:: version of the file(s), but you are not obligated to do so.  If you
24
:: do not wish to do so, delete this exception statement from your
25
:: version.  If you delete this exception statement from all source
26
:: files in the program, then also delete it here.
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
27
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
28
@ECHO off
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
29
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
30
:: 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.
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
32
SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
33
SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
34
SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
35
SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
36
SET PYTHONEXEPATH=""
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
37
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
38
:: This is very annoying; FOR /F will work differently depending on the output
39
:: of reg which is not consistent between OS versions (XP, 7). We must choose
40
:: the tokens according to OS version.
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
41
::
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
42
SET PYTHONPATHTOKENS=3
43
VER | FIND "XP" > nul
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
44
IF %ERRORLEVEL% == 0 (
45
    SET PYTHONPATHTOKENS=4)
46
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
47
ECHO Checking if python 2.7 is in the system
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
48
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
49
:: Look for python 2.7
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
50
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
51
52
IF NOT %PYTHONEXEPATH% == "" (
53
    GOTO :PYTHONPRESENT)
54
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
55
ECHO Checking if python 2.6 is in the system
56
:: we do not have python 2.7 in the system, try to find 2.6
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
57
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
58
59
IF NOT %PYTHONEXEPATH% == "" (
60
    GOTO :PYTHONPRESENT)
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
61
62
:: we do not have python (2.6 or 2.7) this could hapen in the case  that the
63
:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
64
65
:: Look for python 2.7 in WoW64
66
ECHO Checking if python 2.7 32 is in the system
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
67
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
68
69
IF NOT %PYTHONEXEPATH% == "" (
70
    GOTO :PYTHONPRESENT)
71
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
72
ECHO Checking if python 2.6 32 is in the system
73
:: we do not have python 2.7 in the system, try to find 2.6
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
74
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
75
IF NOT %PYTHONEXEPATH% == "" (
76
    GOTO :PYTHONPRESENT)
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
77
78
ECHO Please ensure you have python installed
79
GOTO :END
80
81
82
:PYTHONPRESENT
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
83
84
:: throw the first parameter away if is /skip-lint,
85
:: the way we do this is to ensure that /skip-lint
86
:: is the first parameter and copy all the rest in a loop
87
:: the main reason for that is that %* is not affected
88
:: by SHIFT, that is, it allways have all passed parameters
89
90
SET PARAMS=%*
91
SET SKIPLINT=0
92
IF "%1" == "/skip-lint" (
93
    SET SKIPLINT=1
94
    GOTO :CLEANPARAMS
95
)ELSE (
96
    GOTO :CONTINUEBATCH)
97
98
:CLEANPARAMS
99
SHIFT
100
SET PARAMS=%1
101
:GETREST
102
SHIFT
103
if [%1]==[] (
104
    GOTO CONTINUEBATCH)
105
SET PARAMS=%PARAMS% %1
106
GOTO GETREST
107
:CONTINUEBATCH
108
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
109
ECHO Python found, building auto-generated modules...
110
:: call setup.py build so that the qt uic is called
111
::START "Build code" /D%CD% /WAIT "%PYTHONEXEPATH%\python.exe" setup.py build
112
"%PYTHONEXEPATH%\python.exe" setup.py build
113
ECHO Running tests
114
:: execute the tests with a number of ignored linux only modules
812.75.8 by Natalia B. Bidart
- Fixed window tests run.
115
"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py, test_txsecrets.py, test_qt.py, test_glib.py" -p "ubuntu_sso\gtk" --reactor=qt4 --gui %PARAMS% ubuntu_sso 
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
116
:: Clean the build from the setupt.py
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
117
ECHO Cleaning the generated code
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
118
"%PYTHONEXEPATH%\python.exe" setup.py clean
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
119
120
IF %SKIPLINT% == 1 (
121
    ECHO Skipping style checks
122
    GOTO :CLEAN)
123
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
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 .
812.22.1 by manuel.delapena at canonical
Added a new flag to ignore the lint checks.
129
:CLEAN
812.20.8 by Natalia B. Bidart
- Not running any test related to GTK on windows.
130
:: Delete the temp folders
131
RMDIR /q /s _trial_temp
132
DEL /q .coverage
133
:END