fix: make Windows signer entrypoints executable

This commit is contained in:
2026-09-27 10:09:22 +08:00
parent 1a8657fcce
commit 072237abed
4 changed files with 12 additions and 7 deletions
+1
View File
@@ -1,2 +1,3 @@
project-docs/legal-policy-candidates/**/*.md text eol=lf project-docs/legal-policy-candidates/**/*.md text eol=lf
project-docs/legal-policy-candidates/**/*.json text eol=lf project-docs/legal-policy-candidates/**/*.json text eol=lf
*.cmd text eol=crlf
@@ -4,14 +4,14 @@ chcp 65001 >nul
set "launcher=%~dp0Launch-ReleaseSigner.ps1" set "launcher=%~dp0Launch-ReleaseSigner.ps1"
set "powershell=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" set "powershell=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
if not exist "%powershell%" ( if not exist "%powershell%" (
echo 启动失败:系统缺少受信任的 Windows PowerShell。 echo Signer startup failed: Windows PowerShell was not found.
echo 未创建候选批准,请将此窗口截图交给系统处理。 echo No candidate approval was created. Send this window to system support.
pause pause
exit /b 2 exit /b 2
) )
"%powershell%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%launcher%" sign "%powershell%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%launcher%" sign
set "result=%ERRORLEVEL%" set "result=%ERRORLEVEL%"
echo. echo.
if not "%result%"=="0" echo 签署未完成,未创建新的候选批准。 if not "%result%"=="0" echo Signing did not complete. No new candidate approval was created.
pause pause
exit /b %result% exit /b %result%
@@ -4,14 +4,14 @@ chcp 65001 >nul
set "launcher=%~dp0Launch-ReleaseSigner.ps1" set "launcher=%~dp0Launch-ReleaseSigner.ps1"
set "powershell=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" set "powershell=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
if not exist "%powershell%" ( if not exist "%powershell%" (
echo 启动失败:系统缺少受信任的 Windows PowerShell。 echo Signer startup failed: Windows PowerShell was not found.
echo 未创建审核密钥,请将此窗口截图交给系统处理。 echo No reviewer key was created. Send this window to system support.
pause pause
exit /b 2 exit /b 2
) )
"%powershell%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%launcher%" initialize "%powershell%" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%launcher%" initialize
set "result=%ERRORLEVEL%" set "result=%ERRORLEVEL%"
echo. echo.
if not "%result%"=="0" echo 初始化未完成,未创建审核密钥或候选批准。 if not "%result%"=="0" echo Initialization did not complete. No reviewer key or candidate approval was created.
pause pause
exit /b %result% exit /b %result%
@@ -1797,7 +1797,11 @@ def test_windows_launcher_uses_isolated_runtime_and_ignores_pythonpath(
assert json.loads(completed.stdout.splitlines()[-1])["status"] == "isolated_runtime_verified" assert json.loads(completed.stdout.splitlines()[-1])["status"] == "isolated_runtime_verified"
assert not marker.exists() assert not marker.exists()
for name in ("Initialize-ReleaseSigner.cmd", "Approve-ReleaseCandidate.cmd"): for name in ("Initialize-ReleaseSigner.cmd", "Approve-ReleaseCandidate.cmd"):
raw = SIGNER_SCRIPT.with_name(name).read_text(encoding="utf-8") raw_bytes = SIGNER_SCRIPT.with_name(name).read_bytes()
raw = raw_bytes.decode("ascii")
assert b"\r\n" in raw_bytes
assert b"\n" not in raw_bytes.replace(b"\r\n", b"")
assert "chcp 65001 >nul\r\n" in raw
assert "Launch-ReleaseSigner.ps1" in raw assert "Launch-ReleaseSigner.ps1" in raw
assert "where python" not in raw.casefold() assert "where python" not in raw.casefold()