summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-07-17 11:46:52 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-07-17 11:46:52 (GMT)
commitf4e7a35d640c919923b3c0925a8d548e5391ec61 (patch)
tree90d462dbbc05e4d6dd7c8f8d8ff9c821a1724edc /setup.py
parent45bf773f605bdee3b4f8334a97d6130a75b9286a (diff)
downloadcpython-f4e7a35d640c919923b3c0925a8d548e5391ec61.zip
cpython-f4e7a35d640c919923b3c0925a8d548e5391ec61.tar.gz
cpython-f4e7a35d640c919923b3c0925a8d548e5391ec61.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.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/setup.py b/setup.py
index f97fbea..0d524774 100644
--- a/setup.py
+++ b/setup.py
@@ -534,18 +534,19 @@ class PyBuildExt(build_ext):
tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
- os.system("ldd %s > %s" % (do_readline, tmpfile))
- fp = open(tmpfile)
- 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()
+ ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
+ if ret >> 8 == 0:
+ fp = open(tmpfile)
+ 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()
os.unlink(tmpfile)
# Issue 7384: If readline is already linked against curses,
# use the same library for the readline and curses modules.