juc500 정상동작
This commit is contained in:
+108
-34
@@ -1,34 +1,108 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d %~dp0..
|
||||
|
||||
py -3 -m venv .venv
|
||||
call .venv\Scripts\activate.bat
|
||||
python -m pip install -U pip
|
||||
REM PyPI 없이 vendor\wheels 의 pyusb wheel 사용
|
||||
python -m pip install --no-index --find-links=vendor\wheels -r requirements.txt
|
||||
if errorlevel 1 (
|
||||
echo [!] --no-index 실패. find-links + 온라인 허용으로 재시도…
|
||||
python -m pip install --find-links=vendor\wheels -r requirements.txt
|
||||
)
|
||||
python -m pip install --no-index --find-links=vendor\wheels -e .
|
||||
if errorlevel 1 (
|
||||
python -m pip install --find-links=vendor\wheels -e .
|
||||
)
|
||||
|
||||
REM libusb DLL 을 venv Scripts 로 복사 (장치 인식에 필수)
|
||||
if exist vendor\libusb-1.0.dll (
|
||||
copy /Y vendor\libusb-1.0.dll .venv\Scripts\libusb-1.0.dll >nul
|
||||
echo libusb-1.0.dll -^> .venv\Scripts\
|
||||
) else (
|
||||
echo [!] vendor\libusb-1.0.dll 없음 — USB 장치를 못 찾을 수 있습니다.
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Setup done. Next:
|
||||
echo .venv\Scripts\activate
|
||||
echo python -m juc500_xfer doctor
|
||||
echo python -m juc500_xfer info
|
||||
echo python -m juc500_xfer gui
|
||||
echo See docs\WINDOWS.md for Zadig / WinUSB steps.
|
||||
endlocal
|
||||
@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