forked from PixarAnimationStudios/OpenUSD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-uv-python.bat
More file actions
68 lines (57 loc) · 1.79 KB
/
setup-uv-python.bat
File metadata and controls
68 lines (57 loc) · 1.79 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@echo off
REM Set up a repo-local Python environment using uv and install USD deps.
setlocal enabledelayedexpansion
REM Set paths (remove trailing backslash from SCRIPT_DIR)
set SCRIPT_DIR=%~dp0
set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%
set ROOT_DIR=%SCRIPT_DIR%
set VENV_DIR=%ROOT_DIR%\.venv
REM Python version (can be overridden by setting PYTHON_VERSION env var before running)
if not defined PYTHON_VERSION set PYTHON_VERSION=3.11
REM Python dependencies
set PY_DEPS=jinja2 PySide6 PyOpenGL
REM Check if uv is installed
where uv >nul 2>&1
if errorlevel 1 (
echo Error: uv is not installed or not on PATH.
echo Install uv first: https://docs.astral.sh/uv/
exit /b 1
)
echo ========================================
echo Setting up Python with uv
echo ========================================
echo Python version: %PYTHON_VERSION%
echo Venv: %VENV_DIR%
echo Packages: %PY_DEPS%
echo ========================================
REM Install Python version via uv
uv python install %PYTHON_VERSION%
if errorlevel 1 (
echo Failed to install Python %PYTHON_VERSION%
exit /b 1
)
REM Create venv if it doesn't exist
if not exist "%VENV_DIR%" (
echo Creating virtual environment...
uv venv --python %PYTHON_VERSION% "%VENV_DIR%"
if errorlevel 1 (
echo Failed to create virtual environment
exit /b 1
)
) else (
echo Using existing venv at %VENV_DIR%
)
REM Install dependencies
echo Installing Python packages...
uv pip install --python "%VENV_DIR%\Scripts\python.exe" %PY_DEPS%
if errorlevel 1 (
echo Failed to install Python packages
exit /b 1
)
echo.
echo ========================================
echo Python environment ready
echo ========================================
echo To activate: %VENV_DIR%\Scripts\activate.bat
echo ========================================
endlocal