source: OpenWorkouts-current/bin/install @ d4cabcc

currentfeature/docs
Last change on this file since d4cabcc was d4cabcc, checked in by borja <borja@…>, 5 years ago

Remove dependency_links from setup.py.

There is no need to keep using this, and starting with pip 19.0 it does not
recognize such option anymore.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#!/bin/sh
2#
3# Script to install OpenWorkouts for development
4#
5
6# Full path to where we run the script from
7current=`pwd`
8# Full path to the main python binary (will be set by check_python3())
9python_bin=''
10# Full path to the env
11env_path=${current}/env
12
13
14set_scripts_permissions() {
15    # ensure the shell scripts we will need have proper permissions
16    chmod u+x ${current}/bin/js_deps
17    chmod u+x ${current}/bin/start
18    chmod u+x ${current}/bin/screenshot_map
19}
20
21check_python3() {
22    # if python3 is not installed, exit with an error
23    if command -v python3 > /dev/null; then
24        # ok
25        python_bin=`command -v python3`
26        return
27    else
28        # no python3 binary, look for python
29        if command -v python > /dev/null; then
30            # python found, check if it is 3.x
31            if `command -v python` -c "import sys; exit(0) if sys.version.startswith('3.') else exit(1)"; then
32                python_bin=`command -v python`
33                return
34            else
35                # no python binary, error
36                echo "Error: could not find a suitable python version installed, please install python 3.x"
37                exit 1
38            fi
39        else
40            # no python binary, error
41            echo "Error: could not find a suitable python version installed, please install python 3.x"
42            exit 1
43        fi
44    fi
45}
46
47create_venv() {
48    # create a new virtual environment
49    ${python_bin} -m venv ${env_path}
50}
51
52upgrade_pip_setuptools() {
53    . ${env_path}/bin/activate
54    yes | pip install --upgrade setuptools pip
55    deactivate
56}
57
58install_openworkouts() {
59    . ${env_path}/bin/activate
60    yes | pip install --upgrade -e ${current}[testing]
61    deactivate
62}
63
64install_js_deps() {
65    ${current}/bin/js_deps
66}
67
68setup_start_stop() {
69    echo "OpenWorkouts successfully installed in ${env_path}"
70    echo ""
71    echo "You can now start the OpenWorkouts service calling:"
72    echo ""
73    echo "  cd ${current} && ./bin/start"
74    echo ""
75    # echo "You can stop any running OpenWorkouts instances calling:"
76    # echo ""
77    # echo "  ${current}/bin/stop"
78    # echo ""
79}
80
81set_script_permissions
82check_python3
83create_venv
84upgrade_pip_setuptools
85install_openworkouts
86install_js_deps
87setup_start_stop
88
89echo ${python_bin}
Note: See TracBrowser for help on using the repository browser.