fix(ground): WSL에서 지반 생성 Python·DWG 변환 실행 경로 해결
- 공통 resolvePython: Windows venv → .venv/bin/python → PIERZAINER_PYTHON → python3/python - 지반 생성·수량산출 Excel·DWG 출력 서버가 같은 해석기 사용, ENOENT 안내 문구 보강 - WSL에서 번들 dwg2dxf.exe 호출 시 wslpath -w로 경로 변환, .exe 실행 권한 부여 - 실제 운곡교 DWG+Excel로 엔진/HTTP 경로 생성 확인(교각16·지형6,545점) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f51865c57b
commit
d740406a8c
16 files changed
+67
-6
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { existsSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
/**
|
||||
* Python used by the local dev-server tools (ground engine, quantity workbook, DWG export).
|
||||
* Order: Windows venv → POSIX venv (WSL/Linux) → PIERZAINER_PYTHON → python3/python on PATH.
|
||||
*/
|
||||
export function resolvePython(root:string,platform:NodeJS.Platform=process.platform,exists:(file:string)=>boolean=existsSync,env:NodeJS.ProcessEnv=process.env):string{
|
||||
const venv=path.join(root,'pierzainer_ground','.venv');
|
||||
const candidates=platform==='win32'?[path.join(venv,'Scripts','python.exe')]:[path.join(venv,'bin','python'),path.join(venv,'Scripts','python.exe')];
|
||||
const found=candidates.find(file=>exists(file));if(found)return found;
|
||||
if(env.PIERZAINER_PYTHON)return env.PIERZAINER_PYTHON;
|
||||
return platform==='win32'?'python':'python3';
|
||||
}
|
||||
|
||||
/** Human-readable reason for a failed spawn (ENOENT otherwise shows only "spawn python ENOENT"). */
|
||||
export function describeSpawnError(error:NodeJS.ErrnoException,python:string):string{
|
||||
if(error.code==='ENOENT')return `Python 실행 파일을 찾지 못했습니다(${python}). pierzainer_ground/.venv를 만들고 requirements.txt를 설치하거나 PIERZAINER_PYTHON을 지정하세요.`;
|
||||
return error.message;
|
||||
}
|
||||
Reference in new issue
Block a user