Skip to content

Commit b30fb2b

Browse files
aivrarclaude
andcommitted
Fix PowerShell multi-line commands failing on fresh installs
The caret (^) line continuation characters were inside double quotes in install.bat.template and package_generator.py, causing CMD to pass them literally to PowerShell instead of using them as line continuations. Fixed by closing quotes before each ^. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d206e03 commit b30fb2b

2 files changed

Lines changed: 37 additions & 37 deletions

File tree

core/package_generator.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ def _get_tkinter_section(self) -> str:
320320
'\n'
321321
' echo Downloading tcltk.msi...\n'
322322
' powershell -NoProfile -ExecutionPolicy Bypass -Command ^\n'
323-
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^\n'
324-
" $ProgressPreference = 'SilentlyContinue'; ^\n"
325-
" Invoke-WebRequest -Uri '!TCLTK_MSI_URL!' -OutFile '!TCLTK_MSI!'\" \n"
323+
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^\n'
324+
" \"$ProgressPreference = 'SilentlyContinue';\" ^\n"
325+
" \"Invoke-WebRequest -Uri '!TCLTK_MSI_URL!' -OutFile '!TCLTK_MSI!'\"\n"
326326
'\n'
327327
' if not exist "!TCLTK_MSI!" (\n'
328328
' echo WARNING: Failed to download tcltk.msi. GUI may not work.\n'
@@ -385,9 +385,9 @@ def _get_git_section(self) -> str:
385385
'\n'
386386
'echo [STEP] Downloading portable Git %GIT_VERSION%...\n'
387387
'powershell -NoProfile -ExecutionPolicy Bypass -Command ^\n'
388-
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^\n'
389-
" $ProgressPreference = 'SilentlyContinue'; ^\n"
390-
" Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%GIT_ZIP%'\"\n"
388+
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^\n'
389+
" \"$ProgressPreference = 'SilentlyContinue';\" ^\n"
390+
" \"Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%GIT_ZIP%'\"\n"
391391
'\n'
392392
'if not exist "%GIT_ZIP%" (\n'
393393
' echo WARNING: Failed to download Git. Git features may not work.\n'
@@ -415,9 +415,9 @@ def _get_ffmpeg_section(self) -> str:
415415
'\n'
416416
'echo [STEP] Downloading portable FFmpeg...\n'
417417
'powershell -NoProfile -ExecutionPolicy Bypass -Command ^\n'
418-
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^\n'
419-
" $ProgressPreference = 'SilentlyContinue'; ^\n"
420-
" Invoke-WebRequest -Uri '%FFMPEG_URL%' -OutFile '%FFMPEG_ZIP%'\"\n"
418+
' "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^\n'
419+
" \"$ProgressPreference = 'SilentlyContinue';\" ^\n"
420+
" \"Invoke-WebRequest -Uri '%FFMPEG_URL%' -OutFile '%FFMPEG_ZIP%'\"\n"
421421
'\n'
422422
'if not exist "%FFMPEG_ZIP%" (\n'
423423
' echo WARNING: Failed to download FFmpeg.\n'
@@ -426,17 +426,17 @@ def _get_ffmpeg_section(self) -> str:
426426
'\n'
427427
'echo [STEP] Extracting portable FFmpeg...\n'
428428
'powershell -NoProfile -ExecutionPolicy Bypass -Command ^\n'
429-
" \"$tempDir = '%SCRIPT_DIR%_ffmpeg_temp'; ^\n"
430-
" Expand-Archive -Path '%FFMPEG_ZIP%' -DestinationPath $tempDir -Force; ^\n"
431-
' $inner = Get-ChildItem $tempDir -Directory | Select-Object -First 1; ^\n'
432-
" if ($inner -and (Test-Path \\\"$($inner.FullName)\\bin\\\")) { ^\n"
433-
" New-Item -Path '%FFMPEG_DIR%\\bin' -ItemType Directory -Force | Out-Null; ^\n"
434-
" Copy-Item \\\"$($inner.FullName)\\bin\\*\\\" '%FFMPEG_DIR%\\bin\\' -Force; ^\n"
435-
" Write-Host ' Extracted FFmpeg to ffmpeg_portable\\bin\\' ^\n"
436-
' } else { ^\n'
437-
" Write-Host 'WARNING: FFmpeg zip has unexpected structure' ^\n"
438-
' }; ^\n'
439-
" Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue\"\n"
429+
" \"$tempDir = '%SCRIPT_DIR%_ffmpeg_temp';\" ^\n"
430+
" \"Expand-Archive -Path '%FFMPEG_ZIP%' -DestinationPath $tempDir -Force;\" ^\n"
431+
' "$inner = Get-ChildItem $tempDir -Directory | Select-Object -First 1;" ^\n'
432+
" \"if ($inner -and (Test-Path (Join-Path $inner.FullName 'bin'))) {\" ^\n"
433+
" \" New-Item -Path '%FFMPEG_DIR%\\bin' -ItemType Directory -Force | Out-Null;\" ^\n"
434+
" \" Copy-Item (Join-Path $inner.FullName 'bin\\*') '%FFMPEG_DIR%\\bin\\' -Force;\" ^\n"
435+
" \" Write-Host ' Extracted FFmpeg to ffmpeg_portable\\bin\\'\" ^\n"
436+
' "} else {" ^\n'
437+
" \" Write-Host 'WARNING: FFmpeg zip has unexpected structure'\" ^\n"
438+
' "};\" ^\n'
439+
" \"Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue\"\n"
440440
'\n'
441441
'del "%FFMPEG_ZIP%" 2>nul\n'
442442
':ffmpeg_done\n\n'

