Browse code

Merge "Convert to safe name in lib_installed_from_git"

Zuul authored on 2017/11/29 04:09:10
Showing 1 changed files
... ...
@@ -406,6 +406,9 @@ function use_library_from_git {
406 406
 # determine if a package was installed from git
407 407
 function lib_installed_from_git {
408 408
     local name=$1
409
+    local safe_name
410
+    safe_name=$(python -c "from pkg_resources import safe_name; \
411
+        print(safe_name('${name}'))")
409 412
     # Note "pip freeze" doesn't always work here, because it tries to
410 413
     # be smart about finding the remote of the git repo the package
411 414
     # was installed from.  This doesn't work with zuul which clones
... ...
@@ -419,7 +422,7 @@ function lib_installed_from_git {
419 419
     #  bashate 0.5.2.dev19 /tmp/env/src/bashate
420 420
     # Thus we check the third column to see if we're installed from
421 421
     # some local place.
422
-    [[ -n $(pip list --format=columns 2>/dev/null | awk "/^$name/ {print \$3}") ]]
422
+    [[ -n $(pip list --format=columns 2>/dev/null | awk "/^$safe_name/ {print \$3}") ]]
423 423
 }
424 424
 
425 425
 # check that everything that's in LIBS_FROM_GIT was actually installed