juc500 정상동작
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
cd /d "%~dp0.."
|
||||
set "ROOT=%CD%"
|
||||
set "WHEELS=%ROOT%\vendor\wheels"
|
||||
set "GETPIP=%ROOT%\vendor\get-pip.py"
|
||||
set "LIBUSB=%ROOT%\vendor\libusb-1.0.dll"
|
||||
set "EMBED_PY=%ROOT%\vendor\python-windows\python.exe"
|
||||
|
||||
echo ============================================
|
||||
echo JUC500 Windows offline setup
|
||||
echo ============================================
|
||||
|
||||
if not exist "%WHEELS%\pyusb-1.2.1-py3-none-any.whl" (
|
||||
echo [!] Missing vendor\wheels. Copy the full source tree including vendor\.
|
||||
exit /b 1
|
||||
)
|
||||
if not exist "%LIBUSB%" (
|
||||
echo [!] Missing vendor\libusb-1.0.dll
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Remove Mac-copied broken .venv
|
||||
if exist "%ROOT%\.venv\bin\python" (
|
||||
if not exist "%ROOT%\.venv\Scripts\python.exe" (
|
||||
echo [!] Mac .venv detected - removing...
|
||||
rmdir /s /q "%ROOT%\.venv"
|
||||
)
|
||||
)
|
||||
|
||||
REM Choose bootstrap Python: system first, else vendored embeddable
|
||||
set "BOOT_PY="
|
||||
where py >nul 2>&1 && set "BOOT_PY=py -3"
|
||||
if not defined BOOT_PY (
|
||||
where python >nul 2>&1 && set "BOOT_PY=python"
|
||||
)
|
||||
if not defined BOOT_PY (
|
||||
if exist "%EMBED_PY%" (
|
||||
set "BOOT_PY=%EMBED_PY%"
|
||||
echo Using vendored Python: vendor\python-windows\python.exe
|
||||
)
|
||||
)
|
||||
if not defined BOOT_PY (
|
||||
echo [!] No Python found. vendor\python-windows is missing.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Bootstrap: %BOOT_PY%
|
||||
|
||||
REM Ensure virtualenv module available (embeddable has no stdlib venv)
|
||||
%BOOT_PY% -c "import virtualenv" 2>nul
|
||||
if errorlevel 1 (
|
||||
echo Installing virtualenv from vendor\wheels ...
|
||||
%BOOT_PY% -m pip install --no-index --find-links="%WHEELS%" virtualenv
|
||||
if errorlevel 1 (
|
||||
if exist "%GETPIP%" (
|
||||
%BOOT_PY% "%GETPIP%" --no-index --find-links="%WHEELS%" pip setuptools wheel
|
||||
%BOOT_PY% -m pip install --no-index --find-links="%WHEELS%" virtualenv
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if not exist "%ROOT%\.venv\Scripts\python.exe" (
|
||||
echo Creating .venv (fully offline, no pip seed from internet)...
|
||||
%BOOT_PY% -m virtualenv --no-periodic-update --no-setuptools --no-pip "%ROOT%\.venv"
|
||||
if errorlevel 1 (
|
||||
echo [!] virtualenv failed.
|
||||
exit /b 1
|
||||
)
|
||||
"%ROOT%\.venv\Scripts\python.exe" "%GETPIP%" --no-index --find-links="%WHEELS%" pip setuptools wheel packaging
|
||||
if errorlevel 1 (
|
||||
echo [!] get-pip offline bootstrap failed.
|
||||
exit /b 1
|
||||
)
|
||||
goto install_deps
|
||||
)
|
||||
|
||||
"%ROOT%\.venv\Scripts\python.exe" -c "import usb" 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [!] .venv incomplete — reinstalling dependencies...
|
||||
goto install_deps
|
||||
)
|
||||
goto copy_libusb
|
||||
|
||||
:install_deps
|
||||
echo Installing dependencies from vendor\wheels (no PyPI)...
|
||||
"%ROOT%\.venv\Scripts\python.exe" -m pip install --no-index --find-links="%WHEELS%" -U pip setuptools wheel packaging
|
||||
"%ROOT%\.venv\Scripts\python.exe" -m pip install --no-index --find-links="%WHEELS%" -r "%ROOT%\requirements.txt"
|
||||
if errorlevel 1 (
|
||||
echo [!] requirements install failed.
|
||||
exit /b 1
|
||||
)
|
||||
"%ROOT%\.venv\Scripts\python.exe" -m pip install --no-index --find-links="%WHEELS%" --no-build-isolation -e "%ROOT%"
|
||||
if errorlevel 1 (
|
||||
echo [!] editable install failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:copy_libusb
|
||||
copy /Y "%LIBUSB%" "%ROOT%\.venv\Scripts\libusb-1.0.dll" >nul
|
||||
echo libusb-1.0.dll -^> .venv\Scripts\
|
||||
|
||||
echo.
|
||||
echo Setup done (offline). Run:
|
||||
echo .\start.bat
|
||||
echo or Git Bash: ./start_win.sh
|
||||
echo.
|
||||
endlocal
|
||||
Reference in New Issue
Block a user