Skip to content

Commit 87f114d

Browse files
committed
fix(windows): address updater review comments
1 parent d7b99b2 commit 87f114d

9 files changed

Lines changed: 30 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ installs to `%ProgramFiles%\Pythinker` and writes PATH to HKLM (requires admin).
195195

196196
**Upgrade:** `pythinker update` from inside the running app — it downloads
197197
the newest installer, verifies SHA-256, and launches the signed Inno installer
198-
with visible progress (`/SILENT /NORESTART /CLOSEAPPLICATIONS /NORESTARTAPPLICATIONS`).
198+
with visible progress (`/SILENT /NORESTART /CURRENTUSER /CLOSEAPPLICATIONS /NORESTARTAPPLICATIONS`).
199199

200200
**Uninstall:** Apps & Features → *Pythinker Code* → Uninstall reverts both
201201
the files and the PATH edit.

docs/public/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ try {
198198
OK "Checksum OK"
199199

200200
Step "Running Pythinker installer"
201-
$args = @(
201+
$installerArgs = @(
202202
'/SILENT',
203203
'/NORESTART',
204204
'/CURRENTUSER',
205205
'/CLOSEAPPLICATIONS',
206206
'/NORESTARTAPPLICATIONS'
207207
)
208-
$process = Start-Process -FilePath $installerPath -ArgumentList $args -Wait -PassThru
208+
$process = Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru
209209
if ($process.ExitCode -ne 0) {
210210
Fail "installer exited with code $($process.ExitCode)"
211211
}

packages/windows-installer/build.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,17 @@ if (-not $SkipInstaller) {
9999
}
100100
$isccArgs = @("/DAppVersion=$Version")
101101
if ($signingConfigured) {
102-
$signCommand = "powershell.exe -NoProfile -NonInteractive -File `"$signScript`" `$f"
102+
# Keep quoted paths out of /SPythinkerSign itself. Windows PowerShell 5.1
103+
# can mangle nested quotes when passing native arguments to iscc.exe.
104+
$env:PYTHINKER_INNO_SIGN_SCRIPT = "`"$signScript`""
105+
$signCommand = 'cmd.exe /D /C powershell.exe -NoProfile -NonInteractive -File %PYTHINKER_INNO_SIGN_SCRIPT% $f'
103106
$isccArgs += "/SPythinkerSign=$signCommand"
104107
$isccArgs += "/DUseInnoSignTool=1"
105108
}
106109
$isccArgs += (Join-Path $here 'installer.iss')
107110

111+
Write-Host "build.ps1: invoking Inno Setup with arguments:"
112+
foreach ($arg in $isccArgs) { Write-Host " $arg" }
108113
& $iscc.Source @isccArgs
109114
if ($LASTEXITCODE -ne 0) { throw "Inno Setup compile failed ($LASTEXITCODE)" }
110115
}

scripts/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ try {
198198
OK "Checksum OK"
199199

200200
Step "Running Pythinker installer"
201-
$args = @(
201+
$installerArgs = @(
202202
'/SILENT',
203203
'/NORESTART',
204204
'/CURRENTUSER',
205205
'/CLOSEAPPLICATIONS',
206206
'/NORESTARTAPPLICATIONS'
207207
)
208-
$process = Start-Process -FilePath $installerPath -ArgumentList $args -Wait -PassThru
208+
$process = Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru
209209
if ($process.ExitCode -ne 0) {
210210
Fail "installer exited with code $($process.ExitCode)"
211211
}

src/pythinker_code/ui/shell/update.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
LAST_SEEN_VERSION_FILE = get_share_dir() / "last_seen_version.txt"
5454
AUTO_UPDATE_CHECK_INTERVAL_SECONDS = 24 * 60 * 60
5555
PROMPT_UPDATE_REFRESH_TIMEOUT_SECONDS = 2.0
56+
WINDOWS_UPDATE_STAGING_MAX_AGE_SECONDS = 7 * 24 * 60 * 60
5657

5758
_UPDATE_LOCK = asyncio.Lock()
5859
_skipped_version_this_session: str | None = None
@@ -782,7 +783,13 @@ def _windows_native_installer_args() -> list[str]:
782783
``/SILENT`` still avoids the wizard, but leaves normal installer UI/errors
783784
visible and delegates app-closing to Inno Setup's Restart Manager.
784785
"""
785-
return ["/SILENT", "/NORESTART", "/CLOSEAPPLICATIONS", "/NORESTARTAPPLICATIONS"]
786+
return [
787+
"/SILENT",
788+
"/NORESTART",
789+
"/CURRENTUSER",
790+
"/CLOSEAPPLICATIONS",
791+
"/NORESTARTAPPLICATIONS",
792+
]
786793

787794

788795
def _spawn_detached_windows_installer(installer_path: Path) -> bool:
@@ -1004,9 +1011,6 @@ def _install_native_archive(archive: Path) -> UpdateResult:
10041011
return UpdateResult.UPDATED
10051012

10061013

1007-
WINDOWS_UPDATE_STAGING_MAX_AGE_SECONDS = 7 * 24 * 60 * 60
1008-
1009-
10101014
def _windows_update_staging_parent() -> Path:
10111015
return get_share_dir() / "windows-update-staging"
10121016

tests/test_release_update_pipeline.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,15 @@ def test_windows_installer_signs_update_artifacts_when_credentials_are_available
7878
# wired for the frozen executable, bundled DLL/PYD files, and Inno's
7979
# setup/uninstaller/temp copies.
8080
assert "@('.exe', '.dll', '.pyd')" in build_script
81+
assert "PYTHINKER_INNO_SIGN_SCRIPT" in build_script
82+
assert (
83+
"cmd.exe /D /C powershell.exe -NoProfile -NonInteractive "
84+
"-File %PYTHINKER_INNO_SIGN_SCRIPT% $f"
85+
) in build_script
86+
assert '-File `"$signScript`"' not in build_script
8187
assert "/SPythinkerSign=$signCommand" in build_script
8288
assert "/DUseInnoSignTool=1" in build_script
89+
assert "build.ps1: invoking Inno Setup with arguments:" in build_script
8390

8491

8592
def test_release_asset_wait_covers_all_updater_channels() -> None:

tests/ui_and_conv/test_native_update_parity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def fake_popen(args, **kwargs):
152152
str(installer),
153153
"/SILENT",
154154
"/NORESTART",
155+
"/CURRENTUSER",
155156
"/CLOSEAPPLICATIONS",
156157
"/NORESTARTAPPLICATIONS",
157158
]

tests/ui_and_conv/test_shell_update.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ def fake_popen(args, **kwargs):
766766
str(installer),
767767
"/SILENT",
768768
"/NORESTART",
769+
"/CURRENTUSER",
769770
"/CLOSEAPPLICATIONS",
770771
"/NORESTARTAPPLICATIONS",
771772
],

web/public/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ try {
198198
OK "Checksum OK"
199199

200200
Step "Running Pythinker installer"
201-
$args = @(
201+
$installerArgs = @(
202202
'/SILENT',
203203
'/NORESTART',
204204
'/CURRENTUSER',
205205
'/CLOSEAPPLICATIONS',
206206
'/NORESTARTAPPLICATIONS'
207207
)
208-
$process = Start-Process -FilePath $installerPath -ArgumentList $args -Wait -PassThru
208+
$process = Start-Process -FilePath $installerPath -ArgumentList $installerArgs -Wait -PassThru
209209
if ($process.ExitCode -ne 0) {
210210
Fail "installer exited with code $($process.ExitCode)"
211211
}

0 commit comments

Comments
 (0)