Mercurial > cpython-lru_cache-weakref
annotate setup.py @ 16842:76a684fe3f7f legacy-trunk
Fix for bug #404875: fix typo in setup.py
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Wed, 28 Feb 2001 19:49:57 +0000 |
| parents | 8156879fe60d |
| children | 8156deb0e62d |
| rev | line source |
|---|---|
|
16287
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
1 # Autodetecting setup.py script for building the Python extensions |
|
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
2 # |
| 15940 | 3 # To be fixed: |
| 4 # Implement --disable-modules setting | |
|
16287
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
5 # |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
6 |
|
16287
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
7 __version__ = "$Revision$" |
|
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
8 |
|
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
9 import sys, os, getopt |
| 15940 | 10 from distutils import sysconfig |
|
16750
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
11 from distutils import text_file |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
12 from distutils.errors import * |
| 15940 | 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 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
19 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
|
20 """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
|
21 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
|
22 if the file couldn't be found at all. |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
23 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
24 '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
|
25 '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
|
26 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
|
27 '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
|
28 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
|
29 """ |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
30 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
31 # 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
|
32 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
|
33 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
|
34 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
|
35 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
36 # 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
|
37 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
|
38 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
|
39 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
|
40 return [dir] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
41 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
42 # Not found anywhere |
| 15940 | 43 return None |
| 44 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 if result is not None: return result |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
49 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
50 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
|
51 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
|
52 return result |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
53 |
| 15940 | 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) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
59 |
| 15940 | 60 class PyBuildExt(build_ext): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
61 |
| 15940 | 62 def build_extensions(self): |
| 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] | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
70 |
| 15940 | 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 | |
|
16225
e56dd2dd9960
Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
16201
diff
changeset
|
75 # Figure out the location of the source code for extension modules |
|
e56dd2dd9960
Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
16201
diff
changeset
|
76 moddir = os.path.join(os.getcwd(), srcdir, 'Modules') |
| 15940 | 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 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
82 for ext in self.extensions[:]: |
| 15940 | 83 ext.sources = [ os.path.join(moddir, filename) |
| 84 for filename in ext.sources ] | |
| 85 ext.include_dirs.append( '.' ) # to get config.h | |
|
16013
9bc754413a8c
Revert a single line of my large change earlier today; this broke the ability
Andrew M. Kuchling <amk@amk.ca>
parents:
15998
diff
changeset
|
86 ext.include_dirs.append( os.path.join(srcdir, './Include') ) |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
87 |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
88 # If a module has already been built statically, |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
89 # don't build it here |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
90 if ext.name in sys.builtin_module_names: |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
91 self.extensions.remove(ext) |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
92 |
|
16750
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
93 # Parse Modules/Setup to figure out which modules are turned |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
94 # on in the file. |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
95 input = text_file.TextFile('Modules/Setup', join_lines=1) |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
96 remove_modules = [] |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
97 while 1: |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
98 line = input.readline() |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
99 if not line: break |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
100 line = line.split() |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
101 remove_modules.append( line[0] ) |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
102 input.close() |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
103 |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
104 for ext in self.extensions[:]: |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
105 if ext.name in remove_modules: |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
106 self.extensions.remove(ext) |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
107 |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
108 # When you run "make CC=altcc" or something similar, you really want |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
109 # those environment variables passed into the setup.py phase. Here's |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
110 # a small set of useful ones. |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
111 compiler = os.environ.get('CC') |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
112 linker_so = os.environ.get('LDSHARED') |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
113 args = {} |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
114 # unfortunately, distutils doesn't let us provide separate C and C++ |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
115 # compilers |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
116 if compiler is not None: |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
117 args['compiler_so'] = compiler |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
118 if linker_so is not None: |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
119 args['linker_so'] = linker_so + ' -shared' |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
120 self.compiler.set_executables(**args) |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
121 |
| 15940 | 122 build_ext.build_extensions(self) |
| 123 | |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
124 def build_extension(self, ext): |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
125 |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
126 try: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
127 build_ext.build_extension(self, ext) |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
128 except (CCompilerError, DistutilsError), why: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
129 self.announce('WARNING: building of extension "%s" failed: %s' % |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
130 (ext.name, sys.exc_info()[1])) |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
131 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
132 def get_platform (self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
133 # Get value of sys.platform |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
134 platform = sys.platform |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
135 if platform[:6] =='cygwin': |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
136 platform = 'cygwin' |
|
16471
ab02bc6a5ab2
BeOS doesn't have a libm.a, either; noted by Donn Cave
Andrew M. Kuchling <amk@amk.ca>
parents:
16468
diff
changeset
|
137 elif platform[:4] =='beos': |
|
ab02bc6a5ab2
BeOS doesn't have a libm.a, either; noted by Donn Cave
Andrew M. Kuchling <amk@amk.ca>
parents:
16468
diff
changeset
|
138 platform = 'beos' |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
139 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
140 return platform |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
141 |
| 15940 | 142 def detect_modules(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
143 # Ensure that /usr/local is always used |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 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
|
148 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
149 # 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
|
150 # 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
|
151 # 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
|
152 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
|
153 inc_dirs = ['/usr/include'] + self.compiler.include_dirs |
| 15940 | 154 exts = [] |
| 155 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
156 platform = self.get_platform() |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
157 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
158 # Check for MacOS X, which doesn't need libm.a at all |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
159 math_libs = ['m'] |
|
16471
ab02bc6a5ab2
BeOS doesn't have a libm.a, either; noted by Donn Cave
Andrew M. Kuchling <amk@amk.ca>
parents:
16468
diff
changeset
|
160 if platform in ['Darwin1.2', 'beos']: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
161 math_libs = [] |
|
16176
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
162 |
| 15940 | 163 # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| 164 | |
| 165 # | |
| 166 # The following modules are all pretty straightforward, and compile | |
| 167 # on pretty much any POSIXish platform. | |
| 168 # | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
169 |
| 15940 | 170 # Some modules that are normally always on: |
| 171 exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) | |
| 172 exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
173 |
|
16384
c898ceba2261
Add entries for the weakref module to the build control.
Fred Drake <fdrake@acm.org>
parents:
16287
diff
changeset
|
174 exts.append( Extension('_weakref', ['_weakref.c']) ) |
|
16422
8b318b8d78c9
Add minimal interface to symtable: _symtable module.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
16416
diff
changeset
|
175 exts.append( Extension('_symtable', ['symtablemodule.c']) ) |
| 15951 | 176 exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) ) |
| 15940 | 177 |
| 178 # array objects | |
| 179 exts.append( Extension('array', ['arraymodule.c']) ) | |
| 180 # complex math library functions | |
|
16176
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
181 exts.append( Extension('cmath', ['cmathmodule.c'], |
|
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
182 libraries=math_libs) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
183 |
| 15940 | 184 # math library functions, e.g. sin() |
|
16176
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
185 exts.append( Extension('math', ['mathmodule.c'], |
|
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
186 libraries=math_libs) ) |
| 15940 | 187 # fast string operations implemented in C |
| 188 exts.append( Extension('strop', ['stropmodule.c']) ) | |
| 189 # time operations and variables | |
|
16176
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
190 exts.append( Extension('time', ['timemodule.c'], |
|
2dcbc1dfca9c
Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents:
16100
diff
changeset
|
191 libraries=math_libs) ) |
| 15940 | 192 # operator.add() and similar goodies |
| 193 exts.append( Extension('operator', ['operator.c']) ) | |
| 194 # access to the builtin codecs and codec registry | |
| 195 exts.append( Extension('_codecs', ['_codecsmodule.c']) ) | |
|
16416
7d39d9dcf2d6
Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents:
16415
diff
changeset
|
196 # Python C API test module |
|
16447
ac52d3727867
Renamed _testXXX to _testcapiXXX. Jack is my hero -- good call!
Tim Peters <tim.peters@gmail.com>
parents:
16422
diff
changeset
|
197 exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) |
| 15940 | 198 # static Unicode character database |
|
16100
ae296229f426
unicodedatabase.c is no longer needed thanks to Fredrik's patches.
Marc-André Lemburg <mal@egenix.com>
parents:
16078
diff
changeset
|
199 exts.append( Extension('unicodedata', ['unicodedata.c']) ) |
| 15940 | 200 # access to ISO C locale support |
| 201 exts.append( Extension('_locale', ['_localemodule.c']) ) | |
| 202 | |
| 203 # Modules with some UNIX dependencies -- on by default: | |
| 204 # (If you have a really backward UNIX, select and socket may not be | |
| 205 # supported...) | |
| 206 | |
| 207 # fcntl(2) and ioctl(2) | |
| 208 exts.append( Extension('fcntl', ['fcntlmodule.c']) ) | |
| 209 # pwd(3) | |
| 210 exts.append( Extension('pwd', ['pwdmodule.c']) ) | |
| 211 # grp(3) | |
| 212 exts.append( Extension('grp', ['grpmodule.c']) ) | |
| 213 # posix (UNIX) errno values | |
| 214 exts.append( Extension('errno', ['errnomodule.c']) ) | |
| 215 # select(2); not on ancient System V | |
| 216 exts.append( Extension('select', ['selectmodule.c']) ) | |
| 217 | |
| 218 # The md5 module implements the RSA Data Security, Inc. MD5 | |
| 219 # Message-Digest Algorithm, described in RFC 1321. The necessary files | |
| 220 # md5c.c and md5.h are included here. | |
| 221 exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) | |
| 222 | |
| 223 # The sha module implements the SHA checksum algorithm. | |
| 224 # (NIST's Secure Hash Algorithm.) | |
| 225 exts.append( Extension('sha', ['shamodule.c']) ) | |
| 226 | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
227 # Tommy Burnette's 'new' module (creates new empty objects of certain |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
228 # kinds): |
| 15940 | 229 exts.append( Extension('new', ['newmodule.c']) ) |
| 230 | |
| 231 # Helper module for various ascii-encoders | |
| 232 exts.append( Extension('binascii', ['binascii.c']) ) | |
| 233 | |
| 234 # Fred Drake's interface to the Python parser | |
| 235 exts.append( Extension('parser', ['parsermodule.c']) ) | |
| 236 | |
| 237 # Digital Creations' cStringIO and cPickle | |
| 238 exts.append( Extension('cStringIO', ['cStringIO.c']) ) | |
| 239 exts.append( Extension('cPickle', ['cPickle.c']) ) | |
| 240 | |
| 241 # Memory-mapped files (also works on Win32). | |
| 242 exts.append( Extension('mmap', ['mmapmodule.c']) ) | |
| 243 | |
| 244 # Lance Ellinghaus's modules: | |
| 245 # enigma-inspired encryption | |
| 246 exts.append( Extension('rotor', ['rotormodule.c']) ) | |
| 247 # syslog daemon interface | |
| 248 exts.append( Extension('syslog', ['syslogmodule.c']) ) | |
| 249 | |
| 250 # George Neville-Neil's timing module: | |
| 251 exts.append( Extension('timing', ['timingmodule.c']) ) | |
| 252 | |
| 253 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
254 # Here ends the simple stuff. From here on, modules need certain |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
255 # libraries, are platform-specific, or present other surprises. |
| 15940 | 256 # |
| 257 | |
| 258 # Multimedia modules | |
| 259 # These don't work for 64-bit platforms!!! | |
| 260 # These represent audio samples or images as strings: | |
| 261 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
262 # Disabled on 64-bit platforms |
| 15940 | 263 if sys.maxint != 9223372036854775807L: |
| 264 # Operations on audio samples | |
| 265 exts.append( Extension('audioop', ['audioop.c']) ) | |
| 266 # Operations on images | |
| 267 exts.append( Extension('imageop', ['imageop.c']) ) | |
| 268 # Read SGI RGB image files (but coded portably) | |
| 269 exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) | |
| 270 | |
| 271 # readline | |
|
16283
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
272 if self.compiler.find_library_file(lib_dirs, 'readline'): |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
273 readline_libs = ['readline'] |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
274 if self.compiler.find_library_file(lib_dirs + |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
275 ['/usr/lib/termcap'], |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
276 'termcap'): |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
277 readline_libs.append('termcap') |
| 15940 | 278 exts.append( Extension('readline', ['readline.c'], |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
279 library_dirs=['/usr/lib/termcap'], |
|
16283
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
280 libraries=readline_libs) ) |
| 15940 | 281 |
| 282 # The crypt module is now disabled by default because it breaks builds | |
| 283 # on many systems (where -lcrypt is needed), e.g. Linux (I believe). | |
| 284 | |
| 285 if self.compiler.find_library_file(lib_dirs, 'crypt'): | |
| 286 libs = ['crypt'] | |
| 287 else: | |
| 288 libs = [] | |
| 289 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) | |
| 290 | |
| 291 # socket(2) | |
| 292 # 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
|
293 ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
294 ['/usr/local/ssl/include', |
|
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
295 '/usr/contrib/ssl/include/' |
|
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
296 ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
297 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
298 ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
299 ['/usr/local/ssl/lib', |
|
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
300 '/usr/contrib/ssl/lib/' |
|
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
301 ] ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
302 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
303 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
|
304 ssl_libs is not None): |
| 15940 | 305 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
|
306 include_dirs = ssl_incs, |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
307 library_dirs = ssl_libs, |
| 15940 | 308 libraries = ['ssl', 'crypto'], |
| 309 define_macros = [('USE_SSL',1)] ) ) | |
| 310 else: | |
| 311 exts.append( Extension('_socket', ['socketmodule.c']) ) | |
| 312 | |
| 313 # Modules that provide persistent dictionary-like semantics. You will | |
| 314 # probably want to arrange for at least one of them to be available on | |
| 315 # your machine, though none are defined by default because of library | |
| 316 # dependencies. The Python module anydbm.py provides an | |
| 317 # implementation independent wrapper for these; dumbdbm.py provides | |
| 318 # similar functionality (but slower of course) implemented in Python. | |
| 319 | |
| 320 # The standard Unix dbm module: | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
321 if platform not in ['cygwin']: |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
322 if (self.compiler.find_library_file(lib_dirs, 'ndbm')): |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
323 exts.append( Extension('dbm', ['dbmmodule.c'], |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
324 libraries = ['ndbm'] ) ) |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
325 else: |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
326 exts.append( Extension('dbm', ['dbmmodule.c']) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
327 |
| 15940 | 328 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: |
| 329 if (self.compiler.find_library_file(lib_dirs, 'gdbm')): | |
| 330 exts.append( Extension('gdbm', ['gdbmmodule.c'], | |
| 331 libraries = ['gdbm'] ) ) | |
| 332 | |
| 333 # Berkeley DB interface. | |
| 334 # | |
| 335 # This requires the Berkeley DB code, see | |
| 336 # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz | |
| 337 # | |
| 338 # Edit the variables DB and DBPORT to point to the db top directory | |
| 339 # and the subdirectory of PORT where you built it. | |
| 340 # | |
| 341 # (See http://electricrain.com/greg/python/bsddb3/ for an interface to | |
| 342 # BSD DB 3.x.) | |
| 343 | |
|
16749
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
344 dblib = [] |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
345 if self.compiler.find_library_file(lib_dirs, 'db'): |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
346 dblib = ['db'] |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
347 |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
348 db185_incs = find_file('db_185.h', inc_dirs, |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
349 ['/usr/include/db3', '/usr/include/db2']) |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
350 db_inc = find_file('db.h', inc_dirs, ['/usr/include/db1']) |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
351 if db185_incs is not None: |
| 15940 | 352 exts.append( Extension('bsddb', ['bsddbmodule.c'], |
|
16749
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
353 include_dirs = db185_incs, |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
354 define_macros=[('HAVE_DB_185_H',1)], |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
355 libraries = dblib ) ) |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
356 elif db_inc is not None: |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
357 exts.append( Extension('bsddb', ['bsddbmodule.c'], |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
358 include_dirs = db_inc, |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
359 libraries = dblib) ) |
| 15940 | 360 |
| 361 # The mpz module interfaces to the GNU Multiple Precision library. | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
362 # You need to ftp the GNU MP library. |
| 15940 | 363 # This was originally written and tested against GMP 1.2 and 1.3.2. |
| 364 # It has been modified by Rob Hooft to work with 2.0.2 as well, but I | |
| 365 # haven't tested it recently. For a more complete module, | |
| 366 # refer to pympz.sourceforge.net. | |
| 367 | |
| 368 # A compatible MP library unencombered by the GPL also exists. It was | |
| 369 # posted to comp.sources.misc in volume 40 and is widely available from | |
| 370 # FTP archive sites. One URL for it is: | |
| 371 # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z | |
| 372 | |
| 373 if (self.compiler.find_library_file(lib_dirs, 'gmp')): | |
| 374 exts.append( Extension('mpz', ['mpzmodule.c'], | |
| 375 libraries = ['gmp'] ) ) | |
| 376 | |
| 377 | |
| 378 # Unix-only modules | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
379 if platform not in ['mac', 'win32']: |
| 15940 | 380 # Steen Lumholt's termios module |
| 381 exts.append( Extension('termios', ['termios.c']) ) | |
| 382 # Jeremy Hylton's rlimit interface | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
383 if platform not in ['cygwin']: |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
384 exts.append( Extension('resource', ['resource.c']) ) |
| 15940 | 385 |
|
16721
4db0fddb6917
Patch #103544: always compile the dl and nis modules on Unix; let's see
Andrew M. Kuchling <amk@amk.ca>
parents:
16471
diff
changeset
|
386 # Generic dynamic loading module |
|
4db0fddb6917
Patch #103544: always compile the dl and nis modules on Unix; let's see
Andrew M. Kuchling <amk@amk.ca>
parents:
16471
diff
changeset
|
387 exts.append( Extension('dl', ['dlmodule.c']) ) |
|
4db0fddb6917
Patch #103544: always compile the dl and nis modules on Unix; let's see
Andrew M. Kuchling <amk@amk.ca>
parents:
16471
diff
changeset
|
388 |
|
4db0fddb6917
Patch #103544: always compile the dl and nis modules on Unix; let's see
Andrew M. Kuchling <amk@amk.ca>
parents:
16471
diff
changeset
|
389 # Sun yellow pages. Some systems have the functions in libc. |
|
16804
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
390 if platform not in ['cygwin']: |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
391 if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
392 libs = ['nsl'] |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
393 else: |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
394 libs = [] |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
395 exts.append( Extension('nis', ['nismodule.c'], |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
396 libraries = libs) ) |
| 15940 | 397 |
| 398 # Curses support, requring the System V version of curses, often | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
399 # provided by the ncurses library. |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
400 if platform == 'sunos4': |
|
16842
76a684fe3f7f
Fix for bug #404875: fix typo in setup.py
Andrew M. Kuchling <amk@amk.ca>
parents:
16804
diff
changeset
|
401 inc_dirs += ['/usr/5include'] |
| 15940 | 402 lib_dirs += ['/usr/5lib'] |
| 403 | |
| 404 if (self.compiler.find_library_file(lib_dirs, 'ncurses')): | |
| 405 curses_libs = ['ncurses'] | |
| 406 exts.append( Extension('_curses', ['_cursesmodule.c'], | |
| 407 libraries = curses_libs) ) | |
| 408 elif (self.compiler.find_library_file(lib_dirs, 'curses')): | |
| 409 if (self.compiler.find_library_file(lib_dirs, 'terminfo')): | |
| 410 curses_libs = ['curses', 'terminfo'] | |
| 411 else: | |
| 412 curses_libs = ['curses', 'termcap'] | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
413 |
| 15940 | 414 exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 415 libraries = curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
416 |
| 15940 | 417 # If the curses module is enabled, check for the panel module |
| 418 if (os.path.exists('Modules/_curses_panel.c') and | |
| 419 module_enabled(exts, '_curses') and | |
| 420 self.compiler.find_library_file(lib_dirs, 'panel')): | |
| 421 exts.append( Extension('_curses_panel', ['_curses_panel.c'], | |
| 422 libraries = ['panel'] + curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
423 |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
424 |
| 15940 | 425 |
| 426 # Lee Busby's SIGFPE modules. | |
| 427 # The library to link fpectl with is platform specific. | |
| 428 # Choose *one* of the options below for fpectl: | |
| 429 | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
430 if platform == 'irix5': |
| 15940 | 431 # For SGI IRIX (tested on 5.3): |
| 432 exts.append( Extension('fpectl', ['fpectlmodule.c'], | |
| 433 libraries=['fpe']) ) | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
434 elif 0: # XXX how to detect SunPro? |
| 15940 | 435 # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): |
| 436 # (Without the compiler you don't have -lsunmath.) | |
| 437 #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm | |
| 438 pass | |
| 439 else: | |
| 440 # For other systems: see instructions in fpectlmodule.c. | |
| 441 #fpectl fpectlmodule.c ... | |
| 442 exts.append( Extension('fpectl', ['fpectlmodule.c']) ) | |
| 443 | |
| 444 | |
| 445 # Andrew Kuchling's zlib module. | |
| 446 # This require zlib 1.1.3 (or later). | |
| 447 # See http://www.cdrom.com/pub/infozip/zlib/ | |
| 448 if (self.compiler.find_library_file(lib_dirs, 'z')): | |
| 449 exts.append( Extension('zlib', ['zlibmodule.c'], | |
| 450 libraries = ['z']) ) | |
| 451 | |
| 452 # Interface to the Expat XML parser | |
| 453 # | |
| 454 # Expat is written by James Clark and must be downloaded separately | |
| 455 # (see below). The pyexpat module was written by Paul Prescod after a | |
| 456 # prototype by Jack Jansen. | |
| 457 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
458 # The Expat dist includes Windows .lib and .dll files. Home page is |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
459 # at http://www.jclark.com/xml/expat.html, the current production |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
460 # release is always ftp://ftp.jclark.com/pub/xml/expat.zip. |
| 15940 | 461 # |
| 462 # EXPAT_DIR, below, should point to the expat/ directory created by | |
| 463 # unpacking the Expat source distribution. | |
| 464 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
465 # Note: the expat build process doesn't yet build a libexpat.a; you |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
466 # can do this manually while we try convince the author to add it. To |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
467 # do so, cd to EXPAT_DIR, run "make" if you have not done so, then |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
468 # run: |
| 15940 | 469 # |
| 470 # ar cr libexpat.a xmltok/*.o xmlparse/*.o | |
| 471 # | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
472 expat_defs = [] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
473 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
|
474 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
|
475 # 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
|
476 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
|
477 else: |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
478 expat_incs = find_file('xmlparse.h', inc_dirs, []) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
479 |
|
16078
91a63df7eee4
Check for None to decide when pyexpat should not be built.
Martin v. Löwis <martin@v.loewis.de>
parents:
16038
diff
changeset
|
480 if (expat_incs is not None and |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
481 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
|
482 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
|
483 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
|
484 libraries = ['expat']) ) |
| 15940 | 485 |
| 486 # Platform-specific libraries | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
487 if platform == 'linux2': |
| 15940 | 488 # Linux-specific modules |
| 489 exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) | |
| 490 | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
491 if platform == 'sunos5': |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
492 # SunOS specific modules |
| 15940 | 493 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) |
| 494 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
495 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
|
496 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
497 # 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
|
498 self.detect_tkinter(inc_dirs, lib_dirs) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
499 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
500 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
501 def detect_tkinter(self, inc_dirs, lib_dirs): |
| 15940 | 502 # The _tkinter module. |
| 503 # | |
| 504 # The command for _tkinter is long and site specific. Please | |
| 505 # uncomment and/or edit those parts as indicated. If you don't have a | |
| 506 # specific extension (e.g. Tix or BLT), leave the corresponding line | |
| 507 # commented out. (Leave the trailing backslashes in! If you | |
| 508 # experience strange errors, you may want to join all uncommented | |
| 509 # lines and remove the backslashes -- the backslash interpretation is | |
| 510 # done by the shell's "read" command and it may not be implemented on | |
| 511 # every system. | |
| 512 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
513 # 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
|
514 tcllib = tklib = tcl_includes = tk_includes = None |
| 15951 | 515 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
|
516 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
|
517 'tk' + version ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
518 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
|
519 'tcl' + version ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
520 if tklib and tcllib: |
| 15940 | 521 # Exit the loop when we've found the Tcl/Tk libraries |
| 522 break | |
| 523 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
524 # Now check for the header files |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
525 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
|
526 # 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
|
527 # they're put in /usr/include/{tcl,tk}X.Y |
|
16467
1c71aa7d5513
Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents:
16447
diff
changeset
|
528 debian_tcl_include = [ '/usr/include/tcl' + version ] |
|
1c71aa7d5513
Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents:
16447
diff
changeset
|
529 debian_tk_include = [ '/usr/include/tk' + version ] + debian_tcl_include |
|
1c71aa7d5513
Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents:
16447
diff
changeset
|
530 tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) |
|
1c71aa7d5513
Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents:
16447
diff
changeset
|
531 tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) |
| 15940 | 532 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
533 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
|
534 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
|
535 # 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
|
536 return |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
537 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
538 # OK... everything seems to be present for Tcl/Tk. |
| 15940 | 539 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
540 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
|
541 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
|
542 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
|
543 include_dirs.append(dir) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
544 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
545 # Check for various platform-specific directories |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
546 platform = self.get_platform() |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
547 if platform == 'sunos5': |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 else: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
557 # Assume default location for X11 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
558 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
|
559 added_lib_dirs.append('/usr/X11/lib') |
| 15940 | 560 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
561 # 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
|
562 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
|
563 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
|
564 libs.append('tix4.1.8.0') |
| 15940 | 565 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
566 # 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
|
567 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
|
568 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
|
569 libs.append('BLT8.0') |
| 15940 | 570 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
571 # Add the Tcl/Tk libraries |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
572 libs.append('tk'+version) |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
573 libs.append('tcl'+version) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
574 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
575 if platform in ['aix3', 'aix4']: |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
576 libs.append('ld') |
| 15940 | 577 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
578 # 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
|
579 libs.append('X11') |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
580 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 libraries = libs, |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
585 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
|
586 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
587 self.extensions.append(ext) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
588 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
589 # XXX handle these, but how to detect? |
| 15940 | 590 # *** Uncomment and edit for PIL (TkImaging) extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
591 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ |
| 15940 | 592 # *** Uncomment and edit for TOGL extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
593 # -DWITH_TOGL togl.c \ |
| 15940 | 594 # *** Uncomment these for TOGL extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
595 # -lGL -lGLU -lXext -lXmu \ |
| 15940 | 596 |
| 597 def main(): | |
| 598 setup(name = 'Python standard library', | |
|
15967
dcae3e08d848
- compile struct module
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
15961
diff
changeset
|
599 version = '%d.%d' % sys.version_info[:2], |
| 15940 | 600 cmdclass = {'build_ext':PyBuildExt}, |
| 601 # The struct module is defined here, because build_ext won't be | |
| 602 # called unless there's at least one extension module defined. | |
| 603 ext_modules=[Extension('struct', ['structmodule.c'])] | |
| 604 ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
605 |
| 15940 | 606 # --install-platlib |
| 607 if __name__ == '__main__': | |
| 608 sysconfig.set_python_build() | |
| 609 main() |
