summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authordoko@ubuntu.com <doko@ubuntu.com>2012-06-30 18:25:32 +0200
committerdoko@ubuntu.com <doko@ubuntu.com>2012-06-30 18:25:32 +0200
commit5884449539510313c826d69835829c7957c7154a (patch)
treedf663a5bd446544a45e96d48dda626f3a9b53c67 /setup.py
parentf2967c73ad1f73bdb5320bf99a595761edd040ba (diff)
downloadcpython-git-5884449539510313c826d69835829c7957c7154a.tar.gz
- Issue #3754: Use readelf instead of ldd for the cross build readline check
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index 19e6bc3668..e26f083483 100644
--- a/setup.py
+++ b/setup.py
@@ -590,13 +590,20 @@ class PyBuildExt(build_ext):
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
readline_termcap_library = ""
curses_library = ""
+ # Cannot use os.popen here in py3k.
+ tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+ if not os.path.exists(self.build_temp):
+ os.makedirs(self.build_temp)
# Determine if readline is already linked against curses or tinfo.
- if do_readline and find_executable('ldd'):
- # Cannot use os.popen here in py3k.
- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
- if not os.path.exists(self.build_temp):
- os.makedirs(self.build_temp)
- ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
+ if do_readline:
+ if cross_compiling:
+ ret = os.system("%s -d %s | grep '(NEEDED)' > %s" \
+ % (sysconfig.get_config_var('READELF'),
+ do_readline, tmpfile))
+ elif find_executable('ldd'):
+ ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
+ else:
+ ret = 256
if ret >> 8 == 0:
with open(tmpfile) as fp:
for ln in fp: