From 3b224e18136013f3765b8df407cc537f32c93885 Mon Sep 17 00:00:00 2001 From: vitaut Date: Sun, 26 Jul 2015 08:25:52 -0700 Subject: [PATCH] Fix handling of pip show result when using new version of pip which returns nonzero error code if the package is not installed. --- doc/build.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/build.py b/doc/build.py index 9a6086d2..58c9c423 100755 --- a/doc/build.py +++ b/doc/build.py @@ -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])