mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge branch '3.0/unix-support' into 3.0/poetry
This commit is contained in:
commit
c28a9ffd49
14 changed files with 1104 additions and 109 deletions
82
README.md
82
README.md
|
|
@ -16,9 +16,9 @@ Requirements
|
|||
------------
|
||||
Pype will run on most typical hardware configurations commonly found in studios around the world.
|
||||
It is installed on artist computer and can take up 3Gb of space depending on number of versions
|
||||
and other dependencies.
|
||||
and other dependencies.
|
||||
|
||||
For well functioning [ftrack](https://www.ftrack.com/en/) event server, we recommend a
|
||||
For well functioning [ftrack](https://www.ftrack.com/en/) event server, we recommend a
|
||||
linux virtual server with [Ubuntu](https://ubuntu.com/) or [CentosOS](https://www.centos.org/).
|
||||
CPU and RAM allocation need differ based on the studio size, but a 2GB of RAM, with a
|
||||
dual core CPU and around 4GB of storage should suffice.
|
||||
|
|
@ -57,6 +57,62 @@ it will install it on current computer.
|
|||
|
||||
Pype is build using [CX_Freeze](https://cx-freeze.readthedocs.io/en/latest) to freeze itself and all dependencies.
|
||||
|
||||
### macOS
|
||||
|
||||
You will need [Python 3.7 and newer](https://www.python.org/downloads/) and [git](https://git-scm.com/downloads). You'll need also other tools to build
|
||||
some Pype dependencies like [CMake](https://cmake.org/) and **XCode Command Line Tools** (or some other build system).
|
||||
|
||||
You can install **XCode Command Line Tools** from Terminal:
|
||||
```sh
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
Before building Pype be sure to make **CMake** available in `PATH`:
|
||||
```sh
|
||||
export PATH=$PATH:/Applications/CMake.app/Contents/bin
|
||||
```
|
||||
|
||||
#### To build Pype:
|
||||
|
||||
1) Run `.\tools\create_env.sh` to create virtual environment in `.\venv`
|
||||
2) Run `.\tools\build.sh` to build Pype executables in `.\build\`
|
||||
|
||||
|
||||
### Linux
|
||||
|
||||
You will need [Python 3.7 and newer](https://www.python.org/downloads/) and [git](https://git-scm.com/downloads). You'll need also other tools to build
|
||||
some Pype dependencies like [CMake](https://cmake.org/). Python 3 should be part of all modern distributions. You can use your package manager to install **git** and **cmake**.
|
||||
|
||||
For Ubuntu:
|
||||
```sh
|
||||
sudo apt install git cmake
|
||||
```
|
||||
|
||||
For CentOS:
|
||||
```sh
|
||||
sudo yum install qit cmake
|
||||
```
|
||||
|
||||
#### Note:
|
||||
In case you run in error about `xcb` when running Pype,
|
||||
you'll need also additional libraries for Qt5:
|
||||
|
||||
For Ubuntu:
|
||||
```sh
|
||||
sudo apt install qt5-default
|
||||
```
|
||||
For CentOS:
|
||||
```sh
|
||||
sudo yum install qt5-qtbase-devel
|
||||
```
|
||||
|
||||
#### To build Pype:
|
||||
|
||||
1) Run `.\tools\create_env.sh` to create virtual environment in `.\venv`
|
||||
2) Run `.\tools\build.sh` to build Pype executables in `.\build\`
|
||||
|
||||
|
||||
|
||||
Running Pype
|
||||
------------
|
||||
|
||||
|
|
@ -67,10 +123,13 @@ If Pype is executed from live sources, it will use Pype version included in them
|
|||
it is executed from frozen code it will try to find latest Pype version installed locally
|
||||
on current computer and if it is not found, it will ask for its location. On that location
|
||||
pype can be either in directories or zip files. Pype will try to find latest version and
|
||||
install it to user data directory (on Windows to `%LOCALAPPDATA%\pypeclub\pype`).
|
||||
install it to user data directory (on Windows to `%LOCALAPPDATA%\pypeclub\pype`, on Linux
|
||||
`~/.local/share/pype` and on macOS in `~/Library/Application Support/pype`).
|
||||
|
||||
### From sources
|
||||
Pype can be run directly from sources by activating virtual environment:
|
||||
|
||||
**On Windows:**
|
||||
```powershell
|
||||
.\venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
|
@ -78,22 +137,29 @@ and running:
|
|||
```powershell
|
||||
python start.py tray
|
||||
```
|
||||
**On macOS/Linux:**
|
||||
```sh
|
||||
source ./venv/bin/activate
|
||||
python start.py tray
|
||||
```
|
||||
|
||||
|
||||
This will use current Pype version with sources. You can override this with `--use-version=x.x.x` and
|
||||
then Pype will try to find locally installed specified version (present in user data directory).
|
||||
|
||||
### From frozen code
|
||||
|
||||
You need to build Pype first. This will produce two executables - `pype.exe` and `pype_console.exe`.
|
||||
You need to build Pype first. This will produce two executables - `pype_gui(.exe)` and `pype_console(.exe)`.
|
||||
First one will act as GUI application and will not create console (useful in production environments).
|
||||
The second one will create console and will write output there - useful for headless application and
|
||||
debugging purposes. If you need pype version installed, just run `./tools/create_zip.ps1` without
|
||||
debugging purposes. If you need pype version installed, just run `./tools/create_zip(.ps1|.sh)` without
|
||||
arguments and it will create zip file that pype can use.
|
||||
|
||||
|
||||
Building documentation
|
||||
----------------------
|
||||
|
||||
Top build API documentation, run `.\tools\make_docs.ps1`. It will create html documentation
|
||||
Top build API documentation, run `.\tools\make_docs(.ps1|.sh)`. It will create html documentation
|
||||
from current sources in `.\docs\build`.
|
||||
|
||||
**Note that it needs existing virtual environment.**
|
||||
|
|
@ -101,6 +167,6 @@ from current sources in `.\docs\build`.
|
|||
Running tests
|
||||
-------------
|
||||
|
||||
To run tests, execute `.\tools\run_tests.ps1`.
|
||||
To run tests, execute `.\tools\run_tests(.ps1|.sh)`.
|
||||
|
||||
**Note that it needs existing virtual environment.**
|
||||
**Note that it needs existing virtual environment.**
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ ffmpeg-python
|
|||
google-api-python-client
|
||||
jsonschema
|
||||
keyring
|
||||
jinxed
|
||||
log4mongo
|
||||
git+https://github.com/pypeclub/OpenTimelineIO.git@develop
|
||||
git+https://github.com/PixarAnimationStudios/OpenTimelineIO.git
|
||||
pathlib2
|
||||
Pillow
|
||||
pyblish-base
|
||||
|
|
|
|||
5
setup.py
5
setup.py
|
|
@ -53,8 +53,7 @@ include_files = [
|
|||
"schema",
|
||||
"vendor",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"pype/version.py"
|
||||
"README.md"
|
||||
]
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
|
@ -75,7 +74,7 @@ executables = [
|
|||
Executable("start.py", base=None,
|
||||
target_name="pype_console", icon=icon_path.as_posix()),
|
||||
Executable("start.py", base=base,
|
||||
target_name="pype", icon=icon_path.as_posix())
|
||||
target_name="pype_gui", icon=icon_path.as_posix())
|
||||
]
|
||||
|
||||
setup(
|
||||
|
|
|
|||
136
tools/build.sh
Normal file → Executable file
136
tools/build.sh
Normal file → Executable file
|
|
@ -1,13 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Build Pype using existing virtual environment.
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ \\
|
||||
\\ \\ --- \\
|
||||
\\ \\ _____/ ______
|
||||
\\ \\ \\___/ /\\ \\
|
||||
\\ \\____\\ \\ \\_____\\
|
||||
\\/____/ \\/_____/ PYPE Club .
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -47,70 +51,6 @@ BICyan='\033[1;96m' # Cyan
|
|||
BIWhite='\033[1;97m' # White
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Test if Xcode Command Line tools are installed in MacOS
|
||||
###############################################################################
|
||||
have_command_line_tools() {
|
||||
[[ -e "/Library/Developer/CommandLineTools/usr/bin/git" ]]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Get command any key from user
|
||||
###############################################################################
|
||||
getc() {
|
||||
local save_state
|
||||
save_state=$(/bin/stty -g)
|
||||
/bin/stty raw -echo
|
||||
IFS= read -r -n 1 -d '' "$@"
|
||||
/bin/stty "$save_state"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Test if we have access via sudo
|
||||
# Used in MacOS
|
||||
###############################################################################
|
||||
have_sudo_access() {
|
||||
if [[ -z "${HAVE_SUDO_ACCESS-}" ]]; then
|
||||
/usr/bin/sudo -l mkdir &>/dev/null
|
||||
HAVE_SUDO_ACCESS="$?"
|
||||
fi
|
||||
|
||||
if [[ "$HAVE_SUDO_ACCESS" -ne 0 ]]; then
|
||||
echo -e "${BIRed}!!!${RST} Need sudo access on MacOS"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return "$HAVE_SUDO_ACCESS"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Execute command and report failure
|
||||
###############################################################################
|
||||
execute() {
|
||||
if ! "$@"; then
|
||||
echo -e "${BIRed}!!!${RST} Failed execution of ${BIWhite}[ $@ ]${RST}"
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Execute command using sudo
|
||||
# This is used on MacOS to handle Xcode command line tools installation
|
||||
###############################################################################
|
||||
execute_sudo() {
|
||||
local -a args=("$@")
|
||||
if [[ -n "${SUDO_ASKPASS-}" ]]; then
|
||||
args=("-A" "${args[@]}")
|
||||
fi
|
||||
if have_sudo_access; then
|
||||
echo -e "${BIGreen}>->${RST} sudo: [${BIWhite} ${args[@]} ${RST}]"
|
||||
execute "/usr/bin/sudo" "${args[@]}"
|
||||
else
|
||||
echo -e "${BIGreen}>->${RST} [${BIWhite} ${args[@]} ${RST}]"
|
||||
execute "${args[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Detect required version of python
|
||||
# Globals:
|
||||
|
|
@ -122,7 +62,7 @@ execute_sudo() {
|
|||
# None
|
||||
###############################################################################
|
||||
detect_python () {
|
||||
echo -e "${BIYellow}>>>${RST} Forced using python at [ ${BIWhite}[ $PYPE_PYTHON_EXE ]${RST} ... \c"
|
||||
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"
|
||||
|
|
@ -130,7 +70,7 @@ detect_python () {
|
|||
set -- $python_version
|
||||
IFS="$oIFS"
|
||||
if [ "$1" -ge "3" ] && [ "$2" -ge "6" ] ; then
|
||||
echo -e "${BIGreen}$1.$2${RST}"
|
||||
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; }
|
||||
|
|
@ -147,27 +87,51 @@ detect_python () {
|
|||
# None
|
||||
###############################################################################
|
||||
clean_pyc () {
|
||||
path=${1:-$PYPE_SETUP_PATH}
|
||||
echo -e "${IGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
path=${1:-$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}"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Return absolute path
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# Path to resolve
|
||||
# Returns:
|
||||
# None
|
||||
###############################################################################
|
||||
realpath () {
|
||||
echo $(cd $(dirname "$1"); pwd)/$(basename "$1")
|
||||
}
|
||||
|
||||
# Main
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
detect_python || return 1
|
||||
|
||||
version_command="import version;print(version.__version__)"
|
||||
# Directories
|
||||
current_dir=$(realpath "$(pwd)")
|
||||
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$pype_root" > /dev/null
|
||||
|
||||
version_command="import os;exec(open(os.path.join('$pype_root', 'pype', 'version.py')).read());print(__version__);"
|
||||
pype_version="$(python3 <<< ${version_command})"
|
||||
echo -e "${IGreen}>>>${RST} Building Pype [${IGreen} v$pype_version ${RST}]"
|
||||
echo -e "${IGreen}>>>${RST} Creating virtual env ..."
|
||||
python3 -m venv venv
|
||||
echo -e "${IGreen}>>>${RST} Entering venv ..."
|
||||
source venv/bin/activate
|
||||
echo -e "${IGreen}>>>${RST} Installing packages to new venv ..."
|
||||
pip install -r requirements.txt
|
||||
echo -e "${IGreen}>>>${RST} Cleaning cache files ..."
|
||||
|
||||
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 "${IGreen}>>>${RST} Building ..."
|
||||
python setup.py build
|
||||
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
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find Pype and build log in \c"
|
||||
echo -e "${BIWhite}$pype_root/build${RST} directory."
|
||||
|
|
|
|||
|
|
@ -72,17 +72,8 @@ _print("Getting venv site-packages ...")
|
|||
assert site_pkg, "No venv site-packages are found."
|
||||
_print(f"Working with: {site_pkg}", 2)
|
||||
|
||||
# now, copy it to build directory
|
||||
build_dir = None
|
||||
if sys.platform.startswith("linux"):
|
||||
# TODO: what is it under linux?
|
||||
raise NotImplementedError("not implemented for linux yet")
|
||||
elif sys.platform == "darwin":
|
||||
# TODO: what is it under macOS?
|
||||
raise NotImplementedError("not implemented for macOS yet")
|
||||
elif sys.platform == "win32":
|
||||
# string is formatted as cx_freeze is doing it
|
||||
build_dir = "exe.{}-{}".format(get_platform(), sys.version[0:3])
|
||||
|
||||
build_dir = "exe.{}-{}".format(get_platform(), sys.version[0:3])
|
||||
|
||||
# create full path
|
||||
build_dir = Path(os.path.dirname(__file__)).parent / "build" / build_dir
|
||||
|
|
|
|||
139
tools/create_env.sh
Executable file
139
tools/create_env.sh
Executable file
|
|
@ -0,0 +1,139 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script will detect Python installation, and create virtual environment
|
||||
# for Pype to run or build.
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
|
||||
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 "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
|
||||
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 "${BIYellow}---${RST} Cleaning venv directory ..."
|
||||
rm -rf "$pype_root/venv" && mkdir "$pype_root/venv"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Creating venv ..."
|
||||
python3 -m venv "$pype_root/venv"
|
||||
|
||||
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
|
||||
127
tools/create_zip.sh
Executable file
127
tools/create_zip.sh
Executable file
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Helper script to create Pype zip.
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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 "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
|
||||
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"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
python "$pype_root/start.py" generate-zip $@
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
|
||||
deactivate
|
||||
88
tools/make_docs.sh
Executable file
88
tools/make_docs.sh
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Make Pype documentation
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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
|
||||
echo -e "${BGreen}"
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building html ..."
|
||||
python setup.py build_sphinx
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
|
||||
deactivate
|
||||
84
tools/run_mongo.sh
Executable file
84
tools/run_mongo.sh
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Helper script to run mongod in the backround.
|
||||
# NOTE: we are expecting mongod is in PATH
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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
|
||||
echo -e "${BGreen}"
|
||||
art
|
||||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
current_dir=$(realpath "$(pwd)")
|
||||
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$pype_root" > /dev/null
|
||||
|
||||
mongo_port=2707
|
||||
echo $pype_root
|
||||
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."
|
||||
127
tools/run_settings.sh
Executable file
127
tools/run_settings.sh
Executable file
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Settings GUI
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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 "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
|
||||
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"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
python "$pype_root/start.py" settings --dev
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
|
||||
deactivate
|
||||
130
tools/run_tests.sh
Executable file
130
tools/run_tests.sh
Executable file
|
|
@ -0,0 +1,130 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run tests for Pype
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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 "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
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
|
||||
deactivate
|
||||
127
tools/run_tray.sh
Executable file
127
tools/run_tray.sh
Executable file
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Tray
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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 "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
|
||||
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"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..."
|
||||
python "$pype_root/start.py" tray --debug
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Deactivating venv ..."
|
||||
deactivate
|
||||
38
tools/update_submodules.ps1
Normal file
38
tools/update_submodules.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<#
|
||||
.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
|
||||
|
||||
#>
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
|
||||
"@
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
git submodule update --recursive --remote
|
||||
114
tools/update_submodules.sh
Normal file
114
tools/update_submodules.sh
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Tray
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
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 "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
|
||||
echo -e "${RST}"
|
||||
|
||||
git submodule update --recursive --remote
|
||||
Loading…
Add table
Add a link
Reference in a new issue