Merge pull request #340 from PR0M3TH3AN/codex/update-install-scripts-to-check-for-python

Add Python auto-install support to Windows installer
This commit is contained in:
thePR0M3TH3AN
2025-07-06 20:20:29 -04:00
committed by GitHub
2 changed files with 21 additions and 2 deletions

View File

@@ -77,7 +77,8 @@ bash -c "$(curl -sSL https://raw.githubusercontent.com/PR0M3TH3AN/SeedPass/main/
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; $scriptContent = (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/PR0M3TH3AN/SeedPass/main/scripts/install.ps1'); & ([scriptblock]::create($scriptContent))
```
The Windows installer will attempt to install Git automatically if it is not already available.
The Windows installer will attempt to install Git automatically if it is not already available. It also tries to
install Python 3 using `winget`, `choco`, or `scoop` when Python is missing.
**Note:** If you are using Python 3.13 or newer, install the [Microsoft Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and reopen PowerShell before rerunning the installer.
*Install the beta branch:*
```powershell

View File

@@ -85,7 +85,25 @@ if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
}
}
$pythonExe = Get-Command python -ErrorAction SilentlyContinue
if (-not $pythonExe) { Write-Error "Python 3 is not installed or not in your PATH. Please install it from https://www.python.org/" }
if (-not $pythonExe) {
Write-Warning "Python 3 is not installed. Attempting to install..."
if (Get-Command winget -ErrorAction SilentlyContinue) {
try { winget install --id Python.Python.3 -e --source winget -h } catch { Write-Warning "Failed to install Python via winget." }
} elseif (Get-Command choco -ErrorAction SilentlyContinue) {
try { choco install python -y } catch { Write-Warning "Failed to install Python via Chocolatey." }
} elseif (Get-Command scoop -ErrorAction SilentlyContinue) {
try { scoop install python } catch { Write-Warning "Failed to install Python via Scoop." }
} else {
Write-Error "Python 3 is not installed. Please install it from https://www.python.org/ and ensure it's in your PATH."
}
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' +
[System.Environment]::GetEnvironmentVariable('Path','User')
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Error "Python installation succeeded but python not found in PATH. Please open a new terminal or add Python to PATH manually."
}
}
}
# Warn about unsupported Python versions
$pyVersionString = (& python --version) -replace '[^0-9\.]', ''