Skip to content

Commit

Permalink
Update install_python_venv.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Feb 19, 2024
1 parent 45a9412 commit 8bc58d4
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions install_python_venv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,29 @@ function Find-Python {
# Check for Python 3 command and version
$python3Command = Get-Command -Name "python3" -ErrorAction SilentlyContinue
if ($null -ne $python3Command) {
$global:pythonVersion = Get-Python-Version "python3"
$testPath = Get-Path-From-Command "python3"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python3 command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3"
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
}
}
}

$pythonCommand = Get-Command -Name "python" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python"
$testPath = Get-Path-From-Command "python"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand All @@ -432,12 +436,13 @@ function Find-Python {

$pythonCommand = Get-Command -Name "python3.8" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python3.8"
$testPath = Get-Path-From-Command "python3.8"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3.8"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3.8 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand All @@ -447,12 +452,13 @@ function Find-Python {

$pythonCommand = Get-Command -Name "python3.9" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python3.9"
$testPath = Get-Path-From-Command "python3.9"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3.9"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3.9 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand All @@ -462,12 +468,13 @@ function Find-Python {

$pythonCommand = Get-Command -Name "python3.10" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python3.10"
$testPath = Get-Path-From-Command "python3.10"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3.10"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3.10 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand All @@ -477,12 +484,13 @@ function Find-Python {

$pythonCommand = Get-Command -Name "python3.11" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python3.11"
$testPath = Get-Path-From-Command "python3.11"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3.11"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3.11 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand All @@ -492,12 +500,13 @@ function Find-Python {

$pythonCommand = Get-Command -Name "python3.12" -ErrorAction SilentlyContinue
if ($null -ne $pythonCommand) {
$global:pythonVersion = Get-Python-Version "python3.12"
$testPath = Get-Path-From-Command "python3.12"
$global:pythonVersion = Get-Python-Version $testPath
if ($global:pythonVersion -ge $minVersion -and $global:pythonVersion -lt $maxVersion) {
Write-Host "Found python command with version $global:pythonVersion"
$global:pythonInstallPath = Get-Path-From-Command "python3.12"
$global:pythonInstallPath = Get-Path-From-Command $testPath
} else {
Write-Host "python3.12 path '$global:pythonInstallPath' version '$global:pythonVersion' not supported"
Write-Host "python '$testPath' version '$global:pythonVersion' not supported"
if ( $global:pythonInstallPath -eq "" ) {
$global:pythonInstallPath = ""
$global:pythonVersion = ""
Expand Down

0 comments on commit 8bc58d4

Please sign in to comment.