~ubuntuone-control-tower/ubuntu-sso-client/stable-4-0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
:: Copyright 2010-12 Canonical Ltd.
::
:: This program is free software: you can redistribute it and/or modify it
:: under the terms of the GNU General Public License version 3, as published
:: by the Free Software Foundation.
::
:: This program is distributed in the hope that it will be useful, but
:: WITHOUT ANY WARRANTY; without even the implied warranties of
:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
:: PURPOSE.  See the GNU General Public License for more details.
::
:: You should have received a copy of the GNU General Public License along
:: with this program.  If not, see <http://www.gnu.org/licenses/>.
::
:: In addition, as a special exception, the copyright holders give
:: permission to link the code of portions of this program with the
:: OpenSSL library under certain conditions as described in each
:: individual source file, and distribute linked combinations
:: including the two.
:: You must obey the GNU General Public License in all respects
:: for all of the code used other than OpenSSL.  If you modify
:: file(s) with this exception, you may extend this exception to your
:: version of the file(s), but you are not obligated to do so.  If you
:: do not wish to do so, delete this exception statement from your
:: version.  If you delete this exception statement from all source
:: files in the program, then also delete it here.

@ECHO off

SET PYTHONEXEPATH=""

set PYTHONPATH=%PYTHONPATH%;.

ECHO Checking for Python on the path
:: Look for Python from buildout
FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)

IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
ECHO Please ensure you have python installed
GOTO :END

:PYTHONPRESENT
:: throw the first parameter away if is /skip-lint,
:: the way we do this is to ensure that /skip-lint
:: is the first parameter and copy all the rest in a loop
:: the main reason for that is that %* is not affected
:: by SHIFT, that is, it allways have all passed parameters

SET PARAMS=%*
SET SKIPLINT=0
IF "%1" == "/skip-lint" (
    SET SKIPLINT=1
    GOTO :CLEANPARAMS
)ELSE (
    GOTO :CONTINUEBATCH)

:CLEANPARAMS
SHIFT
SET PARAMS=%1
:GETREST
SHIFT
if [%1]==[] (
    GOTO CONTINUEBATCH)
SET PARAMS=%PARAMS% %1
GOTO GETREST
:CONTINUEBATCH

ECHO Python found at %PYTHONEXEPATH%, building auto-generated modules...
:: call setup.py build so that the qt uic is called
::START "Build code" /D%CD% /WAIT "%PYTHONEXEPATH%\python.exe" setup.py build
"%PYTHONEXEPATH%" setup.py build
ECHO Running tests
:: execute the tests with a number of ignored linux only modules
"%PYTHONEXEPATH%" "%TRIALPATH%" -i "test_darwin.py, test_linux.py, test_txsecrets.py, test_qt.py, test_glib.py" --reactor=qt4 --gui %PARAMS% ubuntu_sso
:: Clean the build from the setupt.py
ECHO Cleaning the generated code before running the style checks...
"%PYTHONEXEPATH%" setup.py clean

IF %SKIPLINT% == 1 (
    ECHO Skipping style checks
    GOTO :CLEAN)

ECHO Performing style checks...
SET IGNORE_LINT="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"
"%PYTHONEXEPATH%" "%LINTPATH%" -i "%IGNORE_LINT%" ubuntu_sso
:: test for style if we can, if pep8 is not present, move to the end
ECHO Running PEP-8 Check...
"%PEP8PATH%" --repeat .
:CLEAN

IF EXIST \.coverage RMDIR /s /q \.coverage
:: Delete the temp folders
IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
IF EXIST _trial_temp RMDIR /s /s _trial_temp
:TRIALTEMPEXISTS
IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /s "%TRIAL_TEMP_DIR%"

:END