$NetBSD: patch-aa,v 1.1.1.1 2002/10/25 10:48:48 drochner Exp $

--- setup.py.orig	Tue Mar 26 08:43:04 2002
+++ setup.py	Tue Sep 24 12:30:40 2002
@@ -197,11 +197,15 @@
         return platform
 
     def detect_modules(self):
-        # Ensure that /usr/local is always used
-        if '/usr/local/lib' not in self.compiler.library_dirs:
-            self.compiler.library_dirs.insert(0, '/usr/local/lib')
-        if '/usr/local/include' not in self.compiler.include_dirs:
-            self.compiler.include_dirs.insert(0, '/usr/local/include' )
+        # Add the buildlink directories for pkgsrc
+        if os.environ.has_key('BUILDLINK_DIR'):
+            dir = os.environ['BUILDLINK_DIR']
+            libdir = dir + '/lib'
+            incdir = dir + '/include'
+            if libdir not in self.compiler.library_dirs:
+                self.compiler.library_dirs.insert(0, libdir)
+            if incdir not in self.compiler.include_dirs:
+                self.compiler.include_dirs.insert(0, incdir)
 
         try:
             have_unicode = unicode
@@ -261,7 +265,7 @@
         if have_unicode:
             exts.append( Extension('unicodedata', ['unicodedata.c']) )
         # access to ISO C locale support
-        exts.append( Extension('_locale', ['_localemodule.c']) )
+#        exts.append( Extension('_locale', ['_localemodule.c']) )
 
         # Modules with some UNIX dependencies -- on by default:
         # (If you have a really backward UNIX, select and socket may not be
@@ -319,16 +323,16 @@
         # These represent audio samples or images as strings:
 
         # Disabled on 64-bit platforms
-        if sys.maxint != 9223372036854775807L:
+#        if sys.maxint != 9223372036854775807L:
             # Operations on audio samples
-            exts.append( Extension('audioop', ['audioop.c']) )
+#            exts.append( Extension('audioop', ['audioop.c']) )
             # Operations on images
-            exts.append( Extension('imageop', ['imageop.c']) )
+#            exts.append( Extension('imageop', ['imageop.c']) )
             # Read SGI RGB image files (but coded portably)
-            exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
+#            exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
 
         # readline
-        if self.compiler.find_library_file(lib_dirs, 'readline'):
+        if 0 and self.compiler.find_library_file(lib_dirs, 'readline'):
             readline_libs = ['readline']
             if self.compiler.find_library_file(lib_dirs,
                                                  'ncurses'):
@@ -352,14 +356,10 @@
         # socket(2)
         # Detect SSL support for the socket module
         ssl_incs = find_file('openssl/ssl.h', inc_dirs,
-                             ['/usr/local/ssl/include',
-                              '/usr/contrib/ssl/include/'
-                             ]
+                             []
                              )
         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
-                                     ['/usr/local/ssl/lib',
-                                      '/usr/contrib/ssl/lib/'
-                                     ] )
+                                     [] )
 
         if (ssl_incs is not None and
             ssl_libs is not None):
@@ -390,9 +390,9 @@
                 exts.append( Extension('dbm', ['dbmmodule.c']) )
 
         # Anthony Baxter's gdbm module.  GNU dbm(3) will require -lgdbm:
-        if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
-            exts.append( Extension('gdbm', ['gdbmmodule.c'],
-                                   libraries = ['gdbm'] ) )
+        #if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
+        #    exts.append( Extension('gdbm', ['gdbmmodule.c'],
+        #                           libraries = ['gdbm'] ) )
 
         # Berkeley DB interface.
         #
@@ -446,9 +446,9 @@
         # FTP archive sites. One URL for it is:
         # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z
 
-        if (self.compiler.find_library_file(lib_dirs, 'gmp')):
-            exts.append( Extension('mpz', ['mpzmodule.c'],
-                                   libraries = ['gmp'] ) )
+        #if (self.compiler.find_library_file(lib_dirs, 'gmp')):
+        #    exts.append( Extension('mpz', ['mpzmodule.c'],
+        #                           libraries = ['gmp'] ) )
 
 
         # Unix-only modules
@@ -475,8 +475,8 @@
 
         if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
             curses_libs = ['ncurses']
-            exts.append( Extension('_curses', ['_cursesmodule.c'],
-                                   libraries = curses_libs) )
+#            exts.append( Extension('_curses', ['_cursesmodule.c'],
+#                                   libraries = curses_libs) )
         elif (self.compiler.find_library_file(lib_dirs, 'curses')
               and platform != 'darwin'):
                 # OSX has an old Berkeley curses, not good enough for
@@ -486,8 +486,8 @@
             else:
                 curses_libs = ['curses', 'termcap']
 
-            exts.append( Extension('_curses', ['_cursesmodule.c'],
-                                   libraries = curses_libs) )
+#            exts.append( Extension('_curses', ['_cursesmodule.c'],
+#                                   libraries = curses_libs) )
 
         # If the curses module is enabled, check for the panel module
         if (module_enabled(exts, '_curses') and
@@ -566,11 +566,11 @@
         else:
             expat_incs = find_file('xmlparse.h', inc_dirs, [])
 
-        if (expat_incs is not None and
-            self.compiler.find_library_file(lib_dirs, 'expat')):
-            exts.append( Extension('pyexpat', ['pyexpat.c'],
-                                   define_macros = expat_defs,
-                                   libraries = ['expat']) )
+        #if (expat_incs is not None and
+        #    self.compiler.find_library_file(lib_dirs, 'expat')):
+        #    exts.append( Extension('pyexpat', ['pyexpat.c'],
+        #                           define_macros = expat_defs,
+        #                           libraries = ['expat']) )
 
         # Platform-specific libraries
         if platform == 'linux2':
@@ -793,7 +793,7 @@
           ext_modules=[Extension('struct', ['structmodule.c'])],
 
           # Scripts to install
-          scripts = ['Tools/scripts/pydoc']
+          scripts = ['Tools/scripts/pydoc2p2']
         )
 
 # --install-platlib
