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