Skip to content

Commit

Permalink
Fix handling of pip show result when using new version of pip
Browse files Browse the repository at this point in the history
which returns nonzero error code if the package is not installed.
  • Loading branch information
vitaut committed Jul 26, 2015
1 parent 76d1218 commit 3b224e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ def pip_install(package, commit=None):
cmd = ['pip', 'show', package.split('/')[1]]
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
# Check if pip supports the show command.
if stdout:
return # Already installed
elif p.returncode != 0:
# Old versions of pip such as the one installed on Travis don't support
# the show command - continue installation in this case.
# Otherwise throw CalledProcessError.
if 'No command by the name pip show' not in stderr:
raise CalledProcessError(p.returncode, cmd)
elif stdout:
return # Already installed
package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
check_call(['pip', 'install', '-q', package])

Expand Down

0 comments on commit 3b224e1

Please sign in to comment.