mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
cleanup root of repository
This commit is contained in:
parent
56bfe209f6
commit
22260b3e6d
775 changed files with 5 additions and 61446 deletions
196
tools/build.ps1
196
tools/build.ps1
|
|
@ -1,196 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to build OpenPype.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, and build OpenPype to `build`
|
||||
directory using existing virtual environment created by Poetry (or
|
||||
by running `/tools/create_venv.ps1`). It will then shuffle dependencies in
|
||||
build folder to optimize for different Python versions (2/3) in Python host.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\build.ps1
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
To build without automatical submodule update:
|
||||
PS> .\build.ps1 --no-submodule-update
|
||||
|
||||
.LINK
|
||||
https://openpype.io/docs
|
||||
|
||||
#>
|
||||
|
||||
$arguments=$ARGS
|
||||
$disable_submodule_update=""
|
||||
if($arguments -eq "--no-submodule-update") {
|
||||
$disable_submodule_update=$true
|
||||
}
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
function Start-Progress {
|
||||
param([ScriptBlock]$code)
|
||||
$scroll = "/-\|/-\|"
|
||||
$idx = 0
|
||||
$job = Invoke-Command -ComputerName $env:ComputerName -ScriptBlock { $code } -AsJob
|
||||
|
||||
$origpos = $host.UI.RawUI.CursorPosition
|
||||
|
||||
# $origpos.Y -= 1
|
||||
|
||||
while (($job.State -eq "Running") -and ($job.State -ne "NotStarted"))
|
||||
{
|
||||
$host.UI.RawUI.CursorPosition = $origpos
|
||||
Write-Host $scroll[$idx] -NoNewline
|
||||
$idx++
|
||||
if ($idx -ge $scroll.Length)
|
||||
{
|
||||
$idx = 0
|
||||
}
|
||||
Start-Sleep -Milliseconds 100
|
||||
}
|
||||
# It's over - clear the activity indicator.
|
||||
$host.UI.RawUI.CursorPosition = $origpos
|
||||
Write-Host ' '
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Display spinner for running job
|
||||
.PARAMETER code
|
||||
Job to display spinner for
|
||||
#>
|
||||
}
|
||||
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
function Show-PSWarning() {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||
Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White
|
||||
Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
|
||||
function Install-Poetry() {
|
||||
Write-Color -Text ">>> ", "Installing Poetry ... " -Color Green, Gray
|
||||
$env:POETRY_HOME="$openpype_root\.poetry"
|
||||
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python -
|
||||
}
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
# Create build directory if not exist
|
||||
if (-not (Test-Path -PathType Container -Path "$($openpype_root)\build")) {
|
||||
New-Item -ItemType Directory -Force -Path "$($openpype_root)\build"
|
||||
}
|
||||
|
||||
Write-Color -Text "--- ", "Cleaning build directory ..." -Color Yellow, Gray
|
||||
try {
|
||||
Remove-Item -Recurse -Force "$($openpype_root)\build\*"
|
||||
}
|
||||
catch {
|
||||
Write-Color -Text "!!! ", "Cannot clean build directory, possibly because process is using it." -Color Red, Gray
|
||||
Write-Color -Text $_.Exception.Message -Color Red
|
||||
Exit-WithCode 1
|
||||
}
|
||||
if (-not $disable_submodule_update) {
|
||||
Write-Color -Text ">>> ", "Making sure submodules are up-to-date ..." -Color Green, Gray
|
||||
& git submodule update --init --recursive
|
||||
} else {
|
||||
Write-Color -Text "*** ", "Not updating submodules ..." -Color Green, Gray
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "OpenPype [ ", $openpype_version, " ]" -Color Green, White, Cyan, White
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Cleaning cache files ... " -Color Green, Gray -NoNewline
|
||||
Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "*.pyo" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force -Recurse
|
||||
Write-Color -Text "OK" -Color green
|
||||
|
||||
Write-Color -Text ">>> ", "Building OpenPype ..." -Color Green, White
|
||||
$startTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
|
||||
$out = & "$($env:POETRY_HOME)\bin\poetry" run python setup.py build 2>&1
|
||||
Set-Content -Path "$($openpype_root)\build\build.log" -Value $out
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Write-Color -Text "------------------------------------------" -Color Red
|
||||
Get-Content "$($openpype_root)\build\build.log"
|
||||
Write-Color -Text "------------------------------------------" -Color Yellow
|
||||
Write-Color -Text "!!! ", "Build failed. Check the log: ", ".\build\build.log" -Color Red, Yellow, White
|
||||
Exit-WithCode $LASTEXITCODE
|
||||
}
|
||||
|
||||
Set-Content -Path "$($openpype_root)\build\build.log" -Value $out
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\tools\build_dependencies.py"
|
||||
|
||||
Write-Color -Text ">>> ", "Restoring current directory" -Color Green, Gray
|
||||
Set-Location -Path $current_dir
|
||||
|
||||
$endTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
try
|
||||
{
|
||||
New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype build complete!", "All done in $( $endTime - $startTime ) secs. You will find OpenPype and build log in build directory."
|
||||
} catch {}
|
||||
Write-Color -Text "*** ", "All done in ", $($endTime - $startTime), " secs. You will find OpenPype and build log in ", "'.\build'", " directory." -Color Green, Gray, White, Gray, White, Gray
|
||||
230
tools/build.sh
230
tools/build.sh
|
|
@ -1,230 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Build Pype using existing virtual environment.
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
args=$@
|
||||
disable_submodule_update=0
|
||||
while :; do
|
||||
case $1 in
|
||||
--no-submodule-update)
|
||||
disable_submodule_update=1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Detect required version of python
|
||||
# Globals:
|
||||
# colors
|
||||
# PYTHON
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
detect_python () {
|
||||
echo -e "${BIGreen}>>>${RST} Using python \c"
|
||||
command -v python >/dev/null 2>&1 || { echo -e "${BIRed}- NOT FOUND${RST} ${BIYellow}You need Python 3.9 installed to continue.${RST}"; return 1; }
|
||||
local version_command
|
||||
version_command="import sys;print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"
|
||||
local python_version
|
||||
python_version="$(python <<< ${version_command})"
|
||||
oIFS="$IFS"
|
||||
IFS=.
|
||||
set -- $python_version
|
||||
IFS="$oIFS"
|
||||
if [ "$1" -ge "3" ] && [ "$2" -ge "9" ] ; then
|
||||
if [ "$2" -gt "9" ] ; then
|
||||
echo -e "${BIWhite}[${RST} ${BIRed}$1.$2 ${BIWhite}]${RST} - ${BIRed}FAILED${RST} ${BIYellow}Version is new and unsupported, use${RST} ${BIPurple}3.9.x${RST}"; return 1;
|
||||
else
|
||||
echo -e "${BIWhite}[${RST} ${BIGreen}$1.$2${RST} ${BIWhite}]${RST}"
|
||||
fi
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo -e "${BIRed}$1.$2$ - ${BIRed}FAILED${RST} ${BIYellow}Version is old and unsupported${RST}"; return 1; }
|
||||
fi
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Clean pyc files in specified directory
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Optional path to clean
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -path ./build -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1") || return; pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
openpype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})"))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
version_command="import os;import re;version={};exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read(), version);print(re.search(r'(\d+\.\d+.\d+).*', version['__version__'])[1]);"
|
||||
openpype_version="$(python <<< ${version_command})"
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
echo -e "${BIYellow}---${RST} Cleaning build directory ..."
|
||||
rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building OpenPype ${BIWhite}[${RST} ${BIGreen}$openpype_version${RST} ${BIWhite}]${RST}"
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
|
||||
clean_pyc
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return 1; }
|
||||
fi
|
||||
|
||||
if [ "$disable_submodule_update" == 1 ]; then
|
||||
echo -e "${BIYellow}***${RST} Not updating submodules ..."
|
||||
else
|
||||
echo -e "${BIGreen}>>>${RST} Making sure submodules are up-to-date ..."
|
||||
git submodule update --init --recursive || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return 1; }
|
||||
fi
|
||||
echo -e "${BIGreen}>>>${RST} Building ..."
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
"$POETRY_HOME/bin/poetry" run python "$openpype_root/setup.py" build &> "$openpype_root/build/build.log" || { echo -e "${BIRed}------------------------------------------${RST}"; cat "$openpype_root/build/build.log"; echo -e "${BIRed}------------------------------------------${RST}"; echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return 1; }
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
"$POETRY_HOME/bin/poetry" run python "$openpype_root/setup.py" bdist_mac &> "$openpype_root/build/build.log" || { echo -e "${BIRed}------------------------------------------${RST}"; cat "$openpype_root/build/build.log"; echo -e "${BIRed}------------------------------------------${RST}"; echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return 1; }
|
||||
fi
|
||||
"$POETRY_HOME/bin/poetry" run python "$openpype_root/tools/build_dependencies.py" || { echo -e "${BIRed}!!!>${RST} ${BIYellow}Failed to process dependencies${RST}"; return 1; }
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# fix cx_Freeze libs issue
|
||||
echo -e "${BIGreen}>>>${RST} Fixing libs ..."
|
||||
mv "$openpype_root/build/OpenPype $openpype_version.app/Contents/MacOS/dependencies/cx_Freeze" "$openpype_root/build/OpenPype $openpype_version.app/Contents/MacOS/lib/" || { echo -e "${BIRed}!!!>${RST} ${BIYellow}Can't move cx_Freeze libs${RST}"; return 1; }
|
||||
|
||||
# force hide icon from Dock
|
||||
defaults write "$openpype_root/build/OpenPype $openpype_version.app/Contents/Info" LSUIElement 1
|
||||
|
||||
# fix code signing issue
|
||||
echo -e "${BIGreen}>>>${RST} Fixing code signatures ...\c"
|
||||
codesign --remove-signature "$openpype_root/build/OpenPype $openpype_version.app/Contents/MacOS/openpype_console" || { echo -e "${BIRed}FAILED${RST}"; return 1; }
|
||||
codesign --remove-signature "$openpype_root/build/OpenPype $openpype_version.app/Contents/MacOS/openpype_gui" || { echo -e "${BIRed}FAILED${RST}"; return 1; }
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
if command -v create-dmg > /dev/null 2>&1; then
|
||||
echo -e "${BIGreen}>>>${RST} Creating dmg image ...\c"
|
||||
create-dmg \
|
||||
--volname "OpenPype $openpype_version Installer" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 600 300 \
|
||||
--app-drop-link 100 50 \
|
||||
"$openpype_root/build/OpenPype-Installer-$openpype_version.dmg" \
|
||||
"$openpype_root/build/OpenPype $openpype_version.app"
|
||||
|
||||
test $? -eq 0 || { echo -e "${BIRed}FAILED${RST}"; return 1; }
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}!!!${RST} ${BIWhite}create-dmg${RST} command is not available."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find OpenPype and build log in \c"
|
||||
echo -e "${BIWhite}$openpype_root/build${RST} directory."
|
||||
}
|
||||
|
||||
return_code=0
|
||||
main || return_code=$?
|
||||
exit $return_code
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Script to fix frozen dependencies.
|
||||
|
||||
Because Pype code needs to run under different versions of Python interpreter
|
||||
(yes, even Python 2) we need to include all dependencies as source code
|
||||
without Python's system stuff. Cx-freeze puts everything into lib and compile
|
||||
it as .pyc/.pyo files and that doesn't work for hosts like Maya 2020 with
|
||||
their own Python interpreter and libraries.
|
||||
|
||||
This script will take ``site-packages`` and copy them to built Pype under
|
||||
``dependencies`` directory. It will then compare stuff inside with ``lib``
|
||||
folder in frozen Pype, removing duplicities from there.
|
||||
|
||||
This must be executed after build finished and it is done by build PowerShell
|
||||
script.
|
||||
|
||||
Note: Speedcopy can be used for copying if server-side copy is important for
|
||||
speed.
|
||||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import site
|
||||
from sysconfig import get_platform
|
||||
import platform
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import blessed
|
||||
import enlighten
|
||||
import time
|
||||
import re
|
||||
|
||||
|
||||
term = blessed.Terminal()
|
||||
manager = enlighten.get_manager()
|
||||
|
||||
|
||||
def _print(msg: str, type: int = 0) -> None:
|
||||
"""Print message to console.
|
||||
|
||||
Args:
|
||||
msg (str): message to print
|
||||
type (int): type of message (0 info, 1 error, 2 note)
|
||||
|
||||
"""
|
||||
if type == 0:
|
||||
header = term.aquamarine3(">>> ")
|
||||
elif type == 1:
|
||||
header = term.orangered2("!!! ")
|
||||
elif type == 2:
|
||||
header = term.tan1("... ")
|
||||
else:
|
||||
header = term.darkolivegreen3("--- ")
|
||||
|
||||
print(f"{header}{msg}")
|
||||
|
||||
|
||||
def count_folders(path: Path) -> int:
|
||||
"""Recursively count items inside given Path.
|
||||
|
||||
Args:
|
||||
path (Path): Path to count.
|
||||
|
||||
Returns:
|
||||
int: number of items.
|
||||
|
||||
"""
|
||||
cnt = 0
|
||||
for child in path.iterdir():
|
||||
if child.is_dir():
|
||||
cnt += 1
|
||||
cnt += count_folders(child)
|
||||
return cnt
|
||||
|
||||
|
||||
_print("Starting dependency cleanup ...")
|
||||
start_time = time.time_ns()
|
||||
|
||||
# path to venv site packages
|
||||
sites = site.getsitepackages()
|
||||
|
||||
# WARNING: this assumes that all we've got is path to venv itself and
|
||||
# another path ending with 'site-packages' as is default. But because
|
||||
# this must run under different platform, we cannot easily check if this path
|
||||
# is the one, because under Linux and macOS site-packages are in different
|
||||
# location.
|
||||
site_pkg = None
|
||||
for s in sites:
|
||||
site_pkg = Path(s)
|
||||
if site_pkg.name == "site-packages":
|
||||
break
|
||||
|
||||
_print("Getting venv site-packages ...")
|
||||
assert site_pkg, "No venv site-packages are found."
|
||||
_print(f"Working with: {site_pkg}", 2)
|
||||
|
||||
openpype_root = Path(os.path.dirname(__file__)).parent
|
||||
version = {}
|
||||
with open(openpype_root / "openpype" / "version.py") as fp:
|
||||
exec(fp.read(), version)
|
||||
|
||||
version_match = re.search(r"(\d+\.\d+.\d+).*", version["__version__"])
|
||||
openpype_version = version_match[1]
|
||||
|
||||
# create full path
|
||||
if platform.system().lower() == "darwin":
|
||||
build_dir = openpype_root.joinpath(
|
||||
"build",
|
||||
f"OpenPype {openpype_version}.app",
|
||||
"Contents",
|
||||
"MacOS")
|
||||
else:
|
||||
build_subdir = f"exe.{get_platform()}-{sys.version[:3]}"
|
||||
build_dir = openpype_root / "build" / build_subdir
|
||||
|
||||
_print(f"Using build at {build_dir}", 2)
|
||||
if not build_dir.exists():
|
||||
_print("Build directory doesn't exist", 1)
|
||||
_print("Probably freezing of code failed. Check ./build/build.log", 3)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _progress(_base, _names):
|
||||
progress_bar.update()
|
||||
return []
|
||||
|
||||
|
||||
deps_dir = build_dir / "dependencies"
|
||||
vendor_dir = build_dir / "vendor"
|
||||
vendor_src = openpype_root / "vendor"
|
||||
|
||||
# copy vendor files
|
||||
_print("Copying vendor files ...")
|
||||
|
||||
total_files = count_folders(vendor_src)
|
||||
progress_bar = enlighten.Counter(
|
||||
total=total_files, desc="Copying vendor files ...",
|
||||
units="%", color=(64, 128, 222))
|
||||
|
||||
shutil.copytree(vendor_src.as_posix(),
|
||||
vendor_dir.as_posix(),
|
||||
ignore=_progress)
|
||||
progress_bar.close()
|
||||
|
||||
# copy all files
|
||||
_print("Copying dependencies ...")
|
||||
|
||||
total_files = count_folders(site_pkg)
|
||||
progress_bar = enlighten.Counter(
|
||||
total=total_files, desc="Processing Dependencies",
|
||||
units="%", color=(53, 178, 202))
|
||||
|
||||
shutil.copytree(site_pkg.as_posix(),
|
||||
deps_dir.as_posix(),
|
||||
ignore=_progress)
|
||||
progress_bar.close()
|
||||
# iterate over frozen libs and create list to delete
|
||||
libs_dir = build_dir / "lib"
|
||||
|
||||
|
||||
# On Linux use rpath from source libraries in destination libraries
|
||||
if platform.system().lower() == "linux":
|
||||
src_pyside_dir = openpype_root / "vendor" / "python" / "PySide2"
|
||||
dst_pyside_dir = build_dir / "vendor" / "python" / "PySide2"
|
||||
src_rpath_per_so_file = {}
|
||||
for filepath in src_pyside_dir.glob("*.so"):
|
||||
filename = filepath.name
|
||||
rpath = (
|
||||
subprocess.check_output(["patchelf", "--print-rpath", filepath])
|
||||
.decode("utf-8")
|
||||
.strip()
|
||||
)
|
||||
src_rpath_per_so_file[filename] = rpath
|
||||
|
||||
for filepath in dst_pyside_dir.glob("*.so"):
|
||||
filename = filepath.name
|
||||
if filename not in src_rpath_per_so_file:
|
||||
continue
|
||||
src_rpath = src_rpath_per_so_file[filename]
|
||||
subprocess.check_call(
|
||||
["patchelf", "--set-rpath", src_rpath, filepath]
|
||||
)
|
||||
|
||||
to_delete = []
|
||||
# _print("Finding duplicates ...")
|
||||
deps_items = list(deps_dir.iterdir())
|
||||
item_count = len(list(libs_dir.iterdir()))
|
||||
find_progress_bar = enlighten.Counter(
|
||||
total=item_count, desc="Finding duplicates", units="%",
|
||||
color=(56, 211, 159))
|
||||
|
||||
for d in libs_dir.iterdir():
|
||||
if (deps_dir / d.name) in deps_items:
|
||||
to_delete.append(d)
|
||||
# _print(f"found {d}", 3)
|
||||
find_progress_bar.update()
|
||||
|
||||
find_progress_bar.close()
|
||||
# add openpype and igniter in libs too
|
||||
to_delete.append(libs_dir / "openpype")
|
||||
to_delete.append(libs_dir / "igniter")
|
||||
to_delete.append(libs_dir / "openpype.pth")
|
||||
to_delete.append(deps_dir / "openpype.pth")
|
||||
|
||||
# delete duplicates
|
||||
# _print(f"Deleting {len(to_delete)} duplicates ...")
|
||||
delete_progress_bar = enlighten.Counter(
|
||||
total=len(to_delete), desc="Deleting duplicates", units="%",
|
||||
color=(251, 192, 32))
|
||||
for d in to_delete:
|
||||
if d.is_dir():
|
||||
shutil.rmtree(d)
|
||||
else:
|
||||
try:
|
||||
d.unlink()
|
||||
except FileNotFoundError:
|
||||
# skip non-existent silently
|
||||
pass
|
||||
delete_progress_bar.update()
|
||||
|
||||
delete_progress_bar.close()
|
||||
|
||||
end_time = time.time_ns()
|
||||
total_time = (end_time - start_time) / 1000000000
|
||||
_print(f"Dependency cleanup done in {total_time} secs.")
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to build OpenPype Installer.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will use already built OpenPype (in `build` directory) and
|
||||
create Windows installer from it using Inno Setup (https://jrsoftware.org/)
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\build_win_installer.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
function Start-Progress {
|
||||
param([ScriptBlock]$code)
|
||||
$scroll = "/-\|/-\|"
|
||||
$idx = 0
|
||||
$job = Invoke-Command -ComputerName $env:ComputerName -ScriptBlock { $code } -AsJob
|
||||
|
||||
$origpos = $host.UI.RawUI.CursorPosition
|
||||
|
||||
# $origpos.Y -= 1
|
||||
|
||||
while (($job.State -eq "Running") -and ($job.State -ne "NotStarted"))
|
||||
{
|
||||
$host.UI.RawUI.CursorPosition = $origpos
|
||||
Write-Host $scroll[$idx] -NoNewline
|
||||
$idx++
|
||||
if ($idx -ge $scroll.Length)
|
||||
{
|
||||
$idx = 0
|
||||
}
|
||||
Start-Sleep -Milliseconds 100
|
||||
}
|
||||
# It's over - clear the activity indicator.
|
||||
$host.UI.RawUI.CursorPosition = $origpos
|
||||
Write-Host ' '
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Display spinner for running job
|
||||
.PARAMETER code
|
||||
Job to display spinner for
|
||||
#>
|
||||
}
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
function Show-PSWarning() {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||
Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White
|
||||
Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
$env:BUILD_VERSION = $openpype_version
|
||||
|
||||
iscc
|
||||
|
||||
Write-Color ">>> ", "Detecting host Python ... " -Color Green, White -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-Color "!!! ", "Python not detected" -Color Red, Yellow
|
||||
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-Color "!!! ", "Cannot determine version" -Color Red, Yellow
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
# We are supporting python 3.9
|
||||
if (($matches[1] -lt 3) -or ($matches[2] -lt 9)) {
|
||||
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 9)) {
|
||||
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.9" -ForegroundColor white
|
||||
} else {
|
||||
Write-Host "OK [ $p ]" -ForegroundColor green
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Creating OpenPype installer ... " -Color Green, White
|
||||
|
||||
$build_dir_command = @"
|
||||
import sys
|
||||
from distutils.util import get_platform
|
||||
print('exe.{}-{}'.format(get_platform(), sys.version[0:3]))
|
||||
"@
|
||||
|
||||
$build_dir = & $python -c $build_dir_command
|
||||
Write-Color -Text "--- ", "Build directory ", "${build_dir}" -Color Green, Gray, White
|
||||
$env:BUILD_DIR = $build_dir
|
||||
|
||||
if (-not (Get-Command iscc -errorAction SilentlyContinue -ErrorVariable ProcessError)) {
|
||||
Write-Color -Text "!!! ", "Cannot find Inno Setup command" -Color Red, Yellow
|
||||
Write-Color "!!! You can download it at https://jrsoftware.org/" -ForegroundColor red
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
& iscc "$openpype_root\inno_setup.iss"
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Color -Text "!!! ", "Creating installer failed." -Color Red, Yellow
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Restoring current directory" -Color Green, Gray
|
||||
Set-Location -Path $current_dir
|
||||
try {
|
||||
New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype build complete!", "All done. You will find You will find OpenPype installer in '.\build' directory."
|
||||
} catch {}
|
||||
Write-Color -Text "*** ", "All done. You will find OpenPype installer in ", "'.\build'", " directory." -Color Green, Gray, White, Gray
|
||||
|
|
@ -1,231 +0,0 @@
|
|||
import re
|
||||
import sys
|
||||
from semver import VersionInfo
|
||||
from git import Repo
|
||||
from optparse import OptionParser
|
||||
from github import Github
|
||||
import os
|
||||
|
||||
def get_release_type_github(Log, github_token):
|
||||
minor_labels = ["Bump Minor"]
|
||||
|
||||
g = Github(github_token)
|
||||
repo = g.get_repo("ynput/OpenPype")
|
||||
|
||||
labels = set()
|
||||
for line in Log.splitlines():
|
||||
match = re.search("pull request #(\d+)", line)
|
||||
if match:
|
||||
pr_number = match.group(1)
|
||||
try:
|
||||
pr = repo.get_pull(int(pr_number))
|
||||
except:
|
||||
continue
|
||||
for label in pr.labels:
|
||||
labels.add(label.name)
|
||||
|
||||
if any(label in labels for label in minor_labels):
|
||||
return "minor"
|
||||
else:
|
||||
return "patch"
|
||||
|
||||
# TODO: if all is working fine, this part can be cleaned up eventually
|
||||
# if any(label in labels for label in patch_labels):
|
||||
# return "patch"
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def remove_prefix(text, prefix):
|
||||
return text[text.startswith(prefix) and len(prefix):]
|
||||
|
||||
|
||||
def get_last_version(match):
|
||||
repo = Repo()
|
||||
assert not repo.bare
|
||||
version_types = {
|
||||
"CI": "CI/[0-9]*",
|
||||
"release": "[0-9]*"
|
||||
}
|
||||
tag = repo.git.describe(
|
||||
'--tags',
|
||||
f'--match={version_types[match]}',
|
||||
'--abbrev=0'
|
||||
)
|
||||
|
||||
if match == "CI":
|
||||
return remove_prefix(tag, "CI/"), tag
|
||||
else:
|
||||
return tag, tag
|
||||
|
||||
|
||||
def get_log_since_tag(version):
|
||||
repo = Repo()
|
||||
assert not repo.bare
|
||||
return repo.git.log(f'{version}..HEAD', '--merges', '--oneline')
|
||||
|
||||
|
||||
def release_type(log):
|
||||
regex_minor = ["feature/", "(feat)"]
|
||||
regex_patch = ["bugfix/", "fix/", "(fix)", "enhancement/", "update"]
|
||||
for reg in regex_minor:
|
||||
if re.search(reg, log):
|
||||
return "minor"
|
||||
for reg in regex_patch:
|
||||
if re.search(reg, log):
|
||||
return "patch"
|
||||
return None
|
||||
|
||||
|
||||
def file_regex_replace(filename, regex, version):
|
||||
with open(filename, 'r+') as f:
|
||||
text = f.read()
|
||||
text = re.sub(regex, version, text)
|
||||
# pp.pprint(f"NEW VERSION {version} INSERTED into {filename}")
|
||||
f.seek(0)
|
||||
f.write(text)
|
||||
f.truncate()
|
||||
|
||||
|
||||
def bump_file_versions(version, nightly=False):
|
||||
|
||||
filename = "./openpype/version.py"
|
||||
regex = "(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-((0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?"
|
||||
file_regex_replace(filename, regex, version)
|
||||
|
||||
if nightly:
|
||||
# skip nightly reversion in pyproject.toml
|
||||
return
|
||||
|
||||
# bump pyproject.toml
|
||||
filename = "pyproject.toml"
|
||||
regex = "version = \"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(\+((0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?\" # OpenPype"
|
||||
pyproject_version = f"version = \"{version}\" # OpenPype"
|
||||
file_regex_replace(filename, regex, pyproject_version)
|
||||
|
||||
|
||||
def calculate_next_nightly(type="nightly", github_token=None):
|
||||
last_prerelease, last_pre_tag = get_last_version("CI")
|
||||
last_pre_v = VersionInfo.parse(last_prerelease)
|
||||
last_pre_v_finalized = last_pre_v.finalize_version()
|
||||
# print(last_pre_v_finalized)
|
||||
|
||||
last_release, last_release_tag = get_last_version("release")
|
||||
|
||||
last_release_v = VersionInfo.parse(last_release)
|
||||
bump_type = get_release_type_github(
|
||||
get_log_since_tag(last_release_tag),
|
||||
github_token
|
||||
)
|
||||
if not bump_type:
|
||||
return None
|
||||
|
||||
next_release_v = last_release_v.next_version(part=bump_type)
|
||||
# print(next_release_v)
|
||||
|
||||
if next_release_v > last_pre_v_finalized:
|
||||
next_tag = next_release_v.bump_prerelease(token=type).__str__()
|
||||
return next_tag
|
||||
elif next_release_v == last_pre_v_finalized:
|
||||
next_tag = last_pre_v.bump_prerelease(token=type).__str__()
|
||||
return next_tag
|
||||
|
||||
def finalize_latest_nightly():
|
||||
last_prerelease, last_pre_tag = get_last_version("CI")
|
||||
last_pre_v = VersionInfo.parse(last_prerelease)
|
||||
last_pre_v_finalized = last_pre_v.finalize_version()
|
||||
# print(last_pre_v_finalized)
|
||||
|
||||
return last_pre_v_finalized.__str__()
|
||||
|
||||
def finalize_prerelease(prerelease):
|
||||
|
||||
if "/" in prerelease:
|
||||
prerelease = prerelease.split("/")[-1]
|
||||
|
||||
prerelease_v = VersionInfo.parse(prerelease)
|
||||
prerelease_v_finalized = prerelease_v.finalize_version()
|
||||
|
||||
return prerelease_v_finalized.__str__()
|
||||
|
||||
|
||||
def main():
|
||||
usage = "usage: %prog [options] arg"
|
||||
parser = OptionParser(usage)
|
||||
parser.add_option("-n", "--nightly",
|
||||
dest="nightly", action="store_true",
|
||||
help="Bump nightly version and return it")
|
||||
parser.add_option("-b", "--bump",
|
||||
dest="bump", action="store_true",
|
||||
help="Return if there is something to bump")
|
||||
parser.add_option("-r", "--release-latest",
|
||||
dest="releaselatest", action="store_true",
|
||||
help="finalize latest prerelease to a release")
|
||||
parser.add_option("-p", "--prerelease",
|
||||
dest="prerelease", action="store",
|
||||
help="define prerelease type")
|
||||
parser.add_option("-f", "--finalize",
|
||||
dest="finalize", action="store",
|
||||
help="define prerelease type")
|
||||
parser.add_option("-v", "--version",
|
||||
dest="version", action="store",
|
||||
help="work with explicit version")
|
||||
parser.add_option("-l", "--lastversion",
|
||||
dest="lastversion", action="store",
|
||||
help="work with explicit version")
|
||||
parser.add_option("-g", "--github_token",
|
||||
dest="github_token", action="store",
|
||||
help="github token")
|
||||
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.bump:
|
||||
last_release, last_release_tag = get_last_version("release")
|
||||
bump_type_release = get_release_type_github(
|
||||
get_log_since_tag(last_release_tag),
|
||||
options.github_token
|
||||
)
|
||||
if bump_type_release is None:
|
||||
print("skip")
|
||||
else:
|
||||
print(bump_type_release)
|
||||
|
||||
if options.nightly:
|
||||
next_tag_v = calculate_next_nightly(github_token=options.github_token)
|
||||
print(next_tag_v)
|
||||
bump_file_versions(next_tag_v, True)
|
||||
|
||||
if options.finalize:
|
||||
new_release = finalize_prerelease(options.finalize)
|
||||
print(new_release)
|
||||
bump_file_versions(new_release)
|
||||
|
||||
if options.lastversion:
|
||||
last_release, last_release_tag = get_last_version(options.lastversion)
|
||||
print(last_release_tag)
|
||||
|
||||
if options.releaselatest:
|
||||
new_release = finalize_latest_nightly()
|
||||
last_release, last_release_tag = get_last_version("release")
|
||||
|
||||
if VersionInfo.parse(new_release) > VersionInfo.parse(last_release):
|
||||
print(new_release)
|
||||
bump_file_versions(new_release)
|
||||
else:
|
||||
print("skip")
|
||||
|
||||
if options.prerelease:
|
||||
current_prerelease = VersionInfo.parse(options.prerelease)
|
||||
new_prerelease = current_prerelease.bump_prerelease().__str__()
|
||||
print(new_prerelease)
|
||||
bump_file_versions(new_prerelease)
|
||||
|
||||
if options.version:
|
||||
bump_file_versions(options.version)
|
||||
print(f"Injected version {options.version} into the release")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script create virtual environment using Poetry.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, create venv with Poetry
|
||||
and install all necessary packages from `poetry.lock` or `pyproject.toml`
|
||||
needed by OpenPype to be included during application freeze on Windows.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\create_env.ps1
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Print verbose information from Poetry:
|
||||
PS> .\create_env.ps1 --verbose
|
||||
|
||||
#>
|
||||
|
||||
$arguments=$ARGS
|
||||
$poetry_verbosity=$null
|
||||
if($arguments -eq "--verbose") {
|
||||
$poetry_verbosity="-vvv"
|
||||
}
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
& git submodule update --init --recursive
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
|
||||
function Show-PSWarning() {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||
Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White
|
||||
Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Install-Poetry() {
|
||||
Write-Color -Text ">>> ", "Installing Poetry ... " -Color Green, Gray
|
||||
$python = "python"
|
||||
if (Get-Command "pyenv" -ErrorAction SilentlyContinue) {
|
||||
if (-not (Test-Path -PathType Leaf -Path "$($openpype_root)\.python-version")) {
|
||||
$result = & pyenv global
|
||||
if ($result -eq "no global version configured") {
|
||||
Write-Color -Text "!!! ", "Using pyenv but having no local or global version of Python set." -Color Red, Yellow
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
$python = & pyenv which python
|
||||
|
||||
}
|
||||
|
||||
$env:POETRY_HOME="$openpype_root\.poetry"
|
||||
$env:POETRY_VERSION="1.3.2"
|
||||
(Invoke-WebRequest -Uri https://install.python-poetry.org/ -UseBasicParsing).Content | & $($python) -
|
||||
}
|
||||
|
||||
|
||||
function Test-Python() {
|
||||
Write-Color -Text ">>> ", "Detecting host Python ... " -Color Green, Gray -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.9 only
|
||||
if (([int]$matches[1] -lt 3) -or ([int]$matches[2] -lt 9)) {
|
||||
Write-Color -Text "FAILED ", "Version ", "[", $p ,"]", "is old and unsupported" -Color Red, Yellow, Cyan, White, Cyan, Yellow
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
} elseif (([int]$matches[1] -eq 3) -and ([int]$matches[2] -gt 9)) {
|
||||
Write-Color -Text "WARNING Version ", "[", $p, "]", " is unsupported, use at your own risk." -Color Yellow, Cyan, White, Cyan, Yellow
|
||||
Write-Color -Text "*** ", "OpenPype supports only Python 3.9" -Color Yellow, White
|
||||
} else {
|
||||
Write-Color "OK ", "[", $p, "]" -Color Green, Cyan, White, Cyan
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
|
||||
"@
|
||||
if (-not (Test-Path 'env:_INSIDE_OPENPYPE_TOOL')) {
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
}
|
||||
|
||||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Red, Yellow
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
Write-Color -Text ">>> ", "Found OpenPype version ", "[ ", $($openpype_version), " ]" -Color Green, Gray, Cyan, White, Cyan
|
||||
|
||||
Test-Python
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Install-Poetry
|
||||
Write-Color -Text "INSTALLED" -Color Cyan
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
if (-not (Test-Path -PathType Leaf -Path "$($openpype_root)\poetry.lock")) {
|
||||
Write-Color -Text ">>> ", "Installing virtual environment and creating lock." -Color Green, Gray
|
||||
} else {
|
||||
Write-Color -Text ">>> ", "Installing virtual environment from lock." -Color Green, Gray
|
||||
}
|
||||
$startTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
& "$env:POETRY_HOME\bin\poetry" install --no-root $poetry_verbosity --ansi
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Color -Text "!!! ", "Poetry command failed." -Color Red, Yellow
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
Write-Color -Text ">>> ", "Installing pre-commit hooks ..." -Color Green, White
|
||||
& "$env:POETRY_HOME\bin\poetry" run pre-commit install
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Color -Text "!!! ", "Installation of pre-commit hooks failed." -Color Red, Yellow
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
$endTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
Set-Location -Path $current_dir
|
||||
try
|
||||
{
|
||||
New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype", "Virtual environment created.", "All done in $( $endTime - $startTime ) secs."
|
||||
} catch {}
|
||||
Write-Color -Text ">>> ", "Virtual environment created." -Color Green, White
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script will detect Python installation, create venv with Poetry
|
||||
# and install all necessary packages from `poetry.lock` or `pyproject.toml`
|
||||
# needed by OpenPype to be included during application freeze on unix.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
poetry_verbosity=""
|
||||
while :; do
|
||||
case $1 in
|
||||
--verbose)
|
||||
poetry_verbosity="-vvv"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Detect required version of python
|
||||
# Globals:
|
||||
# colors
|
||||
# PYTHON
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
detect_python () {
|
||||
echo -e "${BIGreen}>>>${RST} Using python \c"
|
||||
command -v python >/dev/null 2>&1 || { echo -e "${BIRed}- NOT FOUND${RST} ${BIYellow}You need Python 3.9 installed to continue.${RST}"; return 1; }
|
||||
local version_command="import sys;print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"
|
||||
local python_version="$(python <<< ${version_command})"
|
||||
oIFS="$IFS"
|
||||
IFS=.
|
||||
set -- $python_version
|
||||
IFS="$oIFS"
|
||||
if [ "$1" -ge "3" ] && [ "$2" -ge "9" ] ; then
|
||||
if [ "$2" -gt "9" ] ; then
|
||||
echo -e "${BIWhite}[${RST} ${BIRed}$1.$2 ${BIWhite}]${RST} - ${BIRed}FAILED${RST} ${BIYellow}Version is new and unsupported, use${RST} ${BIPurple}3.9.x${RST}"; return 1;
|
||||
else
|
||||
echo -e "${BIWhite}[${RST} ${BIGreen}$1.$2${RST} ${BIWhite}]${RST}"
|
||||
fi
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo -e "${BIRed}$1.$2$ - ${BIRed}FAILED${RST} ${BIYellow}Version is old and unsupported${RST}"; return 1; }
|
||||
fi
|
||||
}
|
||||
|
||||
install_poetry () {
|
||||
echo -e "${BIGreen}>>>${RST} Installing Poetry ..."
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
export POETRY_VERSION="1.3.2"
|
||||
command -v curl >/dev/null 2>&1 || { echo -e "${BIRed}!!!${RST}${BIYellow} Missing ${RST}${BIBlue}curl${BIYellow} command.${RST}"; return 1; }
|
||||
curl -sSL https://install.python-poetry.org/ | python -
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Clean pyc files in specified directory
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Optional path to clean
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -path ./build -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
main () {
|
||||
# Main
|
||||
if [[ -z $_inside_openpype_tool ]]; then
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
fi
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
install_poetry || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return 1; }
|
||||
fi
|
||||
|
||||
if [ -f "$openpype_root/poetry.lock" ]; then
|
||||
echo -e "${BIGreen}>>>${RST} Updating dependencies ..."
|
||||
else
|
||||
echo -e "${BIGreen}>>>${RST} Installing dependencies ..."
|
||||
fi
|
||||
|
||||
"$POETRY_HOME/bin/poetry" install --no-root $poetry_verbosity || { echo -e "${BIRed}!!!${RST} Poetry environment installation failed"; return 1; }
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo -e "${BIRed}!!!${RST} Virtual environment creation failed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
|
||||
clean_pyc
|
||||
|
||||
# reinstall these because of bug in poetry? or cx_freeze?
|
||||
# cx_freeze will crash on missing __pychache__ on these but
|
||||
# reinstalling them solves the problem.
|
||||
echo -e "${BIGreen}>>>${RST} Post-venv creation fixes ..."
|
||||
local openpype_index=$("$POETRY_HOME/bin/poetry" run python "$openpype_root/tools/parse_pyproject.py" tool.poetry.source.0.url)
|
||||
echo -e "${BIGreen}- ${RST} Using index: ${BIWhite}$openpype_index${RST}"
|
||||
"$POETRY_HOME/bin/poetry" run python -m pip install --disable-pip-version-check --force-reinstall pip
|
||||
echo -e "${BIGreen}>>>${RST} Installing pre-commit hooks ..."
|
||||
"$POETRY_HOME/bin/poetry" run pre-commit install
|
||||
}
|
||||
|
||||
return_code=0
|
||||
main || return_code=$?
|
||||
exit $return_code
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script create distributable OpenPype zip.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation and run OpenPype to create
|
||||
zip. It will create zip from current source code
|
||||
version and copy it top `%LOCALAPPDATA%/pypeclub/openpype` if `--path` or `-p`
|
||||
argument is not used.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\create_zip.ps1
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
To put generated zip to C:\OpenPype directory:
|
||||
PS> .\create_zip.ps1 --path C:\OpenPype
|
||||
|
||||
#>
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
|
||||
function Show-PSWarning() {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||
Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White
|
||||
Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Cleaning cache files ... " -Color Green, Gray -NoNewline
|
||||
Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse| Where-Object {( $_.FullName -inotmatch '\\build\\' ) -and ( $_.FullName -inotmatch '\\.venv' )} | Remove-Item -Force -Recurse
|
||||
Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Where-Object {( $_.FullName -inotmatch '\\build\\' ) -and ( $_.FullName -inotmatch '\\.venv' )} | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "*.pyo" -Force -Recurse | Where-Object {( $_.FullName -inotmatch '\\build\\' ) -and ( $_.FullName -inotmatch '\\.venv' )} | Remove-Item -Force
|
||||
Write-Color -Text "OK" -Color Green
|
||||
|
||||
Write-Color -Text ">>> ", "Generating zip from current sources ..." -Color Green, Gray
|
||||
$env:PYTHONPATH="$($openpype_root);$($env:PYTHONPATH)"
|
||||
$env:OPENPYPE_ROOT="$($openpype_root)"
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\tools\create_zip.py" $ARGS
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Create OpenPype version from live sources."""
|
||||
from igniter import bootstrap_repos
|
||||
import click
|
||||
import enlighten
|
||||
import blessed
|
||||
from pathlib2 import Path
|
||||
|
||||
|
||||
term = blessed.Terminal()
|
||||
manager = enlighten.get_manager()
|
||||
last_increment = 0
|
||||
|
||||
|
||||
@click.group(invoke_without_command=True)
|
||||
@click.option("--path", required=False,
|
||||
help="path where to put version",
|
||||
type=click.Path(exists=True))
|
||||
def main(path):
|
||||
# create zip file
|
||||
|
||||
progress_bar = enlighten.Counter(
|
||||
total=100, desc="OpenPype ZIP", units="%", color="green")
|
||||
|
||||
def progress(inc: int):
|
||||
"""Progress handler."""
|
||||
global last_increment
|
||||
progress_bar.update(incr=inc - last_increment)
|
||||
last_increment = inc
|
||||
|
||||
bs = bootstrap_repos.BootstrapRepos(progress_callback=progress)
|
||||
if path:
|
||||
out_path = Path(path)
|
||||
bs.data_dir = out_path
|
||||
if out_path.is_file():
|
||||
bs.data_dir = out_path.parent
|
||||
|
||||
_print(f"Creating zip in {bs.data_dir} ...")
|
||||
repo_file = bs.create_version_from_live_code()
|
||||
if not repo_file:
|
||||
_print("Error while creating zip file.", 1)
|
||||
exit(1)
|
||||
|
||||
_print(f"Created {repo_file}")
|
||||
|
||||
|
||||
def _print(msg: str, message_type: int = 0) -> None:
|
||||
"""Print message to console.
|
||||
|
||||
Args:
|
||||
msg (str): message to print
|
||||
message_type (int): type of message (0 info, 1 error, 2 note)
|
||||
|
||||
"""
|
||||
if message_type == 0:
|
||||
header = term.aquamarine3(">>> ")
|
||||
elif message_type == 1:
|
||||
header = term.orangered2("!!! ")
|
||||
elif message_type == 2:
|
||||
header = term.tan1("... ")
|
||||
else:
|
||||
header = term.darkolivegreen3("--- ")
|
||||
|
||||
print(f"{header}{msg}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script will detect Python installation and run OpenPype to create
|
||||
# zip. It needs mongodb running. I will create zip from current source code
|
||||
# version and copy it top `~/.local/share/pype` if `--path` or `-p`
|
||||
# argument is not used.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Detect required version of python
|
||||
# Globals:
|
||||
# colors
|
||||
# PYTHON
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
detect_python () {
|
||||
echo -e "${BIGreen}>>>${RST} Using python \c"
|
||||
local version_command="import sys;print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"
|
||||
local python_version="$(python3 <<< ${version_command})"
|
||||
oIFS="$IFS"
|
||||
IFS=.
|
||||
set -- $python_version
|
||||
IFS="$oIFS"
|
||||
if [ "$1" -ge "3" ] && [ "$2" -ge "9" ] ; then
|
||||
if [ "$2" -gt "9" ] ; then
|
||||
echo -e "${BIWhite}[${RST} ${BIRed}$1.$2 ${BIWhite}]${RST} - ${BIRed}FAILED${RST} ${BIYellow}Version is new and unsupported, use${RST} ${BIPurple}3.9.x${RST}"; return 1;
|
||||
else
|
||||
echo -e "${BIWhite}[${RST} ${BIGreen}$1.$2${RST} ${BIWhite}]${RST}"
|
||||
fi
|
||||
else
|
||||
command -v python3 >/dev/null 2>&1 || { echo -e "${BIRed}$1.$2$ - ${BIRed}FAILED${RST} ${BIYellow}Version is old and unsupported${RST}"; return 1; }
|
||||
fi
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
export PYTHONPATH="$openpype_root:$PYTHONPATH"
|
||||
export OPENPYPE_ROOT="$openpype_root"
|
||||
"$POETRY_HOME/bin/poetry" run python3 "$openpype_root/tools/create_zip.py" "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$repo_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($repo_root)\tools\modules\powershell"
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
function Restore-Cwd() {
|
||||
$tmp_current_dir = Get-Location
|
||||
if ("$tmp_current_dir" -ne "$current_dir") {
|
||||
Write-Color -Text ">>> ", "Restoring current directory" -Color Green, Gray
|
||||
Set-Location -Path $current_dir
|
||||
}
|
||||
}
|
||||
|
||||
function Get-Container {
|
||||
if (-not (Test-Path -PathType Leaf -Path "$($repo_root)\build\docker-image.id")) {
|
||||
Write-Color -Text "!!! ", "Docker command failed, cannot find image id." -Color Red, Yellow
|
||||
Restore-Cwd
|
||||
Exit-WithCode 1
|
||||
}
|
||||
$id = Get-Content "$($repo_root)\build\docker-image.id"
|
||||
Write-Color -Text ">>> ", "Creating container from image id ", "[", $id, "]" -Color Green, Gray, White, Cyan, White
|
||||
$cid = docker create $id bash
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Color -Text "!!! ", "Cannot create container." -Color Red, Yellow
|
||||
Restore-Cwd
|
||||
Exit-WithCode 1
|
||||
}
|
||||
return $cid
|
||||
}
|
||||
|
||||
function Change-Cwd() {
|
||||
Set-Location -Path $repo_root
|
||||
}
|
||||
|
||||
function New-DockerBuild {
|
||||
$version_file = Get-Content -Path "$($repo_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
$startTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
Write-Color -Text ">>> ", "Building OpenPype using Docker ..." -Color Green, Gray, White
|
||||
$variant = $args[0]
|
||||
if ($variant.Length -eq 0) {
|
||||
$dockerfile = "$($repo_root)\Dockerfile"
|
||||
} else {
|
||||
$dockerfile = "$( $repo_root )\Dockerfile.$variant"
|
||||
}
|
||||
if (-not (Test-Path -PathType Leaf -Path $dockerfile)) {
|
||||
Write-Color -Text "!!! ", "Dockerfile for specifed platform ", "[", $variant, "]", "doesn't exist." -Color Red, Yellow, Cyan, White, Cyan, Yellow
|
||||
Restore-Cwd
|
||||
Exit-WithCode 1
|
||||
}
|
||||
Write-Color -Text ">>> ", "Using Dockerfile for ", "[ ", $variant, " ]" -Color Green, Gray, White, Cyan, White
|
||||
|
||||
$build_dir = "$($repo_root)\build"
|
||||
if (-not(Test-Path $build_dir)) {
|
||||
New-Item -ItemType Directory -Path $build_dir
|
||||
}
|
||||
Write-Color -Text "--- ", "Cleaning build directory ..." -Color Yellow, Gray
|
||||
try {
|
||||
Remove-Item -Recurse -Force "$($build_dir)\*"
|
||||
} catch {
|
||||
Write-Color -Text "!!! ", "Cannot clean build directory, possibly because process is using it." -Color Red, Gray
|
||||
Write-Color -Text $_.Exception.Message -Color Red
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Running Docker build ..." -Color Green, Gray, White
|
||||
docker build --pull --iidfile $repo_root/build/docker-image.id --build-arg BUILD_DATE=$(Get-Date -UFormat %Y-%m-%dT%H:%M:%SZ) --build-arg VERSION=$openpype_version -t pypeclub/openpype:$openpype_version -f $dockerfile .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Color -Text "!!! ", "Docker command failed.", $LASTEXITCODE -Color Red, Yellow, Red
|
||||
Restore-Cwd
|
||||
Exit-WithCode 1
|
||||
}
|
||||
Write-Color -Text ">>> ", "Copying build from container ..." -Color Green, Gray, White
|
||||
$cid = Get-Container
|
||||
|
||||
docker cp "$($cid):/opt/openpype/build/exe.linux-x86_64-3.9" "$($repo_root)/build"
|
||||
docker cp "$($cid):/opt/openpype/build/build.log" "$($repo_root)/build"
|
||||
|
||||
$endTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
try {
|
||||
New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype build complete!", "All done in $( $endTime - $startTime ) secs. You will find OpenPype and build log in build directory."
|
||||
} catch {}
|
||||
Write-Color -Text "*** ", "All done in ", $($endTime - $startTime), " secs. You will find OpenPype and build log in ", "'.\build'", " directory." -Color Green, Gray, White, Gray, White, Gray
|
||||
}
|
||||
|
||||
Change-Cwd
|
||||
New-DockerBuild $ARGS
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIRed='\033[1;91m' # Red
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
create_container () {
|
||||
if [ ! -f "$openpype_root/build/docker-image.id" ]; then
|
||||
echo -e "${BIRed}!!!${RST} Docker command failed, cannot find image id."
|
||||
exit 1
|
||||
fi
|
||||
local id=$(<"$openpype_root/build/docker-image.id")
|
||||
echo -e "${BIYellow}---${RST} Creating container from $id ..."
|
||||
cid="$(docker create $id bash)"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo -e "${BIRed}!!!${RST} Cannot create container."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
retrieve_build_log () {
|
||||
create_container
|
||||
echo -e "${BIYellow}***${RST} Copying build log to ${BIWhite}$openpype_root/build/build.log${RST}"
|
||||
docker cp "$cid:/opt/openpype/build/build.log" "$openpype_root/build"
|
||||
}
|
||||
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
|
||||
if [ -z $1 ]; then
|
||||
dockerfile="Dockerfile"
|
||||
else
|
||||
dockerfile="Dockerfile.$1"
|
||||
if [ ! -f "$openpype_root/$dockerfile" ]; then
|
||||
echo -e "${BIRed}!!!${RST} Dockerfile for specifed platform ${BIWhite}$1${RST} doesn't exist."
|
||||
exit 1
|
||||
else
|
||||
echo -e "${BIGreen}>>>${RST} Using Dockerfile for ${BIWhite}$1${RST} ..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Main
|
||||
main () {
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIYellow}---${RST} Cleaning build directory ..."
|
||||
rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null
|
||||
|
||||
local version_command="import os;exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read());print(__version__);"
|
||||
local openpype_version="$(python3 <<< ${version_command})"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running docker build ..."
|
||||
# docker build --pull --no-cache -t pypeclub/openpype:$openpype_version .
|
||||
docker build --pull --iidfile $openpype_root/build/docker-image.id --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$openpype_version -t pypeclub/openpype:$openpype_version -f $dockerfile .
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo $?
|
||||
echo -e "${BIRed}!!!${RST} Docker build failed."
|
||||
retrieve_build_log
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Copying build from container ..."
|
||||
create_container
|
||||
echo -e "${BIYellow}---${RST} Copying ..."
|
||||
docker cp "$cid:/opt/openpype/build/exe.linux-x86_64-3.9" "$openpype_root/build"
|
||||
docker cp "$cid:/opt/openpype/build/build.log" "$openpype_root/build"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo -e "${BIRed}!!!${RST} Copying failed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Fixing user ownership ..."
|
||||
local username="$(logname)"
|
||||
chown -R $username ./build
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} All done, you can delete container:"
|
||||
echo -e "${BIYellow}$cid${RST}"
|
||||
}
|
||||
|
||||
return_code=0
|
||||
main || return_code=$?
|
||||
exit $return_code
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Download and extract third-party dependencies for OpenPype.
|
||||
|
||||
.DESCRIPTION
|
||||
This will download third-party dependencies specified in pyproject.toml
|
||||
and extract them to vendor/bin folder.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\fetch_thirdparty_libs.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
$startTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\tools\fetch_thirdparty_libs.py"
|
||||
$endTime = [int][double]::Parse((Get-Date -UFormat %s))
|
||||
Set-Location -Path $current_dir
|
||||
try
|
||||
{
|
||||
New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype", "Dependencies downloaded", "All done in $( $endTime - $startTime ) secs."
|
||||
} catch {}
|
||||
|
|
@ -1,244 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Fetch, verify and process third-party dependencies of OpenPype.
|
||||
|
||||
Those should be defined in `pyproject.toml` in OpenPype sources root.
|
||||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import toml
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
import requests
|
||||
import enlighten
|
||||
import platform
|
||||
import blessed
|
||||
import tempfile
|
||||
import math
|
||||
import hashlib
|
||||
import tarfile
|
||||
import zipfile
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
|
||||
term = blessed.Terminal()
|
||||
manager = enlighten.get_manager()
|
||||
hash_buffer_size = 65536
|
||||
|
||||
|
||||
def sha256_sum(filename: Path):
|
||||
"""Calculate sha256 hash for given file.
|
||||
|
||||
Args:
|
||||
filename (Path): path to file.
|
||||
|
||||
Returns:
|
||||
str: hex hash.
|
||||
|
||||
"""
|
||||
_hash = hashlib.sha256()
|
||||
with open(filename, 'rb', buffering=0) as f:
|
||||
buffer = bytearray(128 * 1024)
|
||||
mv = memoryview(buffer)
|
||||
for n in iter(lambda: f.readinto(mv), 0):
|
||||
_hash.update(mv[:n])
|
||||
return _hash.hexdigest()
|
||||
|
||||
|
||||
def _print(msg: str, message_type: int = 0) -> None:
|
||||
"""Print message to console.
|
||||
|
||||
Args:
|
||||
msg (str): message to print
|
||||
message_type (int): type of message (0 info, 1 error, 2 note)
|
||||
|
||||
"""
|
||||
if message_type == 0:
|
||||
header = term.aquamarine3(">>> ")
|
||||
elif message_type == 1:
|
||||
header = term.orangered2("!!! ")
|
||||
elif message_type == 2:
|
||||
header = term.tan1("... ")
|
||||
else:
|
||||
header = term.darkolivegreen3("--- ")
|
||||
|
||||
print(f"{header}{msg}")
|
||||
|
||||
|
||||
def _pip_install(openpype_root, package, version=None):
|
||||
arg = None
|
||||
if package and version:
|
||||
arg = f"{package}=={version}"
|
||||
elif package:
|
||||
arg = package
|
||||
|
||||
if not arg:
|
||||
_print("Couldn't find package to install")
|
||||
sys.exit(1)
|
||||
|
||||
_print(f"We'll install {arg}")
|
||||
|
||||
python_vendor_dir = openpype_root / "vendor" / "python"
|
||||
try:
|
||||
subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-m", "pip", "install", "--upgrade", arg,
|
||||
"-t", str(python_vendor_dir)
|
||||
],
|
||||
check=True,
|
||||
stdout=subprocess.DEVNULL
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
_print(f"Error during {package} installation.", 1)
|
||||
_print(str(e), 1)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def install_qtbinding(pyproject, openpype_root, platform_name):
|
||||
_print("Handling Qt binding framework ...")
|
||||
qtbinding_def = pyproject["openpype"]["qtbinding"][platform_name]
|
||||
package = qtbinding_def["package"]
|
||||
version = qtbinding_def.get("version")
|
||||
_pip_install(openpype_root, package, version)
|
||||
|
||||
python_vendor_dir = openpype_root / "vendor" / "python"
|
||||
|
||||
# Remove libraries for QtSql which don't have available libraries
|
||||
# by default and Postgre library would require to modify rpath of
|
||||
# dependency
|
||||
if platform_name == "darwin":
|
||||
sqldrivers_dir = (
|
||||
python_vendor_dir / package / "Qt" / "plugins" / "sqldrivers"
|
||||
)
|
||||
for filepath in sqldrivers_dir.iterdir():
|
||||
os.remove(str(filepath))
|
||||
|
||||
|
||||
def install_runtime_dependencies(pyproject, openpype_root):
|
||||
_print("Installing Runtime Dependencies ...")
|
||||
runtime_deps = pyproject["openpype"]["runtime-deps"]
|
||||
for package, version in runtime_deps.items():
|
||||
_pip_install(openpype_root, package, version)
|
||||
|
||||
|
||||
def install_thirdparty(pyproject, openpype_root, platform_name):
|
||||
_print("Processing third-party dependencies ...")
|
||||
try:
|
||||
thirdparty = pyproject["openpype"]["thirdparty"]
|
||||
except AttributeError:
|
||||
_print("No third-party libraries specified in pyproject.toml", 1)
|
||||
sys.exit(1)
|
||||
|
||||
for k, v in thirdparty.items():
|
||||
_print(f"processing {k}")
|
||||
destination_path = openpype_root / "vendor" / "bin" / k
|
||||
|
||||
if not v.get(platform_name):
|
||||
_print(("missing definition for current "
|
||||
f"platform [ {platform_name} ]"), 2)
|
||||
_print("trying to get universal url for all platforms")
|
||||
url = v.get("url")
|
||||
if not url:
|
||||
_print("cannot get url for all platforms", 1)
|
||||
_print((f"Warning: {k} is not installed for current platform "
|
||||
"and it might be missing in the build"), 1)
|
||||
continue
|
||||
else:
|
||||
url = v.get(platform_name).get("url")
|
||||
destination_path = destination_path / platform_name
|
||||
|
||||
parsed_url = urlparse(url)
|
||||
|
||||
# check if file is already extracted in /vendor/bin
|
||||
if destination_path.exists():
|
||||
_print("destination path already exists, deleting ...", 2)
|
||||
if destination_path.is_dir():
|
||||
try:
|
||||
shutil.rmtree(destination_path)
|
||||
except OSError as e:
|
||||
_print("cannot delete folder.", 1)
|
||||
raise SystemExit(e)
|
||||
|
||||
# download file
|
||||
_print(f"Downloading {url} ...")
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_file = Path(temp_dir) / Path(parsed_url.path).name
|
||||
|
||||
r = requests.get(url, stream=True)
|
||||
content_len = int(r.headers.get('Content-Length', '0')) or None
|
||||
with manager.counter(
|
||||
color='green',
|
||||
total=content_len and math.ceil(content_len / 2 ** 20),
|
||||
unit='MiB',
|
||||
leave=False
|
||||
) as counter:
|
||||
with open(temp_file, 'wb', buffering=2 ** 24) as file_handle:
|
||||
for chunk in r.iter_content(chunk_size=2 ** 20):
|
||||
file_handle.write(chunk)
|
||||
counter.update()
|
||||
|
||||
# get file with checksum
|
||||
_print("Calculating sha256 ...", 2)
|
||||
calc_checksum = sha256_sum(temp_file)
|
||||
|
||||
if v.get(platform_name):
|
||||
item_hash = v.get(platform_name).get("hash")
|
||||
else:
|
||||
item_hash = v.get("hash")
|
||||
|
||||
if item_hash != calc_checksum:
|
||||
_print("Downloaded files checksum invalid.")
|
||||
sys.exit(1)
|
||||
|
||||
_print("File OK", 3)
|
||||
if not destination_path.exists():
|
||||
destination_path.mkdir(parents=True)
|
||||
|
||||
# extract to destination
|
||||
archive_type = temp_file.suffix.lstrip(".")
|
||||
_print(f"Extracting {archive_type} file to {destination_path}")
|
||||
if archive_type in ['zip']:
|
||||
zip_file = zipfile.ZipFile(temp_file)
|
||||
zip_file.extractall(destination_path)
|
||||
zip_file.close()
|
||||
|
||||
elif archive_type in [
|
||||
'tar', 'tgz', 'tar.gz', 'tar.xz', 'tar.bz2'
|
||||
]:
|
||||
if archive_type == 'tar':
|
||||
tar_type = 'r:'
|
||||
elif archive_type.endswith('xz'):
|
||||
tar_type = 'r:xz'
|
||||
elif archive_type.endswith('gz'):
|
||||
tar_type = 'r:gz'
|
||||
elif archive_type.endswith('bz2'):
|
||||
tar_type = 'r:bz2'
|
||||
else:
|
||||
tar_type = 'r:*'
|
||||
try:
|
||||
tar_file = tarfile.open(temp_file, tar_type)
|
||||
except tarfile.ReadError:
|
||||
raise SystemExit("corrupted archive")
|
||||
tar_file.extractall(destination_path)
|
||||
tar_file.close()
|
||||
_print("Extraction OK", 3)
|
||||
|
||||
|
||||
def main():
|
||||
start_time = time.time_ns()
|
||||
openpype_root = Path(os.path.dirname(__file__)).parent
|
||||
pyproject = toml.load(openpype_root / "pyproject.toml")
|
||||
platform_name = platform.system().lower()
|
||||
install_qtbinding(pyproject, openpype_root, platform_name)
|
||||
install_runtime_dependencies(pyproject, openpype_root)
|
||||
install_thirdparty(pyproject, openpype_root, platform_name)
|
||||
end_time = time.time_ns()
|
||||
total_time = (end_time - start_time) / 1000000000
|
||||
_print(f"Downloading and extracting took {total_time} secs.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running Pype tool ..."
|
||||
"$POETRY_HOME/bin/poetry" run python "$openpype_root/tools/fetch_thirdparty_libs.py"
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Get version and license information on used Python packages.
|
||||
|
||||
This is getting over all packages installed with Poetry and printing out
|
||||
their name, version and available license information from PyPi in Markdown
|
||||
table format.
|
||||
|
||||
Usage:
|
||||
./.poetry/bin/poetry run python ./tools/get_python_packages_info.py
|
||||
|
||||
"""
|
||||
|
||||
import toml
|
||||
import requests
|
||||
|
||||
|
||||
packages = []
|
||||
|
||||
# define column headers
|
||||
package_header = "Package"
|
||||
version_header = "Version"
|
||||
license_header = "License"
|
||||
|
||||
name_col_width = len(package_header)
|
||||
version_col_width = len(version_header)
|
||||
license_col_width = len(license_header)
|
||||
|
||||
# read lock file to get packages
|
||||
with open("poetry.lock", "r") as fb:
|
||||
lock_content = toml.load(fb)
|
||||
|
||||
for package in lock_content["package"]:
|
||||
# query pypi for license information
|
||||
url = f"https://pypi.org/pypi/{package['name']}/json"
|
||||
response = requests.get(
|
||||
f"https://pypi.org/pypi/{package['name']}/json")
|
||||
package_data = response.json()
|
||||
version = package.get("version") or "N/A"
|
||||
try:
|
||||
package_license = package_data["info"].get("license") or "N/A"
|
||||
except KeyError:
|
||||
package_license = "N/A"
|
||||
|
||||
if len(package_license) > 64:
|
||||
package_license = f"{package_license[:32]}..."
|
||||
packages.append(
|
||||
(
|
||||
package["name"],
|
||||
version,
|
||||
package_license
|
||||
)
|
||||
)
|
||||
|
||||
# update column width based on max string length
|
||||
if len(package["name"]) > name_col_width:
|
||||
name_col_width = len(package["name"])
|
||||
if len(version) > version_col_width:
|
||||
version_col_width = len(version)
|
||||
if len(package_license) > license_col_width:
|
||||
license_col_width = len(package_license)
|
||||
|
||||
# pad columns
|
||||
name_col_width += 2
|
||||
version_col_width += 2
|
||||
license_col_width += 2
|
||||
|
||||
# print table header
|
||||
print((f"|{package_header.center(name_col_width)}"
|
||||
f"|{version_header.center(version_col_width)}"
|
||||
f"|{license_header.center(license_col_width)}|"))
|
||||
|
||||
print(
|
||||
"|" + ("-" * len(package_header.center(name_col_width))) +
|
||||
"|" + ("-" * len(version_header.center(version_col_width))) +
|
||||
"|" + ("-" * len(license_header.center(license_col_width))) + "|")
|
||||
|
||||
# print rest of the table
|
||||
for package in packages:
|
||||
print((
|
||||
f"|{package[0].center(name_col_width)}"
|
||||
f"|{package[1].center(version_col_width)}"
|
||||
f"|{package[2].center(license_col_width)}|"
|
||||
))
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to update OpenPype Sphinx sources.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will run apidoc over OpenPype sources and generate new source rst
|
||||
files for documentation. Then it will run build_sphinx to create test html
|
||||
documentation build.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\make_docs.ps1
|
||||
|
||||
#>
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Install-Poetry
|
||||
Write-Color -Text "INSTALLED" -Color Cyan
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
Write-Color -Text "... ", "This will not overwrite existing source rst files, only scan and add new." -Color Yellow, Gray
|
||||
Set-Location -Path $openpype_root
|
||||
Write-Color -Text ">>> ", "Running apidoc ..." -Color Green, Gray
|
||||
& "$env:POETRY_HOME\bin\poetry" run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" igniter
|
||||
& "$env:POETRY_HOME\bin\poetry" run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" openpype vendor, openpype\vendor
|
||||
|
||||
Write-Color -Text ">>> ", "Building html ..." -Color Green, Gray
|
||||
& "$env:POETRY_HOME\bin\poetry" run python "$($openpype_root)\setup.py" build_sphinx
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script will run apidoc over OpenPype sources and generate new source rst
|
||||
# files for documentation. Then it will run build_sphinx to create test html
|
||||
# documentation build.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running apidoc ..."
|
||||
"$POETRY_HOME/bin/poetry" run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" igniter
|
||||
"$POETRY_HOME/bin/poetry" run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" openpype vendor, openpype\vendor
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building html ..."
|
||||
"$POETRY_HOME/bin/poetry" run python3 "$openpype_root/setup.py" build_sphinx
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f58c9a26d6ede30ecc7998e92b26974887e945fe
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 12eda384ebd7a7954e15855e312215c009c97114
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
goto comment
|
||||
SYNOPSIS
|
||||
Helper script running scripts through the OpenPype environment.
|
||||
|
||||
DESCRIPTION
|
||||
This script is usually used as a replacement for building when tested farm integration like Deadline.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
cmd> .\openpype_console.bat path/to/python_script.py
|
||||
:comment
|
||||
|
||||
cd "%~dp0\.."
|
||||
echo %OPENPYPE_MONGO%
|
||||
.poetry\bin\poetry.exe run python start.py %*
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script OpenPype Packing project.
|
||||
|
||||
.DESCRIPTION
|
||||
Once you are happy with the project and want to preserve it for future work, just change the project name on line 38 and copy the file into .\OpenPype\tools. Then use the cmd form .EXAMPLE
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\tools\run_pack_project.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor Green
|
||||
Write-Host "Reading Poetry ... " -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Host "NOT FOUND" -ForegroundColor Yellow
|
||||
Write-Host "*** " -NoNewline -ForegroundColor Yellow
|
||||
Write-Host "We need to install Poetry create virtual env first ..."
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\start.py" pack-project --project $ARGS
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Parse pyproject.toml and return its values.
|
||||
|
||||
Useful for shell scripts to know more about OpenPype build.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import toml
|
||||
from pathlib import Path
|
||||
import click
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("keys", nargs=-1, type=click.STRING)
|
||||
def main(keys):
|
||||
"""Get values from `pyproject.toml`.
|
||||
|
||||
You can specify dot separated keys from `pyproject.toml`
|
||||
as arguments and this script will return them on separate
|
||||
lines. If key doesn't exists, None is returned.
|
||||
|
||||
"""
|
||||
openpype_root = Path(os.path.dirname(__file__)).parent
|
||||
py_project = toml.load(openpype_root / "pyproject.toml")
|
||||
for q in keys:
|
||||
query = q.split(".")
|
||||
data = py_project
|
||||
|
||||
for k in query:
|
||||
if isinstance(data, list):
|
||||
try:
|
||||
data = data[int(k)]
|
||||
except IndexError:
|
||||
print("None")
|
||||
sys.exit()
|
||||
continue
|
||||
|
||||
if isinstance(data, dict):
|
||||
data = data.get(k)
|
||||
print(data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to run Docusaurus for easy editing of OpenPype documentation.
|
||||
|
||||
.DESCRIPTION
|
||||
This script is using `yarn` package manager to run Docusaurus. If you don't
|
||||
have `yarn`, install Node.js (https://nodejs.org/) and then run:
|
||||
|
||||
npm install -g yarn
|
||||
|
||||
It take some time to run this script. If all is successful you should see
|
||||
new browser window with OpenPype documentation. All changes is markdown files
|
||||
under .\website should be immediately seen in browser.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_documentation.ps1
|
||||
|
||||
#>
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location $openpype_root/website
|
||||
|
||||
& yarn install
|
||||
& yarn start
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to run mongodb.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect mongodb, add it to the PATH and launch it on specified port and db location.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_mongo.ps1
|
||||
|
||||
#>
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
|
||||
function Find-Mongo ($preferred_version) {
|
||||
$defaultPath = "C:\Program Files\MongoDB\Server"
|
||||
Write-Color -Text ">>> ", "Detecting MongoDB ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Get-Command "mongod" -ErrorAction SilentlyContinue)) {
|
||||
if(Test-Path "$($defaultPath)\*\bin\mongod.exe" -PathType Leaf) {
|
||||
# we have mongo server installed on standard Windows location
|
||||
# so we can inject it to the PATH. We'll use latest version available, or the one defined by
|
||||
# $preferred_version.
|
||||
$mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]}
|
||||
if(Test-Path "$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
$use_version = $mongoVersions[-1]
|
||||
foreach ($v in $mongoVersions) {
|
||||
Write-Color -Text " - found [ ", $v, " ]" -Color Cyan, White, Cyan -NoNewLine
|
||||
$version = Split-Path $v -Leaf
|
||||
|
||||
if ($preferred_version -eq $version) {
|
||||
Write-Color -Text " *" -Color Green
|
||||
$use_version = $v
|
||||
} else {
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
|
||||
$env:PATH = "$($env:PATH);$($use_version)\bin\"
|
||||
|
||||
Write-Color -Text " - auto-added from [ ", "$($use_version)\bin\mongod.exe", " ]" -Color Cyan, White, Cyan
|
||||
return "$($use_version)\bin\mongod.exe"
|
||||
} else {
|
||||
Write-Color -Text "FAILED " -Color Red -NoNewLine
|
||||
Write-Color -Text "MongoDB not detected" -Color Yellow
|
||||
Write-Color -Text "Tried to find it on standard location ", "[ ", "$($mongoVersions[-1])\bin\mongod.exe", " ]", " but failed." -Color Gray, Cyan, White, Cyan, Gray -NoNewline
|
||||
Exit-WithCode 1
|
||||
}
|
||||
} else {
|
||||
Write-Color -Text "FAILED ", "MongoDB not detected in PATH" -Color Red, Yellow
|
||||
Exit-WithCode 1
|
||||
}
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
return Get-Command "mongod" -ErrorAction SilentlyContinue
|
||||
}
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Function to detect mongod in path.
|
||||
.DESCRIPTION
|
||||
This will test presence of mongod in PATH. If it's not there, it will try
|
||||
to find it in default install location. It support different mongo versions
|
||||
(using latest if found). When mongod is found, path to it is added to PATH
|
||||
#>
|
||||
}
|
||||
|
||||
# mongodb port
|
||||
$port = 2707
|
||||
|
||||
# path to database
|
||||
$dbpath = (Get-Item $openpype_root).parent.FullName + "\mongo_db_data"
|
||||
|
||||
$preferred_version = "5.0"
|
||||
|
||||
$mongoPath = Find-Mongo $preferred_version
|
||||
Write-Color -Text ">>> ", "Using DB path: ", "[ ", "$($dbpath)", " ]" -Color Green, Gray, Cyan, White, Cyan
|
||||
Write-Color -Text ">>> ", "Port: ", "[ ", "$($port)", " ]" -Color Green, Gray, Cyan, White, Cyan
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $($dbpath)
|
||||
|
||||
Start-Process -FilePath $mongopath "--dbpath $($dbpath) --port $($port)" -PassThru | Out-Null
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Helper script to run mongod in the backround.
|
||||
# NOTE: we are expecting mongod is in PATH
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
openpype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
mongo_port=2707
|
||||
dbpath="$(dirname $openpype_root)/mongo_db_data"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running mongodb ..."
|
||||
mongod --dbpath "$dbpath" --port $mongo_port
|
||||
echo -e "${BIGreen}>>>${RST} Detached to background."
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to run Project Manager.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_project_manager.ps1
|
||||
|
||||
#>
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Install-Poetry
|
||||
Write-Color -Text "INSTALLED" -Color Cyan
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
& "$env:POETRY_HOME\bin\poetry" run python "$($openpype_root)\start.py" projectmanager
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run OpenPype Settings GUI
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
"$POETRY_HOME/bin/poetry" run python "$openpype_root/start.py" projectmanager
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script OpenPype Tray.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_tray.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\start.py" publish-report-viewer --debug
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to OpenPype Settings UI
|
||||
|
||||
.DESCRIPTION
|
||||
This script will run OpenPype and open Settings UI.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_settings.ps1
|
||||
|
||||
#>
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Install-Poetry
|
||||
Write-Color -Text "INSTALLED" -Color Cyan
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
& "$env:POETRY_HOME\bin\poetry" run python "$($openpype_root)\start.py" settings --dev
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run OpenPype Settings GUI
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
"$POETRY_HOME/bin/poetry" run python3 "$openpype_root/start.py" settings --dev
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to run tests for OpenPype.
|
||||
|
||||
.DESCRIPTION
|
||||
This will use virtual environment and pytest to run test for OpenPype.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_test.ps1
|
||||
|
||||
#>
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
function Show-PSWarning() {
|
||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
||||
Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White
|
||||
Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White
|
||||
Exit-WithCode 1
|
||||
}
|
||||
}
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~. .. ~2p. .. .... . .
|
||||
.Ppo . .pPO3Op.. . O:. . . .
|
||||
.3Pp . oP3'. 'P33. . 4 .. . . . .. . . .
|
||||
.~OP 3PO. .Op3 : . .. _____ _____ _____
|
||||
.P3O . oP3oP3O3P' . . . . / /./ /./ /
|
||||
O3:. O3p~ . .:. . ./____/./____/ /____/
|
||||
'P . 3p3. oP3~. ..P:. . . .. . . .. . . .
|
||||
. ': . Po' .Opo'. .3O. . o[ by Pype Club ]]]==- - - . .
|
||||
. '_ .. . . _OP3.. . .https://openpype.io.. .
|
||||
~P3.OPPPO3OP~ . .. .
|
||||
. ' '. . .. . . . .. .
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "OpenPype [ ", $openpype_version, " ]" -Color Green, White, Cyan, White
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
Write-Color -Text ">>> ", "Cleaning cache files ... " -Color Green, Gray -NoNewline
|
||||
Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "*.pyo" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Where-Object { $_.FullName -inotmatch 'build' } | Remove-Item -Force -Recurse
|
||||
Write-Color -Text "OK" -Color green
|
||||
|
||||
Write-Color -Text ">>> ", "Testing OpenPype ..." -Color Green, White
|
||||
$original_pythonpath = $env:PYTHONPATH
|
||||
$env:PYTHONPATH="$($openpype_root);$($env:PYTHONPATH)"
|
||||
& "$env:POETRY_HOME\bin\poetry" run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($openpype_root)/tests"
|
||||
$env:PYTHONPATH = $original_pythonpath
|
||||
|
||||
Write-Color -Text ">>> ", "Restoring current directory" -Color Green, Gray
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run tests for OpenPype
|
||||
# This will use virtual environment and pytest to run test for OpenPype.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
##############################################################################
|
||||
# Clean pyc files in specified directory
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Optional path to clean
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -path ./build -prune -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Testing OpenPype ..."
|
||||
original_pythonpath=$PYTHONPATH
|
||||
export PYTHONPATH="$openpype_root:$PYTHONPATH"
|
||||
"$POETRY_HOME/bin/poetry" run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$openpype_root/tests"
|
||||
PYTHONPATH=$original_pythonpath
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script OpenPype Tray.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_tray.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# Install PSWriteColor to support colorized output to terminal
|
||||
$env:PSModulePath = $env:PSModulePath + ";$($openpype_root)\tools\modules\powershell"
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Color -Text ">>> ", "Reading Poetry ... " -Color Green, Gray -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Color -Text "NOT FOUND" -Color Yellow
|
||||
Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Color -Text "OK" -Color Green
|
||||
}
|
||||
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\start.py" tray --debug
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Run OpenPype Tray
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
main () {
|
||||
# Directories
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
_inside_openpype_tool="1"
|
||||
|
||||
if [[ -z $POETRY_HOME ]]; then
|
||||
export POETRY_HOME="$openpype_root/.poetry"
|
||||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$POETRY_HOME/bin/poetry" ]; then
|
||||
echo -e "${BIGreen}OK${RST}"
|
||||
else
|
||||
echo -e "${BIYellow}NOT FOUND${RST}"
|
||||
echo -e "${BIYellow}***${RST} We need to install Poetry and virtual env ..."
|
||||
. "$openpype_root/tools/create_env.sh" || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running OpenPype Tray with debug option ..."
|
||||
"$POETRY_HOME/bin/poetry" run python3 "$openpype_root/start.py" tray --debug
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script OpenPype Unpacking project.
|
||||
|
||||
.DESCRIPTION
|
||||
Make sure you had dropped the project from your db and removed the poject data in case you were having them previously. Then on line 38 change the <Path to zip> to any path where the zip with project is - usually we are having it here https://drive.google.com/drive/u/0/folders/0AKE4mxImOsAGUk9PVA . Copy the file into .\OpenPype\tools. Then use the cmd form .EXAMPLE
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\tools\run_unpack_project.ps1
|
||||
|
||||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
$env:_INSIDE_OPENPYPE_TOOL = "1"
|
||||
|
||||
# make sure Poetry is in PATH
|
||||
if (-not (Test-Path 'env:POETRY_HOME')) {
|
||||
$env:POETRY_HOME = "$openpype_root\.poetry"
|
||||
}
|
||||
$env:PATH = "$($env:PATH);$($env:POETRY_HOME)\bin"
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor Green
|
||||
Write-Host "Reading Poetry ... " -NoNewline
|
||||
if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) {
|
||||
Write-Host "NOT FOUND" -ForegroundColor Yellow
|
||||
Write-Host "*** " -NoNewline -ForegroundColor Yellow
|
||||
Write-Host "We need to install Poetry create virtual env first ..."
|
||||
& "$openpype_root\tools\create_env.ps1"
|
||||
} else {
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
& "$($env:POETRY_HOME)\bin\poetry" run python "$($openpype_root)\start.py" unpack-project --zipfile $ARGS
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to update submodules.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\update_submodules.ps1
|
||||
|
||||
#>
|
||||
|
||||
$art = @"
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
function Exit-WithCode($exitcode) {
|
||||
# Only exit this host process if it's a child of another PowerShell parent process...
|
||||
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
|
||||
$parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name
|
||||
if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) }
|
||||
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
git submodule update --recursive --remote
|
||||
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run OpenPype Tray
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
|
||||
. . .. . ..
|
||||
_oOOP3OPP3Op_. .
|
||||
.PPpo~· ·· ~2p. ·· ···· · ·
|
||||
·Ppo · .pPO3Op.· · O:· · · ·
|
||||
.3Pp · oP3'· 'P33· · 4 ·· · · · ·· · · ·
|
||||
·~OP 3PO· .Op3 : · ·· _____ _____ _____
|
||||
·P3O · oP3oP3O3P' · · · · / /·/ /·/ /
|
||||
O3:· O3p~ · ·:· · ·/____/·/____/ /____/
|
||||
'P · 3p3· oP3~· ·.P:· · · ·· · · ·· · · ·
|
||||
· ': · Po' ·Opo'· .3O· . o[ by Pype Club ]]]==- - - · ·
|
||||
· '_ .. · . _OP3·· · ·https://openpype.io·· ·
|
||||
~P3·OPPPO3OP~ · ·· ·
|
||||
· ' '· · ·· · · · ·· ·
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Colors for terminal
|
||||
|
||||
RST='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
Black='\033[0;30m' # Black
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
Yellow='\033[0;33m' # Yellow
|
||||
Blue='\033[0;34m' # Blue
|
||||
Purple='\033[0;35m' # Purple
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
# Bold
|
||||
BBlack='\033[1;30m' # Black
|
||||
BRed='\033[1;31m' # Red
|
||||
BGreen='\033[1;32m' # Green
|
||||
BYellow='\033[1;33m' # Yellow
|
||||
BBlue='\033[1;34m' # Blue
|
||||
BPurple='\033[1;35m' # Purple
|
||||
BCyan='\033[1;36m' # Cyan
|
||||
BWhite='\033[1;37m' # White
|
||||
|
||||
# Bold High Intensity
|
||||
BIBlack='\033[1;90m' # Black
|
||||
BIRed='\033[1;91m' # Red
|
||||
BIGreen='\033[1;92m' # Green
|
||||
BIYellow='\033[1;93m' # Yellow
|
||||
BIBlue='\033[1;94m' # Blue
|
||||
BIPurple='\033[1;95m' # Purple
|
||||
BICyan='\033[1;96m' # Cyan
|
||||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
git submodule update --recursive --remote
|
||||
Loading…
Add table
Add a link
Reference in a new issue