Skip to content

Commit f266a2d

Browse files
committed
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
1 parent 9234316 commit f266a2d

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

inc/python

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ function pip_install {
320320
fi
321321

322322
$xtrace
323+
324+
# Also install test requirements
325+
local install_test_reqs=""
326+
local test_req="${!#}/test-requirements.txt"
327+
if [[ -e "$test_req" ]]; then
328+
install_test_reqs="-r $test_req"
329+
fi
330+
323331
# adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep
324332
# the same behaviour of setuptools before version 25.0.0.
325333
# related issue: https://github.com/pypa/pip/issues/3874
@@ -329,24 +337,10 @@ function pip_install {
329337
no_proxy="${no_proxy:-}" \
330338
PIP_FIND_LINKS=$PIP_FIND_LINKS \
331339
SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \
332-
$cmd_pip $upgrade \
340+
$cmd_pip $upgrade $install_test_reqs \
333341
$@
334342
result=$?
335343

336-
# Also install test requirements
337-
local test_req="${!#}/test-requirements.txt"
338-
if [[ $result == 0 ]] && [[ -e "$test_req" ]]; then
339-
echo "Installing test-requirements for $test_req"
340-
$sudo_pip \
341-
http_proxy=${http_proxy:-} \
342-
https_proxy=${https_proxy:-} \
343-
no_proxy=${no_proxy:-} \
344-
PIP_FIND_LINKS=$PIP_FIND_LINKS \
345-
$cmd_pip $upgrade \
346-
-r $test_req
347-
result=$?
348-
fi
349-
350344
time_stop "pip_install"
351345
return $result
352346
}

0 commit comments

Comments
 (0)