summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-07-11 18:13:41 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-07-13 09:09:32 +0000
commitc0198a43aace41e8ce35e63c21a4cb3b8138f91f (patch)
tree85623e03dbbc8934bc7e669943f5a79ddcb06602
parentd47cfbebbd761d23e99c52053545b3e9bb4a38b2 (diff)
downloadimport-c0198a43aace41e8ce35e63c21a4cb3b8138f91f.tar.gz
python.find_deps: On failure, show stdout and stderr output from Pip
It's nice to have some idea right away of what went wrong. A common error is running the import tool on a system without the patched version of Pip. This now produces the following sort of message: baserockimport/exts/python.find_deps: Failed to get runtime dependencies for numpy at checkouts/python_numpy-tarball/. Output from Pip: Usage: pip install [options] <requirement specifier> [package-index-options] ... pip install [options] -r <requirements file> [package-index-options] ... pip install [options] [-e] <vcs project url> ... pip install [options] [-e] <local project path> ... pip install [options] <archive url/path> ... no such option: --list-dependencies Change-Id: I902920b46b29b1e2b18736b2ff2b5f4f4cdb42df
-rwxr-xr-xbaserockimport/exts/python.find_deps7
1 files changed, 5 insertions, 2 deletions
diff --git a/baserockimport/exts/python.find_deps b/baserockimport/exts/python.find_deps
index cd2e9bd..91a9e39 100755
--- a/baserockimport/exts/python.find_deps
+++ b/baserockimport/exts/python.find_deps
@@ -283,20 +283,23 @@ def find_runtime_deps(source, name, version=None, use_requirements_file=False):
p = subprocess.Popen(args, cwd=source, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
+ output = []
while True:
line = p.stdout.readline()
if line == '':
break
logging.debug(line.rstrip('\n'))
+ output.append(line)
p.wait() # even with eof, wait for termination
logging.debug('pip exited with code: %d' % p.returncode)
if p.returncode != 0:
- error('failed to get runtime dependencies for %s%s at %s'
- % (name, ' %s' % version if version else '', source))
+ error('Failed to get runtime dependencies for %s%s at %s. Output from '
+ 'Pip: %s' % (name, ' %s' % version if version else '', source,
+ ' '.join(output)))
with os.fdopen(tmpfd) as tmpfile:
ss = resolve_specs(pkg_resources.parse_requirements(tmpfile))