diff --git a/RUN.md b/RUN.md index 791e278..1423053 100644 --- a/RUN.md +++ b/RUN.md @@ -1091,7 +1091,7 @@ Zcbot.WindowsNode.exe enroll ` Zcbot.WindowsNode.exe ``` -Windows Node 发布目录包含纯 BAT 安装入口,不依赖 PowerShell。使用实际运行 Node 的专用 Windows 账号双击 `install-windows-node.bat`;安装器会分别检测 Origin/OriginPro 与 `C:\Program Files\ANSYS Inc\v242`(或 `AWP_ROOT242`)中的 Mechanical 2024 R2,检测到后自动通过 `py -3.12` 或 PATH 定位 Python 3.12,并为两者安装相互隔离的固定 runtime;未检测到的软件会跳过。最后通过 `schtasks.exe` 注册该账号登录后的启动任务,结束后保留窗口。也可在命令提示符执行: +Windows Node 发布目录包含纯 BAT 安装入口,不依赖 PowerShell。使用实际运行 Node 的专用 Windows 账号双击 `install-windows-node.bat`;安装器会分别检测 Origin/OriginPro 与 `C:\Program Files\ANSYS Inc\v242`(或 `AWP_ROOT242`)中的 Mechanical 2024 R2,检测到后自动通过 `py -3.12` 或 PATH 定位 Python 3.12,并为两者安装相互隔离的固定 runtime;未检测到的软件会跳过。Python 依赖默认显式使用清华 PyPI 镜像;如需切换官方源或院内镜像,在启动安装器前设置 `ZCBOT_PIP_INDEX_URL`。最后通过 `schtasks.exe` 注册该账号登录后的启动任务,结束后保留窗口。也可在命令提示符执行: ```bat cd /d D:\ZcbotNode diff --git a/tests/test_windows_node_source.py b/tests/test_windows_node_source.py index bd31c40..9d61aae 100644 --- a/tests/test_windows_node_source.py +++ b/tests/test_windows_node_source.py @@ -198,6 +198,14 @@ class WindowsNodeSourceTests(unittest.TestCase): self.assertIn('python.exe -m venv "%~1"', script) self.assertNotIn('"%PYTHON_EXE%"', script) + def test_unified_installer_uses_configurable_domestic_pypi(self) -> None: + script = (ROOT / "install-windows-node.bat").read_text(encoding="utf-8") + self.assertIn( + 'if not defined ZCBOT_PIP_INDEX_URL set "ZCBOT_PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple/"', + script, + ) + self.assertEqual(script.count('--index-url "%ZCBOT_PIP_INDEX_URL%"'), 2) + def test_publish_output_contains_the_complete_installer_payload(self) -> None: project = (PROJECT / "Zcbot.WindowsNode.csproj").read_text(encoding="utf-8") self.assertIn("..\\install-windows-node.bat", project) diff --git a/windows-node/README.md b/windows-node/README.md index 3a8caba..2a6231a 100644 --- a/windows-node/README.md +++ b/windows-node/README.md @@ -20,7 +20,7 @@ windows-node\package-windows-node.bat install-windows-node.bat ``` -安装器是纯 BAT,不依赖 PowerShell:它分别检测 Origin/OriginPro 和 ANSYS Mechanical 2024 R2,依次尝试 `py -3.12` 和 PATH 中的 `python.exe`,并安装隔离的 `origin`/`ansys` runtime;未检测到的软件会明确跳过。最后通过 `schtasks.exe` 为当前专用账号注册登录后启动任务,成功或失败后都会保留窗口。Python 未加入 PATH 时,可在命令提示符执行 `install-windows-node.bat "C:\Python312\python.exe"`。runtime 位于 `%ProgramData%\Zcbot\WindowsNode\runtimes\\Scripts\python.exe`。 +安装器是纯 BAT,不依赖 PowerShell:它分别检测 Origin/OriginPro 和 ANSYS Mechanical 2024 R2,依次尝试 `py -3.12` 和 PATH 中的 `python.exe`,并安装隔离的 `origin`/`ansys` runtime;未检测到的软件会明确跳过。Python 依赖默认通过清华 PyPI 镜像安装;需要改用官方源或院内镜像时,先设置 `ZCBOT_PIP_INDEX_URL`。最后通过 `schtasks.exe` 为当前专用账号注册登录后启动任务,成功或失败后都会保留窗口。Python 未加入 PATH 时,可在命令提示符执行 `install-windows-node.bat "C:\Python312\python.exe"`。runtime 位于 `%ProgramData%\Zcbot\WindowsNode\runtimes\\Scripts\python.exe`。 ANSYS adapter 0.2.0 已实现 Mechanical 2024 R2 / PyMechanical 0.11.3 的真实线性静力流程,可从 STEP/Parasolid/IGES 导入 Named Selection,应用固定材料/网格/支撑/力或压力,并导出 MECHDAT、汇总、结果表、结果图、solver log 和溯源。契约不接收 Python、APDL、Journal、工程文件或本机路径。Node 主窗口提供“复制诊断信息”和“ANSYS Mechanical 真机验收”卡片;验收使用内置 NIST FTC-11 STEP 并自动建立两个端面 Named Selection,用户只需选择报告目录。该入口不受执行门影响,但只有固定的取消与连续 20 次求解全部通过后,界面才允许写入机器级执行门。完成专用节点的许可证、取消、残留进程和许可证释放验收前,能力仍保持不可调度,具体步骤见根目录 `RUN.md`。 diff --git a/windows-node/install-windows-node.bat b/windows-node/install-windows-node.bat index d95c7bc..bed2f08 100644 --- a/windows-node/install-windows-node.bat +++ b/windows-node/install-windows-node.bat @@ -9,6 +9,7 @@ set "ORIGIN_RUNTIME_PYTHON=%ORIGIN_RUNTIME_DIR%\Scripts\python.exe" set "ANSYS_REQUIREMENTS=%~dp0adapters\ansys.mechanical.static_structural@v2\requirements.txt" set "ANSYS_RUNTIME_DIR=%ProgramData%\Zcbot\WindowsNode\runtimes\ansys" set "ANSYS_RUNTIME_PYTHON=%ANSYS_RUNTIME_DIR%\Scripts\python.exe" +if not defined ZCBOT_PIP_INDEX_URL set "ZCBOT_PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple/" echo [INFO] Installing zcbot Windows Node... @@ -49,7 +50,7 @@ if errorlevel 1 ( ) echo [INFO] Installing Origin worker dependencies... -"%ORIGIN_RUNTIME_PYTHON%" -m pip install --requirement "%ORIGIN_REQUIREMENTS%" +"%ORIGIN_RUNTIME_PYTHON%" -m pip install --index-url "%ZCBOT_PIP_INDEX_URL%" --requirement "%ORIGIN_REQUIREMENTS%" if errorlevel 1 ( echo [ERR] Failed to install the Origin worker dependencies. goto :failed @@ -91,7 +92,7 @@ if errorlevel 1 ( goto :failed ) echo [INFO] Installing ANSYS worker dependencies... -"%ANSYS_RUNTIME_PYTHON%" -m pip install --requirement "%ANSYS_REQUIREMENTS%" +"%ANSYS_RUNTIME_PYTHON%" -m pip install --index-url "%ZCBOT_PIP_INDEX_URL%" --requirement "%ANSYS_REQUIREMENTS%" if errorlevel 1 ( echo [ERR] Failed to install the ANSYS worker dependencies. goto :failed