fix scripts to use poetry, few dependencies

This commit is contained in:
Ondrej Samohel 2021-02-02 17:01:50 +01:00
parent da094ac510
commit e8af83c4a7
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
9 changed files with 2240 additions and 128 deletions

2191
poetry.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ authors = ["Pype Club <info@pype.club>"]
license = "MIT License"
[tool.poetry.dependencies]
python = "3.7"
python = "3.7.*"
aiohttp_json_rpc = "*" # TVPaint server
acre = { git = "https://github.com/pypeclub/acre.git" }
opentimelineio = { git = "https://github.com/pypeclub/OpenTimelineIO.git", branch="develop" }
@ -14,8 +14,9 @@ appdirs = "^1.4.3"
blessed = "^1.17" # pype terminal formatting
clique = "1.5.*"
Click = "^7"
ftrack-python-api = "^2.1"
ftrack-python-api = "2.0.*"
google-api-python-client = "^1.12.8" # sync server google support (should be separate?)
jsonschema = "^3.2.0"
keyring = "^22.0.1"
log4mongo = "^1.7"
pathlib2= "^2.3.5" # deadline submit publish job only (single place, maybe not needed?)
@ -24,7 +25,7 @@ pyblish-base = "^1.8.8"
pynput = "^1.7.2" # idle manager in tray
pymongo = "^3.11.2"
pyqt5 = "^5.12.2" # ideally should be replaced with PySide2
Qt.py = "^1.3.3"
"Qt.py" = "^1.3.3"
setuptools = "45.0.0" # explicit lock for python 2 compatibility in nuke
speedcopy = "^2.1"
six = "^1.15"

View file

