File size: 1,218 Bytes
c96b98a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
setlocal

set "CURR_DIR=%~dp0"
set "REPO_ROOT=%~dp0.."
set "VENV_DIR=%REPO_ROOT%\phienv"

set "UTILS_BAT=%CURR_DIR%_utils.bat"

call "%UTILS_BAT%" print_heading "phidata dev setup"
call "%UTILS_BAT%" print_heading "Creating venv: %VENV_DIR%"

call "%UTILS_BAT%" print_heading "Removing existing venv: %VENV_DIR%"
rd /s /q "%VENV_DIR%"

call "%UTILS_BAT%" print_heading "Creating python3 venv: %VENV_DIR%"
python -m venv "%VENV_DIR%"

call "%UTILS_BAT%" print_heading "Upgrading pip to the latest version"
call "%VENV_DIR%\Scripts\python.exe" -m pip install --upgrade pip
if %ERRORLEVEL% neq 0 (
    echo Failed to upgrade pip. Please run the script as Administrator or check your network connection.
    exit /b %ERRORLEVEL%
)

call "%UTILS_BAT%" print_heading "Installing base python packages"
call "%VENV_DIR%\Scripts\pip" install pip-tools twine build
if %ERRORLEVEL% neq 0 (
    echo Failed to install required packages. Attempting to retry installation...
    call "%VENV_DIR%\Scripts\pip" install pip-tools twine build
)

:: Install workspace
call "%VENV_DIR%\Scripts\activate"
call "%CURR_DIR%install.bat"

call "%UTILS_BAT%" print_heading "Activate using: call %VENV_DIR%\Scripts\activate"

endlocal