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