Skip to content

Commit 5b6e0b7

Browse files
naizhaoclaude
andcommitted
Add python27.dll copy logic for Python 2.7 packaging
Copy python27.dll from Windows system directory to package directory for Python 2.7.18 to ensure portable distribution works correctly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6d9f96e commit 5b6e0b7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/package_python_install.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,24 @@ jobs:
443443
Get-ChildItem -Path $installDir -Recurse -Depth 1 | Out-String
444444
$itemCount = (Get-ChildItem -Path $installDir).Count
445445
if ($itemCount -eq 0) { Write-Error "Installation directory '$installDir' is empty. Cannot package."; exit 1 }
446+
# Copy python27.dll for Python 2.7 if needed
447+
$version = "${{ inputs.python_version }}"
448+
if ($version -eq '2.7.18') {
449+
$python27DllSource = "C:\Windows\System32\python27.dll"
450+
$python27DllDest = Join-Path -Path $installDir -ChildPath "python27.dll"
451+
if (Test-Path $python27DllSource) {
452+
Write-Host "Copying python27.dll from '$python27DllSource' to '$python27DllDest'..."
453+
try {
454+
Copy-Item -Path $python27DllSource -Destination $python27DllDest -Force -ErrorAction Stop
455+
Write-Host "python27.dll copied successfully."
456+
} catch {
457+
Write-Warning "Failed to copy python27.dll: $_. The package may not work properly on systems without Python 2.7 installed."
458+
}
459+
} else {
460+
Write-Warning "python27.dll not found at '$python27DllSource'. The package may not work properly on systems without Python 2.7 installed."
461+
}
462+
}
463+
446464
Write-Host "Compressing installed Python from '$installDir' to '$destinationPath'..."
447465
$parentDir = Split-Path $installDir -Parent; $dirName = Split-Path $installDir -Leaf
448466
Push-Location $parentDir

0 commit comments

Comments
 (0)