unix poetry

This commit is contained in:
Ondrej Samohel 2021-02-02 17:52:25 +01:00
parent c28a9ffd49
commit d96d38b083
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
9 changed files with 51 additions and 77 deletions

View file

@ -9,7 +9,11 @@ license = "MIT License"
python = "3.7.*"
aiohttp_json_rpc = "*" # TVPaint server
acre = { git = "https://github.com/pypeclub/acre.git" }
opentimelineio = { git = "https://github.com/pypeclub/OpenTimelineIO.git", branch="develop" }
opentimelineio = [
{ git = "https://github.com/pypeclub/OpenTimelineIO.git", branch="develop", markers = "sys_platform == 'win32'" },
{ git = "git+https://github.com/PixarAnimationStudios/OpenTimelineIO.git", markers = "sys_platform == 'darwin'" }
]
appdirs = "^1.4.3"
blessed = "^1.17" # pype terminal formatting
clique = "1.5.*"
@ -31,6 +35,7 @@ speedcopy = "^2.1"
six = "^1.15"
wsrpc_aiohttp = "^3.1.1" # websocket server
pywin32 = { version = "300", markers = "sys_platform == 'win32'" }
jinxed = { version = "^1.0.1", markers = "sys_platform == 'darwin'" }
[tool.poetry.dev-dependencies]
flake8 = "^3.7"

View file

@ -63,15 +63,16 @@ 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
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
@ -103,7 +104,7 @@ clean_pyc () {
# None
###############################################################################
realpath () {
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
echo $(cd $(dirname "$1") || return; pwd)/$(basename "$1")
}
# Main
@ -113,9 +114,8 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
pushd "$pype_root" || 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})"
@ -124,14 +124,11 @@ 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} Entering venv ..."
source "$pype_root/venv/bin/activate"
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
clean_pyc
echo -e "${BIGreen}>>>${RST} Building ..."
python "$pype_root/setup.py" build > "$pype_root/build/build.log"
python -B "$pype_root/tools/build_dependencies.py"
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate
poetry run python "$pype_root/setup.py" build > "$pype_root/build/build.log"
poetry run python "$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."

View file

@ -78,6 +78,12 @@ detect_python () {
fi
}
install_poetry () {
echo -e "${BIGreen}>>>${RST} Installing Poetry ..."
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
export PATH="$PATH:$HOME/.poetry/bin"
}
##############################################################################
# Clean pyc files in specified directory
# Globals:
@ -114,26 +120,25 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
pushd "$pype_root" || return > /dev/null
echo -e "${BIYellow}---${RST} Cleaning venv directory ..."
rm -rf "$pype_root/venv" && mkdir "$pype_root/venv"
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
if [ -f "$HOME/.poetry/bin/poetry" ]; then
echo -e "${BIGreen}OK${RST}"
else
echo -e "${BIYellow}NOT FOUND${RST}"
install_poetry
fi
echo -e "${BIGreen}>>>${RST} Creating venv ..."
python3 -m venv "$pype_root/venv"
if [ -f "$pype_root/poetry.lock" ]; then
echo -e "${BIGreen}>>>${RST} Updating dependencies ..."
poetry update
else
echo -e "${BIGreen}>>>${RST} Installing dependencies ..."
poetry install
fi
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
echo -e "${BIGreen}>>>${RST} Updatng pip ..."
python -m pip install --upgrade pip
echo -e "${BIGreen}>>>${RST} Installing wheel ..."
python -m pip install wheel
echo -e "${BIGreen}>>>${RST} Installing packages to new venv ..."
pip install -r "$pype_root/requirements.txt"
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
clean_pyc
deactivate

View file

@ -113,15 +113,8 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
pushd "$pype_root" || return > /dev/null
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
python "$pype_root/start.py" generate-zip $@
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate
poetry run python "$pype_root/start.py" generate-zip "$@"

View file

@ -70,19 +70,12 @@ art
echo -e "${RST}"
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
pushd "$pype_root" || return > /dev/null
echo -e "${BIGreen}>>>${RST} Running apidoc ..."
sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter
sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" pype vendor, pype\vendor
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter
poetry run sphinx-apidoc -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 ..."
python setup.py build_sphinx
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate
poetry run python "$pype_root/setup.py" build_sphinx

View file

@ -71,7 +71,6 @@ art
echo -e "${RST}"
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null

View file

@ -113,15 +113,9 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
pushd "$pype_root" || return> /dev/null
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
python "$pype_root/start.py" settings --dev
poetry run python "$pype_root/start.py" settings --dev
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate

View file

@ -113,18 +113,13 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
pushd "$pype_root" || return > /dev/null
echo -e "${BIGreen}>>>${RST} Testing Pype ..."
original_pythonpath=$PYTHONPATH
export PYTHONPATH="$pype_root:$PYTHONPATH"
pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests"
$env:PYTHONPATH = $original_pythonpath
poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests"
PYTHONPATH=$original_pythonpath
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate

View file

@ -113,15 +113,8 @@ echo -e "${RST}"
detect_python || return 1
# Directories
current_dir=$(realpath "$(pwd)")
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
pushd "$pype_root" > /dev/null
echo -e "${BIGreen}>>>${RST} Entering venv ..."
source "$pype_root/venv/bin/activate"
pushd "$pype_root" || return > /dev/null
echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..."
python "$pype_root/start.py" tray --debug
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
deactivate
poetry run python "$pype_root/start.py" tray --debug