Support old version of pip installed on Travis, take 2

This commit is contained in:
vitaut 2015-05-20 11:45:16 -07:00
parent 6955417236
commit fca83df599

View File

@ -9,13 +9,13 @@ def pip_install(package, commit=None):
"Install package using pip." "Install package using pip."
if commit: if commit:
cmd = ['pip', 'show', package.split('/')[1]] cmd = ['pip', 'show', package.split('/')[1]]
p = Popen(cmd, stdout=PIPE) p = Popen(cmd, stdout=PIPE, stderr=PIPE)
output = p.communicate()[0] stdout, stderr = p.communicate()
if p.returncode != 0: if p.returncode != 0:
if 'No command by the name pip show' in output: # Check if pip supports the show command.
return # Old version of pip - ignore if 'No command by the name pip show' not in stderr:
raise CalledProcessError(p.returncode, cmd) raise CalledProcessError(p.returncode, cmd)
if output: elif stdout:
return # Already installed 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])