templates/install.bat.template

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ if exist "%PYTHON_EXE%" (
3131

3232
echo [STEP] Downloading Python %PYTHON_VERSION% embedded...
3333
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
34-
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
35-
$ProgressPreference = 'SilentlyContinue'; ^
36-
Invoke-WebRequest -Uri '%PYTHON_URL%' -OutFile '%PYTHON_ZIP%'"
34+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^
35+
"$ProgressPreference = 'SilentlyContinue';" ^
36+
"Invoke-WebRequest -Uri '%PYTHON_URL%' -OutFile '%PYTHON_ZIP%'"
3737

3838
if not exist "%PYTHON_ZIP%" (
3939
echo.
@@ -67,17 +67,17 @@ if not exist "%PYTHON_DIR%\Lib\site-packages" (
6767
)
6868

6969
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
70-
"$pthFiles = Get-ChildItem '%PYTHON_DIR%\python*._pth'; ^
71-
if ($pthFiles.Count -gt 0) { ^
72-
$pth = $pthFiles[0]; ^
73-
$zipName = (Get-ChildItem '%PYTHON_DIR%\python*.zip' | Select-Object -First 1).Name; ^
74-
if (-not $zipName) { $zipName = '{{PTH_ZIP_NAME}}' }; ^
75-
$content = @($zipName, '.', 'Lib', 'Lib\site-packages', 'DLLs'{{PTH_EXTRA}}, '', 'import site'); ^
76-
$content | Set-Content -Path $pth.FullName -Encoding ASCII; ^
77-
Write-Host ' Configured:' $pth.Name ^
78-
} else { ^
79-
Write-Host 'WARNING: No ._pth file found' ^
80-
}"
70+
"$pthFiles = Get-ChildItem '%PYTHON_DIR%\python*._pth';" ^
71+
"if ($pthFiles.Count -gt 0) {" ^
72+
" $pth = $pthFiles[0];" ^
73+
" $zipName = (Get-ChildItem '%PYTHON_DIR%\python*.zip' | Select-Object -First 1).Name;" ^
74+
" if (-not $zipName) { $zipName = '{{PTH_ZIP_NAME}}' };" ^
75+
" $content = @($zipName, '.', 'Lib', 'Lib\site-packages', 'DLLs'{{PTH_EXTRA}}, '', 'import site');" ^
76+
" $content | Set-Content -Path $pth.FullName -Encoding ASCII;" ^
77+
" Write-Host ' Configured:' $pth.Name" ^
78+
"} else {" ^
79+
" Write-Host 'WARNING: No ._pth file found'" ^
80+
"}"
8181

8282
:: ============================================
8383
:: Step 3: Bootstrap pip (via get-pip.py)
@@ -87,9 +87,9 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
8787
if %errorlevel% neq 0 (
8888
echo [STEP] Downloading get-pip.py...
8989
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
90-
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
91-
$ProgressPreference = 'SilentlyContinue'; ^
92-
Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile '%PYTHON_DIR%\get-pip.py'"
90+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^
91+
"$ProgressPreference = 'SilentlyContinue';" ^
92+
"Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile '%PYTHON_DIR%\get-pip.py'"
9393

9494
if not exist "%PYTHON_DIR%\get-pip.py" (
9595
echo ERROR: Failed to download get-pip.py.

0 commit comments

Comments
 (0)