-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreateNewJobFolder.bat
More file actions
52 lines (41 loc) · 1.42 KB
/
createNewJobFolder.bat
File metadata and controls
52 lines (41 loc) · 1.42 KB
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
@echo off
REM --- set scripts directory
set "scripts=G:\My Drive\_Utility\Other\GenerateProjectDirs"
REM --- set counter file
set "counterFile=%scripts%\counter.txt"
REM --- get counter value
set /p counter=<"%counterFile%"
REM --- set virtual environment directory
set "venv=%scripts%\env"
REM --- check if venv exists, if not create it
IF NOT EXIST "%venv%" (
echo Creating virtual environment...
python -m venv "%venv%"
)
REM --- activate venv
call "%venv%\Scripts\activate.bat"
REM --- check if counter is 30 or blank, then update pip and install requirements
if "%counter%"=="30" (
REM --- reset counter
echo 0 > "%counterFile%"
REM --- install/upgrade pip to ensure the latest version is used
python -m pip install --upgrade pip
REM --- install requirements
echo Installing requirements...
python -m pip install -r "%scripts%\requirements.txt"
) else if "%counter%"=="" (
REM --- if counterFile empty, set counter to 1 and update pip and install requirements
echo 1 > "%counterFile%"
python -m pip install --upgrade pip
echo Installing requirements...
python -m pip install -r "%scripts%\requirements.txt"
) else (
REM --- increment counter and do nothing else
echo %counter% + 1| set /a result=%counter% + 1 > "%counterFile%"
)
REM --- run Python script
echo Running script...
python "%scripts%\createNewJobFolders.py" "%~1"
REM --- deactivate venv
call deactivate
pause