diff --git a/README.md b/README.md index 7799c07d91..f95064eb88 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ 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 +### 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). @@ -124,7 +124,7 @@ it is executed from frozen code it will try to find latest Pype version installe 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`, on Linux -`~/.local/share/pype`). +`~/.local/share/pype` and on macOS in `~/Library/Application Support/pype`). ### From sources Pype can be run directly from sources by activating virtual environment: @@ -149,17 +149,17 @@ then Pype will try to find locally installed specified version (present in user ### 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.** @@ -167,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.** diff --git a/tools/update_submodules.ps1 b/tools/update_submodules.ps1 new file mode 100644 index 0000000000..0793889a5c --- /dev/null +++ b/tools/update_submodules.ps1 @@ -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 \ No newline at end of file diff --git a/tools/update_submodules.sh b/tools/update_submodules.sh new file mode 100644 index 0000000000..c0b98f2c5e --- /dev/null +++ b/tools/update_submodules.sh @@ -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 \ No newline at end of file