~dobey/dirspec/python3

1 by Rodney Dawes
Initial bits for dirspec
1
:: Author: Manuel de la Pena <manuel@canonical.com>
2
::
3
:: Copyright 2010-2011 Canonical Ltd.
4
::
5
:: This program is free software: you can redistribute it and/or modify it
1.1.1 by Rodney Dawes
Add tests, and the implementation of the XDG Base Directory spec
6
:: under the terms of the GNU Lesser General Public License version 3,
7
:: as published by the Free Software Foundation.
1 by Rodney Dawes
Initial bits for dirspec
8
::
9
:: This program is distributed in the hope that it will be useful, but
10
:: WITHOUT ANY WARRANTY; without even the implied warranties of
11
:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
:: PURPOSE.  See the GNU General Public License for more details.
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
@ECHO off
17
:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
18
:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
19
SET PYTHONEXECPATH=""
1 by Rodney Dawes
Initial bits for dirspec
20
:: This is very annoying; FOR /F will work differently depending on the output
21
:: of reg which is not consistent between OS versions (XP, 7). We must choose
22
:: the tokens according to OS version.
23
SET PYTHONPATHTOKENS=3
24
VER | FIND "XP" > nul
25
IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
26
ECHO Checking if python 2.7 is in the system
27
:: Look for python 2.7
1.1.4 by Rodney Dawes
Fix missed PYTHONPATH setting to be PYTHONEXECPATH
28
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXECPATH=%%A
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
29
IF NOT %PYTHONEXECPATH% == "" GOTO :PYTHONPRESENT
1 by Rodney Dawes
Initial bits for dirspec
30
ECHO Checking if python 2.6 is in the system
31
:: we do not have python 2.7 in the system, try to find 2.6
1.1.4 by Rodney Dawes
Fix missed PYTHONPATH setting to be PYTHONEXECPATH
32
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXECPATH=%%A
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
33
IF NOT %PYTHONEXECPATH% == "" GOTO :PYTHONPRESENT
1 by Rodney Dawes
Initial bits for dirspec
34
:: we do not have python (2.6 or 2.7), therefore we go to end
35
ECHO Please ensure you have python installed
36
GOTO :END
37
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
38
:: Using trial.py is different on Windows, so we need to set PYTHONPATH
39
SET PYTHONPATH=.
1 by Rodney Dawes
Initial bits for dirspec
40
41
:PYTHONPRESENT
42
ECHO Python found, executing the tests...
43
:: execute the tests with a number of ignored linux only modules
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
44
"%PYTHONEXECPATH%\python.exe" "%PYTHONEXECPATH%\Scripts\trial.py" dirspec
45
"%PYTHONEXECPATH%\python.exe" "%PYTHONEXECPATH%\Scripts\pyflakes" dirspec
1 by Rodney Dawes
Initial bits for dirspec
46
:: test for style if we can, if pep8 is not present, move to the end
1.1.3 by Rodney Dawes
Fix run-tests.bat for win32
47
IF EXIST "%PYTHONEXECPATH%Scripts\pep8.exe"
48
"%PYTHONEXECPATH%\Scripts\pep8.exe" --repeat dirspec
1 by Rodney Dawes
Initial bits for dirspec
49
ELSE
50
ECHO Style checks were not done
51
:: Delete the temp folders
52
RMDIR /s /q _trial_temp
53
RMDIR /s /q .coverage
54
:END