@ -65,6 +65,14 @@ function Show-PSWarning() {
}
}
function Install-Poetry() {
Write-Host ">>> " -NoNewline -ForegroundColor Green
Write-Host "Installing Poetry ... "
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
# add it to PATH
$env:PATH = "$($env:PATH);$($env:USERPROFILE)\.poetry\bin"
}
$art = @"
@ -145,26 +153,18 @@ if(($matches[1] -lt 3) -or ($matches[2] -lt 7)) {
}
Write-Host "OK [ $p ]" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Trying to create env ..."
& "$($script_dir)\create_env.ps1"
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
Write-Host ">>> " -NoNewline -ForegroundColor Green
Write-Host "Reading Poetry ... " -NoNewline
if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin")) {
Write-Host "NOT FOUND" -ForegroundColor Yellow
Install-Poetry
Write-Host "INSTALLED" -ForegroundColor Cyan
} else {
Write-Host "OK" -ForegroundColor Green
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Cleaning cache files ... " -NoNewline
Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
@ -174,22 +174,18 @@ Write-Host "OK" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Building Pype ..."
$out = & python setup.py build 2>&1
$out = & poetry run python setup.py build 2>&1
if ($LASTEXITCODE -ne 0)
{
Set-Content -Path "$($pype_root)\build\build.log" -Value $out
Write-Host "!!! " -NoNewLine -ForegroundColor Red
Write-Host "Build failed. Check the log: " -NoNewline
Write-Host ".\build\build.log" -ForegroundColor Yellow
deactivate
Exit-WithCode $LASTEXITCODE
}
Set-Content -Path "$($pype_root)\build\build.log" -Value $out
& python -B "$($pype_root)\tools\build_dependencies.py"
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "deactivating venv ..."
deactivate
& poetry run python "$($pype_root)\tools\build_dependencies.py"
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "restoring current directory"

View file

@ -38,6 +38,8 @@ function Install-Poetry() {
Write-Host ">>> " -NoNewline -ForegroundColor Green
Write-Host "Installing Poetry ... "
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
# add it to PATH
$env:PATH = "$($env:PATH);$($env:USERPROFILE)\.poetry\bin"
}
@ -98,57 +100,23 @@ Write-Host "OK [ $p ]" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor Green
Write-Host "Reading Poetry ... " -NoNewline
if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\poetry\bin")) {
if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin")) {
Write-Host "NOT FOUND" -ForegroundColor Yellow
Install-Poetry
Write-Host "INSTALLED" -ForegroundColor Cyan
} else {
Write-Host "OK" -ForegroundColor Green
}
# Create venv directory if not exist
if (-not (Test-Path -PathType Container -Path "$($pype_root)\venv")) {
New-Item -ItemType Directory -Force -Path "$($pype_root)\venv"
}
Write-Host "--- " -NoNewline -ForegroundColor yellow
Write-Host "Cleaning venv directory ..."
try {
Remove-Item -Recurse -Force "$($pype_root)\venv\*"
}
catch {
Write-Host "!!! " -NoNewline -ForegroundColor red
Write-Host "Cannot clean venv directory, possibly another process is using it."
Write-Host $_.Exception.Message
Exit-WithCode 1
if (-not (Test-Path -PathType Leaf -Path "$($pype_root)\poetry.lock")) {
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Creating virtual environment."
& poetry install
} else {
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Updating virtual environment."
& poetry update
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Creating virtual env ..."
& python -m venv venv
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Updating pip ..."
& python -m pip install --upgrade pip
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Installing packages to new venv ..."
& pip install -r "$($pype_root)\requirements.txt"
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Cleaning cache files ... " -NoNewline
Get-ChildItem "$($pype_root)" -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
Get-ChildItem "$($pype_root)" -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
Write-Host "OK" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Deactivating venv ..."
deactivate
Write-Host "Virtual environment created. "

View file

@ -32,6 +32,7 @@ function Show-PSWarning() {
Exit-WithCode 1
}
}
$current_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$pype_root = (Get-Item $current_dir).parent.FullName
@ -87,23 +88,9 @@ if(($matches[1] -lt 3) -or ($matches[2] -lt 7)) {
}
Write-Host "OK [ $p ]" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Generating zip from current sources ..."
Write-Host "... " -NoNewline -ForegroundColor Magenta
Write-Host "arguments: " -NoNewline -ForegroundColor Gray
Write-Host $ARGS -ForegroundColor White
& python "$($pype_root)\start.py" generate-zip $ARGS
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Deactivating venv ..."
deactivate
& poetry run python "$($pype_root)\start.py" generate-zip $ARGS

View file

@ -32,17 +32,14 @@ $art = @"
Write-Host $art -ForegroundColor DarkGreen
& "$($pype_root)\venv\Scripts\Activate.ps1"
Write-Host "This will not overwrite existing source rst files, only scan and add new."
Set-Location -Path $pype_root
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Running apidoc ..."
sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" igniter
sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" pype vendor, pype\vendor
& poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" igniter
& poetry run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" pype vendor, pype\vendor
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Building html ..."
python setup.py build_sphinx
deactivate
& poetry run python "$($pype_root)\setup.py" build_sphinx
Set-Location -Path $current_dir

View file

@ -14,7 +14,4 @@ PS> .\run_settings.ps1
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$pype_root = (Get-Item $script_dir).parent.FullName
& "$($pype_root)\venv\Scripts\Activate.ps1"
python "$($pype_root)\start.py" settings --dev
deactivate
& poetry run python "$($pype_root)\start.py" settings --dev

View file

@ -31,6 +31,7 @@ function Show-PSWarning() {
Exit-WithCode 1
}
}
$art = @"
@ -94,26 +95,6 @@ if(($matches[1] -lt 3) -or ($matches[2] -lt 7)) {
}
Write-Host "OK [ $p ]" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Trying to create env ..."
& "$($script_dir)\create_env.ps1"
try {
. ("$($pype_root)\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Cleaning cache files ... " -NoNewline
Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
@ -124,11 +105,8 @@ Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Testing Pype ..."
$original_pythonpath = $env:PYTHONPATH
$env:PYTHONPATH="$($pype_root);$($env:PYTHONPATH)"
pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($pype_root)/tests"
& poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($pype_root)/tests"
$env:PYTHONPATH = $original_pythonpath
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "deactivating venv ..."
deactivate
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "restoring current directory"

View file

@ -13,7 +13,4 @@ PS> .\run_tray.ps1
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$pype_root = (Get-Item $script_dir).parent.FullName
& "$($pype_root)\venv\Scripts\Activate.ps1"
python "$($pype_root)\start.py" tray --debug
deactivate
& poetry run python "$($pype_root)\start.py" tray --debug