Browse code

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

Clark Boylan authored on 2017/06/13 06:57:59
Showing 1 changed files
... ...
@@ -320,6 +320,14 @@ function pip_install {
320 320
     fi
321 321
 
322 322
     $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
+
323 331
     # adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep
324 332
     # the same behaviour of setuptools before version 25.0.0.
325 333
     # related issue: https://github.com/pypa/pip/issues/3874
... ...
@@ -329,24 +337,10 @@ function pip_install {
329 329
         no_proxy="${no_proxy:-}" \
330 330
         PIP_FIND_LINKS=$PIP_FIND_LINKS \
331 331
         SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \
332
-        $cmd_pip $upgrade \
332
+        $cmd_pip $upgrade $install_test_reqs \
333 333
         $@
334 334
     result=$?
335 335
 
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
-
350 336
     time_stop "pip_install"
351 337
     return $result
352 338
 }