summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-02 17:57:57 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-02 17:57:57 +0000
commit96d184ac2851743da8ba108e0f437182e165cd3f (patch)
tree885b2e9d2abbe3be286d0fb15e7d1e439c84ae98
parent534ba86ecfaf9bebf609f2479269a334f7c8dd7a (diff)
downloadimport-96d184ac2851743da8ba108e0f437182e165cd3f.tar.gz
Log egg_info output and add TODO
-rwxr-xr-xexts/pip.find_deps17
1 files changed, 14 insertions, 3 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps
index ec842d8..4cfdff0 100755
--- a/exts/pip.find_deps
+++ b/exts/pip.find_deps
@@ -17,6 +17,10 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# TODO: there is a pattern of calling Popen with stderr=STDOUT and reading
+# from p.stdout till EOF, then waiting for the subprocess to terminate.
+# Since this is used in 3 places, it should be factored out really.
+
from __future__ import print_function
import sys
@@ -207,9 +211,16 @@ def find_build_deps(source, name, version=None):
p = subprocess.Popen(['python', 'setup.py', 'egg_info'], cwd=source,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- # TODO: log output of egg_info command?
+ while True:
+ line = p.stdout.readline()
+ if line == '':
+ break
- if p.wait() != 0:
+ logging.debug(line.rstrip('\n'))
+
+ p.wait() # even with eof, wait for termination
+
+ if p.returncode != 0:
# Something went wrong, but in most cases we can probably still
# successfully import without knowing the setup_requires list
# because many python packages have an empty setup_requires list.
@@ -262,7 +273,7 @@ def find_runtime_deps(source, name, version=None):
logging.debug(line.rstrip('\n'))
- p.wait() # even with eof on both streams, we still wait
+ p.wait() # even with eof, wait for termination
logging.debug('pip exited with code: %d' % p.returncode)