From 483fe24941ef06521c407c5a1600cb498da9cb57 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 23 Apr 2019 14:50:23 -0700 Subject: [PATCH] Merge pull request #268 from tableau/print-install-logs Build is broken. --- .travis.yml | 18 +++++------ startup.sh | 72 ++++++++++++++++++++++++++++--------------- tabpy-server/setup.py | 2 +- 3 files changed, 57 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index a2a65207..9136aa64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,14 @@ os: linux language: python python: 3.6 install: - - ./startup.sh --no-startup - - pip install pytest - - pip install pytest-cov - - pip install coveralls - - npm install -g markdownlint-cli + - ./startup.sh --no-startup --print-install-logs + - pip install pytest + - pip install pytest-cov + - pip install coveralls + - npm install -g markdownlint-cli script: - - pytest tabpy-server/server_tests/ --cov=tabpy-server/tabpy_server - - pytest tabpy-tools/tools_tests/ --cov=tabpy-tools/tabpy_tools --cov-append - - markdownlint . + - pytest tabpy-server/server_tests/ --cov=tabpy-server/tabpy_server + - pytest tabpy-tools/tools_tests/ --cov=tabpy-tools/tabpy_tools --cov-append + - markdownlint . after_success: - - coveralls + - coveralls diff --git a/startup.sh b/startup.sh index 70832331..04633074 100755 --- a/startup.sh +++ b/startup.sh @@ -7,6 +7,24 @@ function check_status() { fi } +function install_dependencies() { + # $1 = tabpy_server | tabpy_tools + # $2 = true if install logs are printed to the console, + # false if they are printed to a log file + # $3 = install log file path + if [ "$2" = true ]; then + echo -e "\nInstalling ${1} dependencies..." + python3 setup.py install + elif [ "$2" = false ]; then + echo -e "\nInstalling ${1} dependencies..." >> ${3} + python3 setup.py install >> ${3} 2>&1 + else + echo Invalid startup environment. + exit 1 + fi + check_status +} + # Check for Python in PATH echo Checking for presence of Python in the system path variable. python --version &>- @@ -16,47 +34,51 @@ check_status "Cannot find Python. Check that Python is installed and is in the echo Setting TABPY_ROOT to current working directory. TABPY_ROOT=$PWD INSTALL_LOG=${TABPY_ROOT}/tabpy-server/install.log +echo "" > ${INSTALL_LOG} +PRINT_INSTALL_LOGS=false + +# Parse CLI parameters +for i in "$@" +do + case $i in + -c=*|--config=*) + CONFIG="${i#*=}" + shift + ;; + --no-startup) + NO_STARTUP=true + shift + ;; + --print-install-logs) + PRINT_INSTALL_LOGS=true + shift + ;; + *) + echo Invalid option: $i + esac +done # Check for dependencies, install them if they're not present. echo Installing TabPy-server requirements. -echo Read the logs at ${INSTALL_LOG} +if [ "$PRINT_INSTALL_LOGS" = false ]; then + echo Read the logs at ${INSTALL_LOG} +fi cd ${TABPY_ROOT}/tabpy-server -echo -e "\nInstalling tabpy-server dependencies..." > ${INSTALL_LOG} -python3 setup.py install >> ${INSTALL_LOG} 2>&1 -check_status +install_dependencies "tabpy-server" ${PRINT_INSTALL_LOGS} ${INSTALL_LOG} cd ${TABPY_ROOT}/tabpy-tools -echo -e "\nInstalling tabpy-tools dependencies..." >> ${INSTALL_LOG} -python3 setup.py install >> ${INSTALL_LOG} 2>&1 -check_status +install_dependencies "tabpy-tools" ${PRINT_INSTALL_LOGS} ${INSTALL_LOG} cd ${TABPY_ROOT} check_status -# Check for CLI parameters -for i in "$@" -do -case $i in - -c=*|--config=*) - CONFIG="${i#*=}" - shift - ;; - --no-startup) - TEST_ENV=true - shift - ;; - *) - echo Invalid option: $i -esac -done - if [ ! -z ${CONFIG} ]; then echo Using the config file at ${TABPY_ROOT}/tabpy-server/$CONFIG. fi # Exit if in a test environent -if [ ! -z ${TEST_ENV} ]; then +if [ ! -z ${NO_STARTUP} ]; then echo Skipping server startup. Exiting successfully. exit 0 fi diff --git a/tabpy-server/setup.py b/tabpy-server/setup.py index 861641ac..17f8c643 100644 --- a/tabpy-server/setup.py +++ b/tabpy-server/setup.py @@ -48,6 +48,6 @@ 'six', 'tornado==5.1.1', 'Tornado-JSON', - 'urllib3' + 'urllib3<1.25,>=1.21.1' ] )