[Python-checkins] r80398 - python/branches/py3k-cdecimal/setup.py

stefan.krah python-checkins at python.org
Fri Apr 23 11:04:02 CEST 2010


Author: stefan.krah
Date: Fri Apr 23 11:04:02 2010
New Revision: 80398

Log:
Revert changes for testing issue #7384.

Modified:
   python/branches/py3k-cdecimal/setup.py

Modified: python/branches/py3k-cdecimal/setup.py
==============================================================================
--- python/branches/py3k-cdecimal/setup.py	(original)
+++ python/branches/py3k-cdecimal/setup.py	Fri Apr 23 11:04:02 2010
@@ -490,34 +490,6 @@
 
         # readline
         do_readline = self.compiler_obj.find_library_file(lib_dirs, 'readline')
-        readline_curses_library = ""
-        curses_library = ""
-        # Determine if readline is already linked against curses:
-        if do_readline and platform != 'darwin': # OS X does not have ldd.
-            # Cannot use os.popen here in py3k.
-            tmpfile = os.path.join(self.build_temp, 'readline_curses_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_curses_library = re.sub(
-                        r'.*lib(n?cursesw?)\.so.*', r'\1', ln
-                    ).rstrip()
-                    break
-            fp.close()
-            os.unlink(tmpfile)
-        # Issue 7384: Use the same library for the readline and curses modules.
-        if readline_curses_library:
-            curses_library = readline_curses_library
-        elif self.compiler_obj.find_library_file(lib_dirs, 'ncursesw'):
-            curses_library = 'ncursesw'
-        elif self.compiler_obj.find_library_file(lib_dirs, 'ncurses'):
-            curses_library = 'ncurses'
-        elif self.compiler_obj.find_library_file(lib_dirs, 'curses'):
-            curses_library = 'curses'
-
         if platform == 'darwin':
             os_release = int(os.uname()[2].split('.')[0])
             dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
@@ -541,10 +513,14 @@
                 readline_extra_link_args = ()
 
             readline_libs = ['readline']
-            if readline_curses_library:
-                pass # Issue 7384: already linked against curses
-            elif curses_library:
-                readline_libs.append(curses_library)
+            if self.compiler_obj.find_library_file(lib_dirs,
+                                                   'ncursesw'):
+                readline_libs.append('ncursesw')
+            elif self.compiler_obj.find_library_file(lib_dirs,
+                                                     'ncurses'):
+                readline_libs.append('ncurses')
+            elif self.compiler_obj.find_library_file(lib_dirs, 'curses'):
+                readline_libs.append('curses')
             elif self.compiler_obj.find_library_file(lib_dirs +
                                                      ['/usr/lib/termcap'],
                                                      'termcap'):
@@ -1033,15 +1009,19 @@
         # Curses support, requiring the System V version of curses, often
         # provided by the ncurses library.
         panel_library = 'panel'
-        if curses_library.startswith('ncurses'):
-            if curses_library == 'ncursesw':
-                # Bug 1464056: If _curses.so links with ncursesw,
-                # _curses_panel.so must link with panelw.
-                panel_library = 'panelw'
-            curses_libs = [curses_library]
+        if (self.compiler_obj.find_library_file(lib_dirs, 'ncursesw')):
+            curses_libs = ['ncursesw']
+            # Bug 1464056: If _curses.so links with ncursesw,
+            # _curses_panel.so must link with panelw.
+            panel_library = 'panelw'
+            exts.append( Extension('_curses', ['_cursesmodule.c'],
+                                   libraries = curses_libs) )
+        elif (self.compiler_obj.find_library_file(lib_dirs, 'ncurses')):
+            curses_libs = ['ncurses']
             exts.append( Extension('_curses', ['_cursesmodule.c'],
                                    libraries = curses_libs) )
-        elif curses_library == 'curses' and platform != 'darwin':
+        elif (self.compiler_obj.find_library_file(lib_dirs, 'curses')
+              and platform != 'darwin'):
                 # OSX has an old Berkeley curses, not good enough for
                 # the _curses module.
             if (self.compiler_obj.find_library_file(lib_dirs, 'terminfo')):


More information about the Python-checkins mailing list