mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
add support for pyenv on windows
This commit is contained in:
parent
cfa6687a8f
commit
1bea470dd0
1 changed files with 41 additions and 1 deletions
|
|
@ -105,6 +105,46 @@ $env:BUILD_VERSION = $openpype_version
|
|||
|
||||
iscc
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Detecting host Python ... " -NoNewline
|
||||
$python = "python"
|
||||
if (Get-Command "pyenv" -ErrorAction SilentlyContinue) {
|
||||
$pyenv_python = & pyenv which python
|
||||
if (Test-Path -PathType Leaf -Path "$($pyenv_python)") {
|
||||
$python = $pyenv_python
|
||||
}
|
||||
}
|
||||
if (-not (Get-Command $python -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "!!! Python not detected" -ForegroundColor red
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
$version_command = @'
|
||||
import sys
|
||||
print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))
|
||||
'@
|
||||
|
||||
$p = & $python -c $version_command
|
||||
$env:PYTHON_VERSION = $p
|
||||
$m = $p -match '(\d+)\.(\d+)'
|
||||
if(-not $m) {
|
||||
Write-Host "!!! Cannot determine version" -ForegroundColor red
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
# We are supporting python 3.7 only
|
||||
if (($matches[1] -lt 3) -or ($matches[2] -lt 7)) {
|
||||
Write-Host "FAILED Version [ $p ] is old and unsupported" -ForegroundColor red
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
} elseif (($matches[1] -eq 3) -and ($matches[2] -gt 7)) {
|
||||
Write-Host "WARNING Version [ $p ] is unsupported, use at your own risk." -ForegroundColor yellow
|
||||
Write-Host "*** " -NoNewline -ForegroundColor yellow
|
||||
Write-Host "OpenPype supports only Python 3.7" -ForegroundColor white
|
||||
} else {
|
||||
Write-Host "OK [ $p ]" -ForegroundColor green
|
||||
}
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Creating OpenPype installer ... " -ForegroundColor white
|
||||
|
||||
|
|
@ -114,7 +154,7 @@ from distutils.util import get_platform
|
|||
print('exe.{}-{}'.format(get_platform(), sys.version[0:3]))
|
||||
"@
|
||||
|
||||
$build_dir = & python -c $build_dir_command
|
||||
$build_dir = & $python -c $build_dir_command
|
||||
Write-Host "Build directory ... ${build_dir}" -ForegroundColor white
|
||||
$env:BUILD_DIR = $build_dir
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue