Browse code

Update lib_install_from_git to use column format

The pip list command supports a --format=columns option which outputs
things in space delimited columns. Switch to using that.

Change-Id: I5140a7d83bf567b1c3c67516112eb4c57074fa53

Monty Taylor authored on 2017/10/07 03:11:48
Showing 1 changed files
... ...
@@ -415,11 +415,11 @@ function lib_installed_from_git {
415 415
     # you the path an editable install was installed from; for example
416 416
     # in response to something like
417 417
     #  pip install -e 'git+http://git.openstack.org/openstack-dev/bashate#egg=bashate'
418
-    # pip list shows
419
-    #  bashate (0.5.2.dev19, /tmp/env/src/bashate)
420
-    # Thus we look for "path after a comma" to indicate we were
421
-    # installed from some local place
422
-    pip list 2>/dev/null | grep -- "$name" | grep -q -- ', .*)$'
418
+    # pip list --format columns shows
419
+    #  bashate 0.5.2.dev19 /tmp/env/src/bashate
420
+    # Thus we check the third column to see if we're installed from
421
+    # some local place.
422
+    [[ -z $(pip list --format=columns 2>/dev/null | awk "/^$name/ {print \$3}") ]]
423 423
 }
424 424
 
425 425
 # check that everything that's in LIBS_FROM_GIT was actually installed