Skip to content

Commit

Permalink
Issue python#7384: On Gentoo, libreadline.so is a "fake library", so …
Browse files Browse the repository at this point in the history
…ldd fails.

In that case, do not attempt to parse stderr output.
  • Loading branch information
cloud-tester committed Jul 17, 2010
1 parent 45bf773 commit f4e7a35
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,18 +534,19 @@ def detect_modules(self):
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.
Expand Down

0 comments on commit f4e7a35

Please sign in to comment.