Andrew M. Kuchling | 66012fe | 2001-01-26 21:56:58 +0000 | [diff] [blame] | 1 | # Autodetecting setup.py script for building the Python extensions |
| 2 | # |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 3 | # To be fixed: |
| 4 | # Implement --disable-modules setting |
Andrew M. Kuchling | 66012fe | 2001-01-26 21:56:58 +0000 | [diff] [blame] | 5 | # |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 6 | |
Andrew M. Kuchling | 66012fe | 2001-01-26 21:56:58 +0000 | [diff] [blame] | 7 | __version__ = "$Revision$" |
| 8 | |
| 9 | import sys, os, getopt |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 10 | from distutils import sysconfig |
Andrew M. Kuchling | 8d7f086 | 2001-02-23 16:32:32 +0000 | [diff] [blame] | 11 | from distutils import text_file |
Marc-André Lemburg | 7c6fcda | 2001-01-26 18:03:24 +0000 | [diff] [blame] | 12 | from distutils.errors import * |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 13 | from distutils.core import Extension, setup |
| 14 | from distutils.command.build_ext import build_ext |
| 15 | |
| 16 | # This global variable is used to hold the list of modules to be disabled. |
| 17 | disabled_module_list = [] |
| 18 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 19 | def find_file(filename, std_dirs, paths): |
| 20 | """Searches for the directory where a given file is located, |
| 21 | and returns a possibly-empty list of additional directories, or None |
| 22 | if the file couldn't be found at all. |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 23 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 24 | 'filename' is the name of a file, such as readline.h or libcrypto.a. |
| 25 | 'std_dirs' is the list of standard system directories; if the |
| 26 | file is found in one of them, no additional directives are needed. |
| 27 | 'paths' is a list of additional locations to check; if the file is |
| 28 | found in one of them, the resulting list will contain the directory. |
| 29 | """ |
| 30 | |
| 31 | # Check the standard locations |
| 32 | for dir in std_dirs: |
| 33 | f = os.path.join(dir, filename) |
| 34 | if os.path.exists(f): return [] |
| 35 | |
| 36 | # Check the additional directories |
| 37 | for dir in paths: |
| 38 | f = os.path.join(dir, filename) |
| 39 | if os.path.exists(f): |
| 40 | return [dir] |
| 41 | |
| 42 | # Not found anywhere |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 43 | return None |
| 44 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 45 | def find_library_file(compiler, libname, std_dirs, paths): |
| 46 | filename = compiler.library_filename(libname, lib_type='shared') |
| 47 | result = find_file(filename, std_dirs, paths) |
| 48 | if result is not None: return result |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 49 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 50 | filename = compiler.library_filename(libname, lib_type='static') |
| 51 | result = find_file(filename, std_dirs, paths) |
| 52 | return result |
| 53 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 54 | def module_enabled(extlist, modname): |
| 55 | """Returns whether the module 'modname' is present in the list |
| 56 | of extensions 'extlist'.""" |
| 57 | extlist = [ext for ext in extlist if ext.name == modname] |
| 58 | return len(extlist) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 59 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 60 | class PyBuildExt(build_ext): |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 61 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 62 | def build_extensions(self): |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 63 | |
| 64 | # Detect which modules should be compiled |
| 65 | self.detect_modules() |
| 66 | |
| 67 | # Remove modules that are present on the disabled list |
| 68 | self.extensions = [ext for ext in self.extensions |
| 69 | if ext.name not in disabled_module_list] |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 70 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 71 | # Fix up the autodetected modules, prefixing all the source files |
| 72 | # with Modules/ and adding Python's include directory to the path. |
| 73 | (srcdir,) = sysconfig.get_config_vars('srcdir') |
| 74 | |
Neil Schemenauer | 726b78e | 2001-01-24 17:18:21 +0000 | [diff] [blame] | 75 | # Figure out the location of the source code for extension modules |
| 76 | moddir = os.path.join(os.getcwd(), srcdir, 'Modules') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 77 | moddir = os.path.normpath(moddir) |
| 78 | srcdir, tail = os.path.split(moddir) |
| 79 | srcdir = os.path.normpath(srcdir) |
| 80 | moddir = os.path.normpath(moddir) |
| 81 | |
Andrew M. Kuchling | 3da989c | 2001-02-28 22:49:26 +0000 | [diff] [blame] | 82 | # Fix up the paths for scripts, too |
| 83 | self.distribution.scripts = [os.path.join(srcdir, filename) |
| 84 | for filename in self.distribution.scripts] |
| 85 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 86 | for ext in self.extensions[:]: |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 87 | ext.sources = [ os.path.join(moddir, filename) |
| 88 | for filename in ext.sources ] |
| 89 | ext.include_dirs.append( '.' ) # to get config.h |
Andrew M. Kuchling | e3d6e41 | 2001-01-19 02:50:34 +0000 | [diff] [blame] | 90 | ext.include_dirs.append( os.path.join(srcdir, './Include') ) |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 91 | |
Andrew M. Kuchling | e7c8732 | 2001-01-19 16:58:21 +0000 | [diff] [blame] | 92 | # If a module has already been built statically, |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 93 | # don't build it here |
Andrew M. Kuchling | e7c8732 | 2001-01-19 16:58:21 +0000 | [diff] [blame] | 94 | if ext.name in sys.builtin_module_names: |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 95 | self.extensions.remove(ext) |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 96 | |
Andrew M. Kuchling | 8d7f086 | 2001-02-23 16:32:32 +0000 | [diff] [blame] | 97 | # Parse Modules/Setup to figure out which modules are turned |
| 98 | # on in the file. |
| 99 | input = text_file.TextFile('Modules/Setup', join_lines=1) |
| 100 | remove_modules = [] |
| 101 | while 1: |
| 102 | line = input.readline() |
| 103 | if not line: break |
| 104 | line = line.split() |
| 105 | remove_modules.append( line[0] ) |
| 106 | input.close() |
| 107 | |
| 108 | for ext in self.extensions[:]: |
| 109 | if ext.name in remove_modules: |
| 110 | self.extensions.remove(ext) |
| 111 | |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 112 | # When you run "make CC=altcc" or something similar, you really want |
| 113 | # those environment variables passed into the setup.py phase. Here's |
| 114 | # a small set of useful ones. |
| 115 | compiler = os.environ.get('CC') |
| 116 | linker_so = os.environ.get('LDSHARED') |
| 117 | args = {} |
| 118 | # unfortunately, distutils doesn't let us provide separate C and C++ |
| 119 | # compilers |
| 120 | if compiler is not None: |
| 121 | args['compiler_so'] = compiler |
| 122 | if linker_so is not None: |
| 123 | args['linker_so'] = linker_so + ' -shared' |
| 124 | self.compiler.set_executables(**args) |
| 125 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 126 | build_ext.build_extensions(self) |
| 127 | |
Marc-André Lemburg | 7c6fcda | 2001-01-26 18:03:24 +0000 | [diff] [blame] | 128 | def build_extension(self, ext): |
| 129 | |
| 130 | try: |
| 131 | build_ext.build_extension(self, ext) |
| 132 | except (CCompilerError, DistutilsError), why: |
| 133 | self.announce('WARNING: building of extension "%s" failed: %s' % |
| 134 | (ext.name, sys.exc_info()[1])) |
| 135 | |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 136 | def get_platform (self): |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 137 | # Get value of sys.platform |
| 138 | platform = sys.platform |
| 139 | if platform[:6] =='cygwin': |
| 140 | platform = 'cygwin' |
Andrew M. Kuchling | 3c04494 | 2001-02-06 23:37:23 +0000 | [diff] [blame] | 141 | elif platform[:4] =='beos': |
| 142 | platform = 'beos' |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 143 | |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 144 | return platform |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 145 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 146 | def detect_modules(self): |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 147 | # Ensure that /usr/local is always used |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 148 | if '/usr/local/lib' not in self.compiler.library_dirs: |
Andrew M. Kuchling | 9b5abcd | 2001-03-17 16:56:35 +0000 | [diff] [blame] | 149 | self.compiler.library_dirs.insert(0, '/usr/local/lib') |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 150 | if '/usr/local/include' not in self.compiler.include_dirs: |
Andrew M. Kuchling | 9b5abcd | 2001-03-17 16:56:35 +0000 | [diff] [blame] | 151 | self.compiler.include_dirs.insert(0, '/usr/local/include' ) |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 152 | |
| 153 | # lib_dirs and inc_dirs are used to search for files; |
| 154 | # if a file is found in one of those directories, it can |
| 155 | # be assumed that no additional -I,-L directives are needed. |
| 156 | lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib'] |
Andrew M. Kuchling | 9b5abcd | 2001-03-17 16:56:35 +0000 | [diff] [blame] | 157 | inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 158 | exts = [] |
| 159 | |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 160 | platform = self.get_platform() |
Andrew M. Kuchling | 9b5abcd | 2001-03-17 16:56:35 +0000 | [diff] [blame] | 161 | |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 162 | # Check for MacOS X, which doesn't need libm.a at all |
| 163 | math_libs = ['m'] |
Andrew M. Kuchling | 3c04494 | 2001-02-06 23:37:23 +0000 | [diff] [blame] | 164 | if platform in ['Darwin1.2', 'beos']: |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 165 | math_libs = [] |
Andrew M. Kuchling | 5ddb25f | 2001-01-23 22:21:11 +0000 | [diff] [blame] | 166 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 167 | # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| 168 | |
| 169 | # |
| 170 | # The following modules are all pretty straightforward, and compile |
| 171 | # on pretty much any POSIXish platform. |
| 172 | # |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 173 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 174 | # Some modules that are normally always on: |
| 175 | exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) |
| 176 | exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 177 | |
Fred Drake | 2de7471 | 2001-02-01 05:26:54 +0000 | [diff] [blame] | 178 | exts.append( Extension('_weakref', ['_weakref.c']) ) |
Jeremy Hylton | 5e7cb24 | 2001-02-02 18:24:26 +0000 | [diff] [blame] | 179 | exts.append( Extension('_symtable', ['symtablemodule.c']) ) |
Andrew M. Kuchling | d5c4306 | 2001-01-17 15:59:25 +0000 | [diff] [blame] | 180 | exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 181 | |
| 182 | # array objects |
| 183 | exts.append( Extension('array', ['arraymodule.c']) ) |
| 184 | # complex math library functions |
Andrew M. Kuchling | 5ddb25f | 2001-01-23 22:21:11 +0000 | [diff] [blame] | 185 | exts.append( Extension('cmath', ['cmathmodule.c'], |
| 186 | libraries=math_libs) ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 187 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 188 | # math library functions, e.g. sin() |
Andrew M. Kuchling | 5ddb25f | 2001-01-23 22:21:11 +0000 | [diff] [blame] | 189 | exts.append( Extension('math', ['mathmodule.c'], |
| 190 | libraries=math_libs) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 191 | # fast string operations implemented in C |
| 192 | exts.append( Extension('strop', ['stropmodule.c']) ) |
| 193 | # time operations and variables |
Andrew M. Kuchling | 5ddb25f | 2001-01-23 22:21:11 +0000 | [diff] [blame] | 194 | exts.append( Extension('time', ['timemodule.c'], |
| 195 | libraries=math_libs) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 196 | # operator.add() and similar goodies |
| 197 | exts.append( Extension('operator', ['operator.c']) ) |
| 198 | # access to the builtin codecs and codec registry |
| 199 | exts.append( Extension('_codecs', ['_codecsmodule.c']) ) |
Marc-André Lemburg | 261b8e2 | 2001-02-02 12:12:44 +0000 | [diff] [blame] | 200 | # Python C API test module |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 201 | exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 202 | # static Unicode character database |
Marc-André Lemburg | 14970be | 2001-01-22 10:38:27 +0000 | [diff] [blame] | 203 | exts.append( Extension('unicodedata', ['unicodedata.c']) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 204 | # access to ISO C locale support |
| 205 | exts.append( Extension('_locale', ['_localemodule.c']) ) |
| 206 | |
| 207 | # Modules with some UNIX dependencies -- on by default: |
| 208 | # (If you have a really backward UNIX, select and socket may not be |
| 209 | # supported...) |
| 210 | |
| 211 | # fcntl(2) and ioctl(2) |
| 212 | exts.append( Extension('fcntl', ['fcntlmodule.c']) ) |
| 213 | # pwd(3) |
| 214 | exts.append( Extension('pwd', ['pwdmodule.c']) ) |
| 215 | # grp(3) |
| 216 | exts.append( Extension('grp', ['grpmodule.c']) ) |
| 217 | # posix (UNIX) errno values |
| 218 | exts.append( Extension('errno', ['errnomodule.c']) ) |
| 219 | # select(2); not on ancient System V |
| 220 | exts.append( Extension('select', ['selectmodule.c']) ) |
| 221 | |
| 222 | # The md5 module implements the RSA Data Security, Inc. MD5 |
| 223 | # Message-Digest Algorithm, described in RFC 1321. The necessary files |
| 224 | # md5c.c and md5.h are included here. |
| 225 | exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) |
| 226 | |
| 227 | # The sha module implements the SHA checksum algorithm. |
| 228 | # (NIST's Secure Hash Algorithm.) |
| 229 | exts.append( Extension('sha', ['shamodule.c']) ) |
| 230 | |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 231 | # Tommy Burnette's 'new' module (creates new empty objects of certain |
| 232 | # kinds): |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 233 | exts.append( Extension('new', ['newmodule.c']) ) |
| 234 | |
| 235 | # Helper module for various ascii-encoders |
| 236 | exts.append( Extension('binascii', ['binascii.c']) ) |
| 237 | |
| 238 | # Fred Drake's interface to the Python parser |
| 239 | exts.append( Extension('parser', ['parsermodule.c']) ) |
| 240 | |
| 241 | # Digital Creations' cStringIO and cPickle |
| 242 | exts.append( Extension('cStringIO', ['cStringIO.c']) ) |
| 243 | exts.append( Extension('cPickle', ['cPickle.c']) ) |
| 244 | |
| 245 | # Memory-mapped files (also works on Win32). |
| 246 | exts.append( Extension('mmap', ['mmapmodule.c']) ) |
| 247 | |
| 248 | # Lance Ellinghaus's modules: |
| 249 | # enigma-inspired encryption |
| 250 | exts.append( Extension('rotor', ['rotormodule.c']) ) |
| 251 | # syslog daemon interface |
| 252 | exts.append( Extension('syslog', ['syslogmodule.c']) ) |
| 253 | |
| 254 | # George Neville-Neil's timing module: |
| 255 | exts.append( Extension('timing', ['timingmodule.c']) ) |
| 256 | |
| 257 | # |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 258 | # Here ends the simple stuff. From here on, modules need certain |
| 259 | # libraries, are platform-specific, or present other surprises. |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 260 | # |
| 261 | |
| 262 | # Multimedia modules |
| 263 | # These don't work for 64-bit platforms!!! |
| 264 | # These represent audio samples or images as strings: |
| 265 | |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 266 | # Disabled on 64-bit platforms |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 267 | if sys.maxint != 9223372036854775807L: |
| 268 | # Operations on audio samples |
| 269 | exts.append( Extension('audioop', ['audioop.c']) ) |
| 270 | # Operations on images |
| 271 | exts.append( Extension('imageop', ['imageop.c']) ) |
| 272 | # Read SGI RGB image files (but coded portably) |
| 273 | exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) |
| 274 | |
| 275 | # readline |
Marc-André Lemburg | 2efc323 | 2001-01-26 18:23:02 +0000 | [diff] [blame] | 276 | if self.compiler.find_library_file(lib_dirs, 'readline'): |
| 277 | readline_libs = ['readline'] |
| 278 | if self.compiler.find_library_file(lib_dirs + |
| 279 | ['/usr/lib/termcap'], |
| 280 | 'termcap'): |
| 281 | readline_libs.append('termcap') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 282 | exts.append( Extension('readline', ['readline.c'], |
Marc-André Lemburg | 7c6fcda | 2001-01-26 18:03:24 +0000 | [diff] [blame] | 283 | library_dirs=['/usr/lib/termcap'], |
Marc-André Lemburg | 2efc323 | 2001-01-26 18:23:02 +0000 | [diff] [blame] | 284 | libraries=readline_libs) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 285 | |
| 286 | # The crypt module is now disabled by default because it breaks builds |
| 287 | # on many systems (where -lcrypt is needed), e.g. Linux (I believe). |
| 288 | |
| 289 | if self.compiler.find_library_file(lib_dirs, 'crypt'): |
| 290 | libs = ['crypt'] |
| 291 | else: |
| 292 | libs = [] |
| 293 | exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) |
| 294 | |
| 295 | # socket(2) |
| 296 | # Detect SSL support for the socket module |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 297 | ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
Andrew M. Kuchling | e7c8732 | 2001-01-19 16:58:21 +0000 | [diff] [blame] | 298 | ['/usr/local/ssl/include', |
| 299 | '/usr/contrib/ssl/include/' |
| 300 | ] |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 301 | ) |
| 302 | ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, |
Andrew M. Kuchling | e7c8732 | 2001-01-19 16:58:21 +0000 | [diff] [blame] | 303 | ['/usr/local/ssl/lib', |
| 304 | '/usr/contrib/ssl/lib/' |
| 305 | ] ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 306 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 307 | if (ssl_incs is not None and |
| 308 | ssl_libs is not None): |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 309 | exts.append( Extension('_socket', ['socketmodule.c'], |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 310 | include_dirs = ssl_incs, |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 311 | library_dirs = ssl_libs, |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 312 | libraries = ['ssl', 'crypto'], |
| 313 | define_macros = [('USE_SSL',1)] ) ) |
| 314 | else: |
| 315 | exts.append( Extension('_socket', ['socketmodule.c']) ) |
| 316 | |
| 317 | # Modules that provide persistent dictionary-like semantics. You will |
| 318 | # probably want to arrange for at least one of them to be available on |
| 319 | # your machine, though none are defined by default because of library |
| 320 | # dependencies. The Python module anydbm.py provides an |
| 321 | # implementation independent wrapper for these; dumbdbm.py provides |
| 322 | # similar functionality (but slower of course) implemented in Python. |
| 323 | |
| 324 | # The standard Unix dbm module: |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 325 | if platform not in ['cygwin']: |
| 326 | if (self.compiler.find_library_file(lib_dirs, 'ndbm')): |
| 327 | exts.append( Extension('dbm', ['dbmmodule.c'], |
| 328 | libraries = ['ndbm'] ) ) |
| 329 | else: |
| 330 | exts.append( Extension('dbm', ['dbmmodule.c']) ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 331 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 332 | # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: |
| 333 | if (self.compiler.find_library_file(lib_dirs, 'gdbm')): |
| 334 | exts.append( Extension('gdbm', ['gdbmmodule.c'], |
| 335 | libraries = ['gdbm'] ) ) |
| 336 | |
| 337 | # Berkeley DB interface. |
| 338 | # |
| 339 | # This requires the Berkeley DB code, see |
| 340 | # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz |
| 341 | # |
| 342 | # Edit the variables DB and DBPORT to point to the db top directory |
| 343 | # and the subdirectory of PORT where you built it. |
| 344 | # |
| 345 | # (See http://electricrain.com/greg/python/bsddb3/ for an interface to |
| 346 | # BSD DB 3.x.) |
| 347 | |
Andrew M. Kuchling | e06337a | 2001-02-23 16:27:48 +0000 | [diff] [blame] | 348 | dblib = [] |
| 349 | if self.compiler.find_library_file(lib_dirs, 'db'): |
| 350 | dblib = ['db'] |
| 351 | |
| 352 | db185_incs = find_file('db_185.h', inc_dirs, |
| 353 | ['/usr/include/db3', '/usr/include/db2']) |
| 354 | db_inc = find_file('db.h', inc_dirs, ['/usr/include/db1']) |
| 355 | if db185_incs is not None: |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 356 | exts.append( Extension('bsddb', ['bsddbmodule.c'], |
Andrew M. Kuchling | e06337a | 2001-02-23 16:27:48 +0000 | [diff] [blame] | 357 | include_dirs = db185_incs, |
| 358 | define_macros=[('HAVE_DB_185_H',1)], |
| 359 | libraries = dblib ) ) |
| 360 | elif db_inc is not None: |
| 361 | exts.append( Extension('bsddb', ['bsddbmodule.c'], |
| 362 | include_dirs = db_inc, |
| 363 | libraries = dblib) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 364 | |
| 365 | # The mpz module interfaces to the GNU Multiple Precision library. |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 366 | # You need to ftp the GNU MP library. |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 367 | # This was originally written and tested against GMP 1.2 and 1.3.2. |
| 368 | # It has been modified by Rob Hooft to work with 2.0.2 as well, but I |
| 369 | # haven't tested it recently. For a more complete module, |
| 370 | # refer to pympz.sourceforge.net. |
| 371 | |
| 372 | # A compatible MP library unencombered by the GPL also exists. It was |
| 373 | # posted to comp.sources.misc in volume 40 and is widely available from |
| 374 | # FTP archive sites. One URL for it is: |
| 375 | # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z |
| 376 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 377 | if (self.compiler.find_library_file(lib_dirs, 'gmp')): |
| 378 | exts.append( Extension('mpz', ['mpzmodule.c'], |
| 379 | libraries = ['gmp'] ) ) |
| 380 | |
| 381 | |
| 382 | # Unix-only modules |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 383 | if platform not in ['mac', 'win32']: |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 384 | # Steen Lumholt's termios module |
| 385 | exts.append( Extension('termios', ['termios.c']) ) |
| 386 | # Jeremy Hylton's rlimit interface |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 387 | if platform not in ['cygwin']: |
| 388 | exts.append( Extension('resource', ['resource.c']) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 389 | |
Andrew M. Kuchling | cf393f3 | 2001-02-21 02:38:24 +0000 | [diff] [blame] | 390 | # Generic dynamic loading module |
Andrew M. Kuchling | 5dfa137 | 2001-03-02 06:24:14 +0000 | [diff] [blame] | 391 | #exts.append( Extension('dl', ['dlmodule.c']) ) |
Andrew M. Kuchling | cf393f3 | 2001-02-21 02:38:24 +0000 | [diff] [blame] | 392 | |
| 393 | # Sun yellow pages. Some systems have the functions in libc. |
Andrew M. Kuchling | 6efc6e7 | 2001-02-27 20:54:23 +0000 | [diff] [blame] | 394 | if platform not in ['cygwin']: |
| 395 | if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
| 396 | libs = ['nsl'] |
| 397 | else: |
| 398 | libs = [] |
| 399 | exts.append( Extension('nis', ['nismodule.c'], |
| 400 | libraries = libs) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 401 | |
| 402 | # Curses support, requring the System V version of curses, often |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 403 | # provided by the ncurses library. |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 404 | if platform == 'sunos4': |
Andrew M. Kuchling | b69c758 | 2001-02-28 19:49:57 +0000 | [diff] [blame] | 405 | inc_dirs += ['/usr/5include'] |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 406 | lib_dirs += ['/usr/5lib'] |
| 407 | |
| 408 | if (self.compiler.find_library_file(lib_dirs, 'ncurses')): |
| 409 | curses_libs = ['ncurses'] |
| 410 | exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 411 | libraries = curses_libs) ) |
| 412 | elif (self.compiler.find_library_file(lib_dirs, 'curses')): |
| 413 | if (self.compiler.find_library_file(lib_dirs, 'terminfo')): |
| 414 | curses_libs = ['curses', 'terminfo'] |
| 415 | else: |
| 416 | curses_libs = ['curses', 'termcap'] |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 417 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 418 | exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 419 | libraries = curses_libs) ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 420 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 421 | # If the curses module is enabled, check for the panel module |
| 422 | if (os.path.exists('Modules/_curses_panel.c') and |
| 423 | module_enabled(exts, '_curses') and |
| 424 | self.compiler.find_library_file(lib_dirs, 'panel')): |
| 425 | exts.append( Extension('_curses_panel', ['_curses_panel.c'], |
| 426 | libraries = ['panel'] + curses_libs) ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 427 | |
| 428 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 429 | |
| 430 | # Lee Busby's SIGFPE modules. |
| 431 | # The library to link fpectl with is platform specific. |
| 432 | # Choose *one* of the options below for fpectl: |
| 433 | |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 434 | if platform == 'irix5': |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 435 | # For SGI IRIX (tested on 5.3): |
| 436 | exts.append( Extension('fpectl', ['fpectlmodule.c'], |
| 437 | libraries=['fpe']) ) |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 438 | elif 0: # XXX how to detect SunPro? |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 439 | # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): |
| 440 | # (Without the compiler you don't have -lsunmath.) |
| 441 | #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm |
| 442 | pass |
| 443 | else: |
| 444 | # For other systems: see instructions in fpectlmodule.c. |
| 445 | #fpectl fpectlmodule.c ... |
| 446 | exts.append( Extension('fpectl', ['fpectlmodule.c']) ) |
| 447 | |
| 448 | |
| 449 | # Andrew Kuchling's zlib module. |
| 450 | # This require zlib 1.1.3 (or later). |
| 451 | # See http://www.cdrom.com/pub/infozip/zlib/ |
| 452 | if (self.compiler.find_library_file(lib_dirs, 'z')): |
| 453 | exts.append( Extension('zlib', ['zlibmodule.c'], |
| 454 | libraries = ['z']) ) |
| 455 | |
| 456 | # Interface to the Expat XML parser |
| 457 | # |
| 458 | # Expat is written by James Clark and must be downloaded separately |
| 459 | # (see below). The pyexpat module was written by Paul Prescod after a |
| 460 | # prototype by Jack Jansen. |
| 461 | # |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 462 | # The Expat dist includes Windows .lib and .dll files. Home page is |
| 463 | # at http://www.jclark.com/xml/expat.html, the current production |
| 464 | # release is always ftp://ftp.jclark.com/pub/xml/expat.zip. |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 465 | # |
| 466 | # EXPAT_DIR, below, should point to the expat/ directory created by |
| 467 | # unpacking the Expat source distribution. |
| 468 | # |
Andrew M. Kuchling | 5bbc7b9 | 2001-01-18 20:39:34 +0000 | [diff] [blame] | 469 | # Note: the expat build process doesn't yet build a libexpat.a; you |
| 470 | # can do this manually while we try convince the author to add it. To |
| 471 | # do so, cd to EXPAT_DIR, run "make" if you have not done so, then |
| 472 | # run: |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 473 | # |
| 474 | # ar cr libexpat.a xmltok/*.o xmlparse/*.o |
| 475 | # |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 476 | expat_defs = [] |
| 477 | expat_incs = find_file('expat.h', inc_dirs, []) |
| 478 | if expat_incs is not None: |
| 479 | # expat.h was found |
| 480 | expat_defs = [('HAVE_EXPAT_H', 1)] |
| 481 | else: |
| 482 | expat_incs = find_file('xmlparse.h', inc_dirs, []) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 483 | |
Martin v. Löwis | 1ab29b2 | 2001-01-21 10:54:52 +0000 | [diff] [blame] | 484 | if (expat_incs is not None and |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 485 | self.compiler.find_library_file(lib_dirs, 'expat')): |
| 486 | exts.append( Extension('pyexpat', ['pyexpat.c'], |
| 487 | define_macros = expat_defs, |
| 488 | libraries = ['expat']) ) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 489 | |
| 490 | # Platform-specific libraries |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 491 | if platform == 'linux2': |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 492 | # Linux-specific modules |
| 493 | exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) |
| 494 | |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 495 | if platform == 'sunos5': |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 496 | # SunOS specific modules |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 497 | exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) |
| 498 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 499 | self.extensions.extend(exts) |
| 500 | |
| 501 | # Call the method for detecting whether _tkinter can be compiled |
| 502 | self.detect_tkinter(inc_dirs, lib_dirs) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 503 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 504 | |
| 505 | def detect_tkinter(self, inc_dirs, lib_dirs): |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 506 | # The _tkinter module. |
Martin v. Löwis | b1d1969 | 2001-03-21 07:44:53 +0000 | [diff] [blame] | 507 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 508 | # Assume we haven't found any of the libraries or include files |
| 509 | tcllib = tklib = tcl_includes = tk_includes = None |
Andrew M. Kuchling | d5c4306 | 2001-01-17 15:59:25 +0000 | [diff] [blame] | 510 | for version in ['8.4', '8.3', '8.2', '8.1', '8.0']: |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 511 | tklib = self.compiler.find_library_file(lib_dirs, |
| 512 | 'tk' + version ) |
| 513 | tcllib = self.compiler.find_library_file(lib_dirs, |
| 514 | 'tcl' + version ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 515 | if tklib and tcllib: |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 516 | # Exit the loop when we've found the Tcl/Tk libraries |
| 517 | break |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 518 | |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 519 | # Now check for the header files |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 520 | if tklib and tcllib: |
| 521 | # Check for the include files on Debian, where |
| 522 | # they're put in /usr/include/{tcl,tk}X.Y |
Andrew M. Kuchling | 9a3fd8c | 2001-02-06 22:15:27 +0000 | [diff] [blame] | 523 | debian_tcl_include = [ '/usr/include/tcl' + version ] |
| 524 | debian_tk_include = [ '/usr/include/tk' + version ] + debian_tcl_include |
| 525 | tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) |
| 526 | tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 527 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 528 | if (tcllib is None or tklib is None and |
| 529 | tcl_includes is None or tk_includes is None): |
| 530 | # Something's missing, so give up |
| 531 | return |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 532 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 533 | # OK... everything seems to be present for Tcl/Tk. |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 534 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 535 | include_dirs = [] ; libs = [] ; defs = [] ; added_lib_dirs = [] |
| 536 | for dir in tcl_includes + tk_includes: |
| 537 | if dir not in include_dirs: |
| 538 | include_dirs.append(dir) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 539 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 540 | # Check for various platform-specific directories |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 541 | platform = self.get_platform() |
| 542 | if platform == 'sunos5': |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 543 | include_dirs.append('/usr/openwin/include') |
| 544 | added_lib_dirs.append('/usr/openwin/lib') |
| 545 | elif os.path.exists('/usr/X11R6/include'): |
| 546 | include_dirs.append('/usr/X11R6/include') |
| 547 | added_lib_dirs.append('/usr/X11R6/lib') |
| 548 | elif os.path.exists('/usr/X11R5/include'): |
| 549 | include_dirs.append('/usr/X11R5/include') |
| 550 | added_lib_dirs.append('/usr/X11R5/lib') |
| 551 | else: |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 552 | # Assume default location for X11 |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 553 | include_dirs.append('/usr/X11/include') |
| 554 | added_lib_dirs.append('/usr/X11/lib') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 555 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 556 | # Check for BLT extension |
| 557 | if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 'BLT8.0'): |
| 558 | defs.append( ('WITH_BLT', 1) ) |
| 559 | libs.append('BLT8.0') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 560 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 561 | # Add the Tcl/Tk libraries |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 562 | libs.append('tk'+version) |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 563 | libs.append('tcl'+version) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 564 | |
Andrew M. Kuchling | 34febf5 | 2001-01-24 03:31:07 +0000 | [diff] [blame] | 565 | if platform in ['aix3', 'aix4']: |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 566 | libs.append('ld') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 567 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 568 | # Finally, link with the X11 libraries |
| 569 | libs.append('X11') |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 570 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 571 | ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], |
| 572 | define_macros=[('WITH_APPINIT', 1)] + defs, |
| 573 | include_dirs = include_dirs, |
| 574 | libraries = libs, |
| 575 | library_dirs = added_lib_dirs, |
| 576 | ) |
| 577 | self.extensions.append(ext) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 578 | |
Andrew M. Kuchling | fbe7376 | 2001-01-18 18:44:20 +0000 | [diff] [blame] | 579 | # XXX handle these, but how to detect? |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 580 | # *** Uncomment and edit for PIL (TkImaging) extension only: |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 581 | # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 582 | # *** Uncomment and edit for TOGL extension only: |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 583 | # -DWITH_TOGL togl.c \ |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 584 | # *** Uncomment these for TOGL extension only: |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 585 | # -lGL -lGLU -lXext -lXmu \ |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 586 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 587 | def main(): |
| 588 | setup(name = 'Python standard library', |
Neil Schemenauer | e7e2ece | 2001-01-17 21:58:00 +0000 | [diff] [blame] | 589 | version = '%d.%d' % sys.version_info[:2], |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 590 | cmdclass = {'build_ext':PyBuildExt}, |
| 591 | # The struct module is defined here, because build_ext won't be |
| 592 | # called unless there's at least one extension module defined. |
Andrew M. Kuchling | aece427 | 2001-02-28 20:56:49 +0000 | [diff] [blame] | 593 | ext_modules=[Extension('struct', ['structmodule.c'])], |
| 594 | |
| 595 | # Scripts to install |
| 596 | scripts = ['Tools/scripts/pydoc'] |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 597 | ) |
Fredrik Lundh | ade711a | 2001-01-24 08:00:28 +0000 | [diff] [blame] | 598 | |
Andrew M. Kuchling | 00e0f21 | 2001-01-17 15:23:23 +0000 | [diff] [blame] | 599 | # --install-platlib |
| 600 | if __name__ == '__main__': |
| 601 | sysconfig.set_python_build() |
| 602 | main() |