Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4e7a35

Browse files
committed
Issue #7384: On Gentoo, libreadline.so is a "fake library", so ldd fails.
In that case, do not attempt to parse stderr output.
1 parent 45bf773 commit f4e7a35

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

setup.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,19 @@ def detect_modules(self):
534534
tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
535535
if not os.path.exists(self.build_temp):
536536
os.makedirs(self.build_temp)
537-
os.system("ldd %s > %s" % (do_readline, tmpfile))
538-
fp = open(tmpfile)
539-
for ln in fp:
540-
if 'curses' in ln:
541-
readline_termcap_library = re.sub(
542-
r'.*lib(n?cursesw?)\.so.*', r'\1', ln
543-
).rstrip()
544-
break
545-
if 'tinfo' in ln: # termcap interface split out from ncurses
546-
readline_termcap_library = 'tinfo'
547-
break
548-
fp.close()
537+
ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
538+
if ret >> 8 == 0:
539+
fp = open(tmpfile)
540+
for ln in fp:
541+
if 'curses' in ln:
542+
readline_termcap_library = re.sub(
543+
r'.*lib(n?cursesw?)\.so.*', r'\1', ln
544+
).rstrip()
545+
break
546+
if 'tinfo' in ln: # termcap interface split out from ncurses
547+
readline_termcap_library = 'tinfo'
548+
break
549+
fp.close()
549550
os.unlink(tmpfile)
550551
# Issue 7384: If readline is already linked against curses,
551552
# use the same library for the readline and curses modules.

0 commit comments

Comments
 (0)