Mercurial > cpython-lru_cache-weakref
diff setup.py @ 77879:e6e99d449bdc
- Issue #3754: Use readelf instead of ldd for the cross build readline check
| author | doko@ubuntu.com |
|---|---|
| date | Sat, 30 Jun 2012 18:25:32 +0200 |
| parents | 56c574a1819a |
| children | 3fae2a4443ff |
line wrap: on
line diff
--- a/setup.py Sat Jun 30 17:32:23 2012 +0200 +++ b/setup.py Sat Jun 30 18:25:32 2012 +0200 @@ -590,13 +590,20 @@ 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:
