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