summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-07-17 12:21:08 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-07-17 12:21:08 (GMT)
commit2e26e23d9df202fa2314b57530e5af32ff326e5b (patch)
treeb2e11029d7bbdbb4a0393e9e411241cb85d1fbfb /setup.py
parent05b7631c17670a5b221f88161aad23c741b5be79 (diff)
downloadcpython-2e26e23d9df202fa2314b57530e5af32ff326e5b.zip
cpython-2e26e23d9df202fa2314b57530e5af32ff326e5b.tar.gz
cpython-2e26e23d9df202fa2314b57530e5af32ff326e5b.tar.bz2
Issue #7384: On Gentoo, libreadline.so is a "fake library", so ldd fails.
In that case, do not attempt to parse stderr output.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/setup.py b/setup.py
index 464242d..a363509 100644
--- a/setup.py
+++ b/setup.py
@@ -594,16 +594,18 @@ class PyBuildExt(build_ext):
# Determine if readline is already linked against curses or tinfo.
if do_readline and find_executable('ldd'):
fp = os.popen("ldd %s" % do_readline)
- for ln in fp:
- if 'curses' in ln:
- readline_termcap_library = re.sub(
- r'.*lib(n?cursesw?)\.so.*', r'\1', ln
- ).rstrip()
- break
- if 'tinfo' in ln: # termcap interface split out from ncurses
- readline_termcap_library = 'tinfo'
- break
- fp.close()
+ ldd_output = fp.readlines()
+ ret = fp.close()
+ if ret is None or ret >> 8 == 0:
+ for ln in ldd_output:
+ if 'curses' in ln:
+ readline_termcap_library = re.sub(
+ r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+ ).rstrip()
+ break
+ if 'tinfo' in ln: # termcap interface split out from ncurses
+ readline_termcap_library = 'tinfo'
+ break
# Issue 7384: If readline is already linked against curses,
# use the same library for the readline and curses modules.
if 'curses' in readline_termcap_library: