From c0198a43aace41e8ce35e63c21a4cb3b8138f91f Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Sat, 11 Jul 2015 18:13:41 +0100 Subject: 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] [package-index-options] ... pip install [options] -r [package-index-options] ... pip install [options] [-e] ... pip install [options] [-e] ... pip install [options] ... no such option: --list-dependencies Change-Id: I902920b46b29b1e2b18736b2ff2b5f4f4cdb42df --- baserockimport/exts/python.find_deps | 7 +++++-- 1 file 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)) -- cgit v1.2.1