mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
cosmetic fixes in shell scripts
This commit is contained in:
parent
dac617c515
commit
be860f92df
10 changed files with 129 additions and 152 deletions
|
|
@ -63,11 +63,13 @@ BIWhite='\033[1;97m' # White
|
|||
###############################################################################
|
||||
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})"
|
||||
local version_command
|
||||
version_command="import sys;print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"
|
||||
local python_version
|
||||
python_version="$(python3 <<< ${version_command})"
|
||||
oIFS="$IFS"
|
||||
IFS=.
|
||||
set -- $python_version
|
||||
set -- "$python_version"
|
||||
IFS="$oIFS"
|
||||
if [ "$1" -ge "3" ] && [ "$2" -ge "6" ] ; then
|
||||
if [ "$2" -gt "7" ] ; then
|
||||
|
|
@ -75,7 +77,6 @@ detect_python () {
|
|||
else
|
||||
echo -e "${BIWhite}[${RST} ${BIGreen}$1.$2${RST} ${BIWhite}]${RST}"
|
||||
fi
|
||||
PYTHON="python3"
|
||||
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
|
||||
|
|
@ -91,7 +92,8 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -111,27 +113,31 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})"))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})"))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
version_command="import os;exec(open(os.path.join('$pype_root', 'pype', 'version.py')).read());print(__version__);"
|
||||
pype_version="$(python3 <<< ${version_command})"
|
||||
version_command="import os;exec(open(os.path.join('$pype_root', 'pype', 'version.py')).read());print(__version__);"
|
||||
pype_version="$(python3 <<< ${version_command})"
|
||||
|
||||
echo -e "${BIYellow}---${RST} Cleaning build directory ..."
|
||||
rm -rf "$pype_root/build" && mkdir "$pype_root/build" > /dev/null
|
||||
echo -e "${BIYellow}---${RST} Cleaning build directory ..."
|
||||
rm -rf "$pype_root/build" && mkdir "$pype_root/build" > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building Pype ${BIWhite}[${RST} ${BIGreen}$pype_version${RST} ${BIWhite}]${RST}"
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
|
||||
clean_pyc
|
||||
echo -e "${BIGreen}>>>${RST} Building ..."
|
||||
poetry run python3 "$pype_root/setup.py" build > "$pype_root/build/build.log"
|
||||
poetry run python3 "$pype_root/tools/build_dependencies.py"
|
||||
echo -e "${BIGreen}>>>${RST} Building Pype ${BIWhite}[${RST} ${BIGreen}$pype_version${RST} ${BIWhite}]${RST}"
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
|
||||
clean_pyc
|
||||
echo -e "${BIGreen}>>>${RST} Building ..."
|
||||
poetry run python3 "$pype_root/setup.py" build > "$pype_root/build/build.log"
|
||||
poetry run python3 "$pype_root/tools/build_dependencies.py"
|
||||
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find Pype and build log in \c"
|
||||
echo -e "${BIWhite}$pype_root/build${RST} directory."
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find Pype and build log in \c"
|
||||
echo -e "${BIWhite}$pype_root/build${RST} directory."
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -99,8 +99,9 @@ install_poetry () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
|
@ -111,14 +112,18 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" generate-zip "$@"
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" generate-zip "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
|
|
@ -65,17 +65,21 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running apidoc ..."
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" pype vendor, pype\vendor
|
||||
echo -e "${BIGreen}>>>${RST} Running apidoc ..."
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" pype vendor, pype\vendor
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building html ..."
|
||||
poetry run python3 "$pype_root/setup.py" build_sphinx
|
||||
echo -e "${BIGreen}>>>${RST} Building html ..."
|
||||
poetry run python3 "$pype_root/setup.py" build_sphinx
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -66,18 +66,20 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$pype_root" > /dev/null
|
||||
# Directories
|
||||
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
mongo_port=2707
|
||||
echo $pype_root
|
||||
dbpath="$(dirname $pype_root)/mongo_db_data"
|
||||
mongo_port=2707
|
||||
dbpath="$(dirname $pype_root)/mongo_db_data"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running mongodb ..."
|
||||
mongod --dbpath "$dbpath" --port $mongo_port
|
||||
echo -e "${BIGreen}>>>${RST} Detached to background."
|
||||
}
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running mongodb ..."
|
||||
mongod --dbpath "$dbpath" --port $mongo_port
|
||||
echo -e "${BIGreen}>>>${RST} Detached to background."
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
|
@ -111,14 +112,18 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" settings --dev
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" settings --dev
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -87,8 +87,9 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
|
@ -107,19 +108,22 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Testing Pype ..."
|
||||
original_pythonpath=$PYTHONPATH
|
||||
export PYTHONPATH="$pype_root:$PYTHONPATH"
|
||||
poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests"
|
||||
PYTHONPATH=$original_pythonpath
|
||||
}
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Testing Pype ..."
|
||||
original_pythonpath=$PYTHONPATH
|
||||
export PYTHONPATH="$pype_root:$PYTHONPATH"
|
||||
poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests"
|
||||
PYTHONPATH=$original_pythonpath
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
local path
|
||||
path=$pype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
}
|
||||
|
|
@ -111,14 +112,18 @@ realpath () {
|
|||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
main () {
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..."
|
||||
poetry run python3 "$pype_root/start.py" tray --debug
|
||||
echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..."
|
||||
poetry run python3 "$pype_root/start.py" tray --debug
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -51,61 +51,6 @@ 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 "6" ] ; then
|
||||
echo -e "${BIWhite}[${RST} ${BIGreen}$1.$2${RST} ${BIWhite}]${RST}"
|
||||
PYTHON="python3"
|
||||
else
|
||||
command -v python3 >/dev/null 2>&1 || { echo -e "${BIRed}FAILED${RST} ${BIYellow} Version [${RST}${BICyan}$1.$2${RST}]${BIYellow} 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 () {
|
||||
path=${1:-$pype_root}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -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
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue