mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
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]]
|
||||
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])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user