Phase 0 评审二次修复:init.sh 增加 .exe fallback + 文档统一 MSYS2 环境声明

This commit is contained in:
ila
2026-07-06 19:13:08 +08:00
parent ded4fefef2
commit 9390c4039f
7 changed files with 172 additions and 22 deletions
+15 -6
View File
@@ -2,21 +2,30 @@
# 标准启动与验证入口(Windows PowerShell 版),与 init.sh 等价,二选一:
# - Windows 原生 PowerShell:用本文件 ./init.ps1
# - WSL / Git Bash / macOS / Linux:用 ./init.sh
# - MSYS2 / Git Bash / WSL / Linux:用 ./init.sh
# 一条命令完成:依赖安装 -> 基础验证 -> 打印启动命令。
$ErrorActionPreference = "Stop"
Set-Location -Path $PSScriptRoot
$InstallCmd = ".venv/bin/pip3.12 install -r requirements.txt"
$VerifyCmd = ".venv/bin/python3.12 manage.py check"
$StartCmd = ".venv/bin/python3.12 manage.py runserver"
$PythonPath = ".venv/bin/python3.12"
$PipPath = ".venv/bin/pip3.12"
if (-not (Test-Path ".venv/bin/python3.12") -and -not (Test-Path ".venv/bin/python3.12.exe")) {
Write-Error "venv 不存在或损坏,请先运行: python3.12 -m venv .venv"
# MSYS2/MinGW venv 中可执行文件带 .exe 后缀
if (-not (Test-Path $PythonPath) -and (Test-Path "$PythonPath.exe")) {
$PythonPath = "$PythonPath.exe"
$PipPath = "$PipPath.exe"
}
if (-not (Test-Path $PythonPath)) {
Write-Error "venv 不存在或已损坏。请先运行: python3.12 -m venv .venv"
exit 1
}
$InstallCmd = "$PipPath install -r requirements.txt"
$VerifyCmd = "$PythonPath manage.py check"
$StartCmd = "$PythonPath manage.py runserver"
Write-Host "==> 当前目录: $($PWD.Path)"
Write-Host "==> 同步依赖"