Fix handling of pip show result when using new version of pip
which returns nonzero error code if the package is not installed.
This commit is contained in:
parent
76d1218345
commit
3b224e1813
10
doc/build.py
10
doc/build.py
@ -11,12 +11,14 @@ def pip_install(package, commit=None):
|
|||||||
cmd = ['pip', 'show', package.split('/')[1]]
|
cmd = ['pip', 'show', package.split('/')[1]]
|
||||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if stdout:
|
||||||
# Check if pip supports the show command.
|
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:
|
if 'No command by the name pip show' not in stderr:
|
||||||
raise CalledProcessError(p.returncode, cmd)
|
raise CalledProcessError(p.returncode, cmd)
|
||||||
elif stdout:
|
|
||||||
return # Already installed
|
|
||||||
package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
|
package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
|
||||||
check_call(['pip', 'install', '-q', package])
|
check_call(['pip', 'install', '-q', package])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user