From f266a2dc81be050fec41a180906723ab5cf61df5 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 12 Jun 2017 14:57:59 -0700 Subject: [PATCH] Install test-requirements with main install To reduce the total number of invocations necessary for pip which isn't the quickest thing ever (due to needing to evaluate constraints and deps lists and what is currently installed) combine the main installation of software with its test-requirements.txt file which should roughly halve our pip invocations. Change-Id: Ibcc3264136e66d34a879ad1c90a62e1bb6a84243 --- inc/python | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/inc/python b/inc/python index 4c443d6a00..718cbb23b1 100644 --- a/inc/python +++ b/inc/python @@ -320,6 +320,14 @@ function pip_install { fi $xtrace + + # Also install test requirements + local install_test_reqs="" + local test_req="${!#}/test-requirements.txt" + if [[ -e "$test_req" ]]; then + install_test_reqs="-r $test_req" + fi + # adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep # the same behaviour of setuptools before version 25.0.0. # related issue: https://github.com/pypa/pip/issues/3874 @@ -329,24 +337,10 @@ function pip_install { no_proxy="${no_proxy:-}" \ PIP_FIND_LINKS=$PIP_FIND_LINKS \ SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \ - $cmd_pip $upgrade \ + $cmd_pip $upgrade $install_test_reqs \ $@ result=$? - # Also install test requirements - local test_req="${!#}/test-requirements.txt" - if [[ $result == 0 ]] && [[ -e "$test_req" ]]; then - echo "Installing test-requirements for $test_req" - $sudo_pip \ - http_proxy=${http_proxy:-} \ - https_proxy=${https_proxy:-} \ - no_proxy=${no_proxy:-} \ - PIP_FIND_LINKS=$PIP_FIND_LINKS \ - $cmd_pip $upgrade \ - -r $test_req - result=$? - fi - time_stop "pip_install" return $result }