Skip to content

Commit 149e7a0

Browse files
committed
VSCode tasks (Windows): support for multiple envs
1 parent 43b9da1 commit 149e7a0

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

scripts/build_inplace.bat

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,22 @@ REM Licensed under the terms of the MIT License
77
REM Copyright (c) 2020 Pierre Raybaut
88
REM (see PythonQwt LICENSE file for more details)
99
REM ======================================================
10+
setlocal enabledelayedexpansion
1011
call %~dp0utils GetScriptPath SCRIPTPATH
11-
call %FUNC% GetLibName LIBNAME
1212
call %FUNC% GetModName MODNAME
1313
call %FUNC% SetPythonPath
14-
call %FUNC% UsePython
14+
1515
if exist MANIFEST ( del /q MANIFEST )
16-
python setup.py build_ext --inplace
16+
:: Iterate over all directories in the grandparent directory
17+
:: (WinPython base directories)
18+
call %FUNC% GetPythonExeGrandParentDir DIR0
19+
for /D %%d in ("%DIR0%*") do (
20+
set WINPYDIRBASE=%%d
21+
call !WINPYDIRBASE!\scripts\env.bat
22+
echo ******************************************************************************
23+
echo Building %MODNAME% from "%%d"
24+
echo ******************************************************************************
25+
python setup.py build_ext --inplace
26+
echo ----
27+
)
1728
call %FUNC% EndOfScript

scripts/run_pytest.bat

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ REM Licensed under the terms of the MIT License
77
REM Copyright (c) 2020 Pierre Raybaut
88
REM (see PythonQwt LICENSE file for more details)
99
REM ======================================================
10-
setlocal
10+
setlocal enabledelayedexpansion
1111
call %~dp0utils GetScriptPath SCRIPTPATH
1212
call %FUNC% GetModName MODNAME
1313
call %FUNC% SetPythonPath
14-
call %FUNC% UsePython
15-
pytest --unattended %MODNAME%
14+
15+
:: Iterate over all directories in the grandparent directory
16+
:: (WinPython base directories)
17+
call %FUNC% GetPythonExeGrandParentDir DIR0
18+
for /D %%d in ("%DIR0%*") do (
19+
set WINPYDIRBASE=%%d
20+
call !WINPYDIRBASE!\scripts\env.bat
21+
echo Running pytest from "%%d":
22+
pytest --ff -q --unattended %MODNAME%
23+
echo ----
24+
)
1625
call %FUNC% EndOfScript

scripts/utils.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ REM ======================================================
5959
set PYTHONPATH=%PYTHONPATH%;%ORIGINAL_PYTHONPATH%
6060
goto:eof
6161

62+
:GetPythonExeGrandParentDir
63+
for %%i in (%PYTHON%) do set DIR2=%%~dpi
64+
set DIR2=%DIR2:~0,-1%
65+
for %%j in (%DIR2%) do set DIR1=%%~dpj
66+
set DIR1=%DIR1:~0,-1%
67+
for %%k in (%DIR1%) do set %1=%%~dpk
68+
goto:eof
69+
6270
:UsePython
6371
if defined WINPYVER (goto:eof)
6472
if not defined PYTHON (goto :nopython)

0 commit comments

Comments
 (0)