Mercurial > cpython-lru_cache-weakref
annotate setup.py @ 19319:d370a58fb7fd legacy-trunk
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Remove pointless comment
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Thu, 16 Aug 2001 20:30:18 +0000 |
| parents | 35c65d9aa86a |
| children | 7257e87e0720 |
| 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 # |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
3 |
|
16287
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
4 __version__ = "$Revision$" |
|
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
5 |
|
4b72888c9e2f
Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents:
16283
diff
changeset
|
6 import sys, os, getopt |
| 15940 | 7 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
|
8 from distutils import text_file |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
9 from distutils.errors import * |
| 15940 | 10 from distutils.core import Extension, setup |
| 11 from distutils.command.build_ext import build_ext | |
|
17886
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
12 from distutils.command.install import install |
| 15940 | 13 |
| 14 # This global variable is used to hold the list of modules to be disabled. | |
| 15 disabled_module_list = [] | |
| 16 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
17 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
|
18 """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
|
19 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
|
20 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
|
21 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
22 '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
|
23 '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
|
24 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
|
25 '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
|
26 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
|
27 """ |
|
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 standard locations |
|
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 std_dirs: |
|
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): return [] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
33 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
34 # 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
|
35 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
|
36 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
|
37 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
|
38 return [dir] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
39 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
40 # Not found anywhere |
| 15940 | 41 return None |
| 42 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 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
|
47 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
48 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
|
49 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
|
50 return result |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
51 |
| 15940 | 52 def module_enabled(extlist, modname): |
| 53 """Returns whether the module 'modname' is present in the list | |
| 54 of extensions 'extlist'.""" | |
| 55 extlist = [ext for ext in extlist if ext.name == modname] | |
| 56 return len(extlist) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
57 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
58 def find_module_file(module, dirlist): |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
59 """Find a module in a set of possible folders. If it is not found |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
60 return the unadorned filename""" |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
61 list = find_file(module, [], dirlist) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
62 if not list: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
63 return module |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
64 if len(list) > 1: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
65 self.announce("WARNING: multiple copies of %s found"%module) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
66 return os.path.join(list[0], module) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
67 |
| 15940 | 68 class PyBuildExt(build_ext): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
69 |
| 15940 | 70 def build_extensions(self): |
| 71 | |
| 72 # Detect which modules should be compiled | |
| 73 self.detect_modules() | |
| 74 | |
| 75 # Remove modules that are present on the disabled list | |
| 76 self.extensions = [ext for ext in self.extensions | |
| 77 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
|
78 |
| 15940 | 79 # Fix up the autodetected modules, prefixing all the source files |
| 80 # with Modules/ and adding Python's include directory to the path. | |
| 81 (srcdir,) = sysconfig.get_config_vars('srcdir') | |
| 82 | |
|
16225
e56dd2dd9960
Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
16201
diff
changeset
|
83 # 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
|
84 moddir = os.path.join(os.getcwd(), srcdir, 'Modules') |
| 15940 | 85 moddir = os.path.normpath(moddir) |
| 86 srcdir, tail = os.path.split(moddir) | |
| 87 srcdir = os.path.normpath(srcdir) | |
| 88 moddir = os.path.normpath(moddir) | |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
89 |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
90 moddirlist = [moddir] |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
91 incdirlist = ['./Include'] |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
92 |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
93 # Platform-dependent module source and include directories |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
94 platform = self.get_platform() |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
95 if platform == 'darwin1': |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
96 # Mac OS X also includes some mac-specific modules |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
97 macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules') |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
98 moddirlist.append(macmoddir) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
99 incdirlist.append('./Mac/Include') |
| 15940 | 100 |
|
16860
cd4085cee309
Fix for bug #405007: prefix subdir to scripts in order to build in
Andrew M. Kuchling <amk@amk.ca>
parents:
16844
diff
changeset
|
101 # Fix up the paths for scripts, too |
|
cd4085cee309
Fix for bug #405007: prefix subdir to scripts in order to build in
Andrew M. Kuchling <amk@amk.ca>
parents:
16844
diff
changeset
|
102 self.distribution.scripts = [os.path.join(srcdir, filename) |
|
cd4085cee309
Fix for bug #405007: prefix subdir to scripts in order to build in
Andrew M. Kuchling <amk@amk.ca>
parents:
16844
diff
changeset
|
103 for filename in self.distribution.scripts] |
|
cd4085cee309
Fix for bug #405007: prefix subdir to scripts in order to build in
Andrew M. Kuchling <amk@amk.ca>
parents:
16844
diff
changeset
|
104 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
105 for ext in self.extensions[:]: |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
106 ext.sources = [ find_module_file(filename, moddirlist) |
| 15940 | 107 for filename in ext.sources ] |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
108 ext.include_dirs.append( '.' ) # to get config.h |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
109 for incdir in incdirlist: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
110 ext.include_dirs.append( os.path.join(srcdir, incdir) ) |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
111 |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
112 # 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
|
113 # 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
|
114 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
|
115 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
|
116 |
|
16750
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
117 # 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
|
118 # 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 |
|
90e90c92198b
Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents:
16749
diff
changeset
|
128 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
|
129 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
|
130 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
|
131 |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
132 # 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
|
133 # 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
|
134 # 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
|
135 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
|
136 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
|
137 args = {} |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
138 # 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
|
139 # compilers |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
140 if compiler is not None: |
|
19122
6729bf30d3ae
Get OPT from the environment to build the CCSHARED command.
Martin v. Löwis <martin@v.loewis.de>
parents:
19049
diff
changeset
|
141 (ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT') |
|
6729bf30d3ae
Get OPT from the environment to build the CCSHARED command.
Martin v. Löwis <martin@v.loewis.de>
parents:
19049
diff
changeset
|
142 args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
143 if linker_so is not None: |
|
19269
35c65d9aa86a
On OSX we should not pass the -shared option to ld: it make the build
Jack Jansen <jack.jansen@cwi.nl>
parents:
19122
diff
changeset
|
144 if platform == 'darwin1': |
|
35c65d9aa86a
On OSX we should not pass the -shared option to ld: it make the build
Jack Jansen <jack.jansen@cwi.nl>
parents:
19122
diff
changeset
|
145 args['linker_so'] = linker_so |
|
35c65d9aa86a
On OSX we should not pass the -shared option to ld: it make the build
Jack Jansen <jack.jansen@cwi.nl>
parents:
19122
diff
changeset
|
146 else: |
|
35c65d9aa86a
On OSX we should not pass the -shared option to ld: it make the build
Jack Jansen <jack.jansen@cwi.nl>
parents:
19122
diff
changeset
|
147 args['linker_so'] = linker_so + ' -shared' |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
148 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
|
149 |
| 15940 | 150 build_ext.build_extensions(self) |
| 151 | |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
152 def build_extension(self, ext): |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
153 |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
154 try: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
155 build_ext.build_extension(self, ext) |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
156 except (CCompilerError, DistutilsError), why: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
157 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
|
158 (ext.name, sys.exc_info()[1])) |
|
17890
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
159 return |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
160 try: |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
161 __import__(ext.name) |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
162 except ImportError: |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
163 self.announce('WARNING: removing "%s" since importing it failed' % |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
164 ext.name) |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
165 assert not self.inplace |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
166 fullname = self.get_ext_fullname(ext.name) |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
167 ext_filename = os.path.join(self.build_lib, |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
168 self.get_ext_filename(fullname)) |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
169 os.remove(ext_filename) |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
170 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
171 def get_platform (self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
172 # Get value of sys.platform |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
173 platform = sys.platform |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
174 if platform[:6] =='cygwin': |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
175 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
|
176 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
|
177 platform = 'beos' |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
178 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
179 return platform |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
180 |
| 15940 | 181 def detect_modules(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
182 # 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
|
183 if '/usr/local/lib' not in self.compiler.library_dirs: |
|
17063
d7e02b9ee179
Tidy up the ordering of include and library directories, putting
Andrew M. Kuchling <amk@amk.ca>
parents:
16945
diff
changeset
|
184 self.compiler.library_dirs.insert(0, '/usr/local/lib') |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
185 if '/usr/local/include' not in self.compiler.include_dirs: |
|
17063
d7e02b9ee179
Tidy up the ordering of include and library directories, putting
Andrew M. Kuchling <amk@amk.ca>
parents:
16945
diff
changeset
|
186 self.compiler.include_dirs.insert(0, '/usr/local/include' ) |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
187 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
188 # 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
|
189 # 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
|
190 # 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
|
191 lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib'] |
|
17063
d7e02b9ee179
Tidy up the ordering of include and library directories, putting
Andrew M. Kuchling <amk@amk.ca>
parents:
16945
diff
changeset
|
192 inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
| 15940 | 193 exts = [] |
| 194 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
195 platform = self.get_platform() |
|
17063
d7e02b9ee179
Tidy up the ordering of include and library directories, putting
Andrew M. Kuchling <amk@amk.ca>
parents:
16945
diff
changeset
|
196 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
197 # 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
|
198 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
|
199 if platform in ['Darwin1.2', 'beos']: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
200 math_libs = [] |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
201 |
| 15940 | 202 # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| 203 | |
| 204 # | |
| 205 # The following modules are all pretty straightforward, and compile | |
| 206 # on pretty much any POSIXish platform. | |
| 207 # | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
208 |
| 15940 | 209 # Some modules that are normally always on: |
| 210 exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) | |
| 211 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
|
212 |
|
16384
c898ceba2261
Add entries for the weakref module to the build control.
Fred Drake <fdrake@acm.org>
parents:
16287
diff
changeset
|
213 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
|
214 exts.append( Extension('_symtable', ['symtablemodule.c']) ) |
| 15951 | 215 exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) ) |
| 15940 | 216 |
| 217 # array objects | |
| 218 exts.append( Extension('array', ['arraymodule.c']) ) | |
| 219 # 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
|
220 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
|
221 libraries=math_libs) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
222 |
| 15940 | 223 # 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
|
224 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
|
225 libraries=math_libs) ) |
| 15940 | 226 # fast string operations implemented in C |
| 227 exts.append( Extension('strop', ['stropmodule.c']) ) | |
| 228 # 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
|
229 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
|
230 libraries=math_libs) ) |
| 15940 | 231 # operator.add() and similar goodies |
| 232 exts.append( Extension('operator', ['operator.c']) ) | |
| 233 # access to the builtin codecs and codec registry | |
| 234 exts.append( Extension('_codecs', ['_codecsmodule.c']) ) | |
|
16416
7d39d9dcf2d6
Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents:
16415
diff
changeset
|
235 # 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
|
236 exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) |
| 15940 | 237 # 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
|
238 exts.append( Extension('unicodedata', ['unicodedata.c']) ) |
| 15940 | 239 # access to ISO C locale support |
| 240 exts.append( Extension('_locale', ['_localemodule.c']) ) | |
| 241 | |
| 242 # Modules with some UNIX dependencies -- on by default: | |
| 243 # (If you have a really backward UNIX, select and socket may not be | |
| 244 # supported...) | |
| 245 | |
| 246 # fcntl(2) and ioctl(2) | |
| 247 exts.append( Extension('fcntl', ['fcntlmodule.c']) ) | |
| 248 # pwd(3) | |
| 249 exts.append( Extension('pwd', ['pwdmodule.c']) ) | |
| 250 # grp(3) | |
| 251 exts.append( Extension('grp', ['grpmodule.c']) ) | |
| 252 # posix (UNIX) errno values | |
| 253 exts.append( Extension('errno', ['errnomodule.c']) ) | |
| 254 # select(2); not on ancient System V | |
| 255 exts.append( Extension('select', ['selectmodule.c']) ) | |
| 256 | |
| 257 # The md5 module implements the RSA Data Security, Inc. MD5 | |
| 258 # Message-Digest Algorithm, described in RFC 1321. The necessary files | |
| 259 # md5c.c and md5.h are included here. | |
| 260 exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) | |
| 261 | |
| 262 # The sha module implements the SHA checksum algorithm. | |
| 263 # (NIST's Secure Hash Algorithm.) | |
| 264 exts.append( Extension('sha', ['shamodule.c']) ) | |
| 265 | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
266 # 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
|
267 # kinds): |
| 15940 | 268 exts.append( Extension('new', ['newmodule.c']) ) |
| 269 | |
| 270 # Helper module for various ascii-encoders | |
| 271 exts.append( Extension('binascii', ['binascii.c']) ) | |
| 272 | |
| 273 # Fred Drake's interface to the Python parser | |
| 274 exts.append( Extension('parser', ['parsermodule.c']) ) | |
| 275 | |
| 276 # Digital Creations' cStringIO and cPickle | |
| 277 exts.append( Extension('cStringIO', ['cStringIO.c']) ) | |
| 278 exts.append( Extension('cPickle', ['cPickle.c']) ) | |
| 279 | |
| 280 # Memory-mapped files (also works on Win32). | |
| 281 exts.append( Extension('mmap', ['mmapmodule.c']) ) | |
| 282 | |
| 283 # Lance Ellinghaus's modules: | |
| 284 # enigma-inspired encryption | |
| 285 exts.append( Extension('rotor', ['rotormodule.c']) ) | |
| 286 # syslog daemon interface | |
| 287 exts.append( Extension('syslog', ['syslogmodule.c']) ) | |
| 288 | |
| 289 # George Neville-Neil's timing module: | |
| 290 exts.append( Extension('timing', ['timingmodule.c']) ) | |
| 291 | |
| 292 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
293 # 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
|
294 # libraries, are platform-specific, or present other surprises. |
| 15940 | 295 # |
| 296 | |
| 297 # Multimedia modules | |
| 298 # These don't work for 64-bit platforms!!! | |
| 299 # These represent audio samples or images as strings: | |
| 300 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
301 # Disabled on 64-bit platforms |
| 15940 | 302 if sys.maxint != 9223372036854775807L: |
| 303 # Operations on audio samples | |
| 304 exts.append( Extension('audioop', ['audioop.c']) ) | |
| 305 # Operations on images | |
| 306 exts.append( Extension('imageop', ['imageop.c']) ) | |
| 307 # Read SGI RGB image files (but coded portably) | |
| 308 exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) | |
| 309 | |
| 310 # 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
|
311 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
|
312 readline_libs = ['readline'] |
|
19319
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
313 if self.compiler.find_library_file(lib_dirs, |
|
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
314 'ncurses'): |
|
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
315 readline_libs.append('ncurses') |
|
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
316 elif self.compiler.find_library_file(lib_dirs + |
|
16283
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
317 ['/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
|
318 'termcap'): |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
319 readline_libs.append('termcap') |
| 15940 | 320 exts.append( Extension('readline', ['readline.c'], |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
321 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
|
322 libraries=readline_libs) ) |
| 15940 | 323 |
|
19319
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
324 # crypt module. |
| 15940 | 325 |
| 326 if self.compiler.find_library_file(lib_dirs, 'crypt'): | |
| 327 libs = ['crypt'] | |
| 328 else: | |
| 329 libs = [] | |
| 330 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) | |
| 331 | |
| 332 # socket(2) | |
| 333 # 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
|
334 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
|
335 ['/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
|
336 '/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
|
337 ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
338 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
339 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
|
340 ['/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
|
341 '/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
|
342 ] ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
343 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
344 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
|
345 ssl_libs is not None): |
| 15940 | 346 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
|
347 include_dirs = ssl_incs, |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
348 library_dirs = ssl_libs, |
| 15940 | 349 libraries = ['ssl', 'crypto'], |
| 350 define_macros = [('USE_SSL',1)] ) ) | |
| 351 else: | |
| 352 exts.append( Extension('_socket', ['socketmodule.c']) ) | |
| 353 | |
| 354 # Modules that provide persistent dictionary-like semantics. You will | |
| 355 # probably want to arrange for at least one of them to be available on | |
| 356 # your machine, though none are defined by default because of library | |
| 357 # dependencies. The Python module anydbm.py provides an | |
| 358 # implementation independent wrapper for these; dumbdbm.py provides | |
| 359 # similar functionality (but slower of course) implemented in Python. | |
| 360 | |
| 361 # 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
|
362 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
|
363 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
|
364 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
|
365 libraries = ['ndbm'] ) ) |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
366 else: |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
367 exts.append( Extension('dbm', ['dbmmodule.c']) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
368 |
| 15940 | 369 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: |
| 370 if (self.compiler.find_library_file(lib_dirs, 'gdbm')): | |
| 371 exts.append( Extension('gdbm', ['gdbmmodule.c'], | |
| 372 libraries = ['gdbm'] ) ) | |
| 373 | |
| 374 # Berkeley DB interface. | |
| 375 # | |
| 376 # This requires the Berkeley DB code, see | |
| 377 # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz | |
| 378 # | |
| 379 # Edit the variables DB and DBPORT to point to the db top directory | |
| 380 # and the subdirectory of PORT where you built it. | |
| 381 # | |
| 382 # (See http://electricrain.com/greg/python/bsddb3/ for an interface to | |
| 383 # BSD DB 3.x.) | |
| 384 | |
|
16749
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
385 dblib = [] |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
386 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
|
387 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
|
388 |
|
7815919e2af8
Patch #103937: Attempt to get the BSDDB autodetection right (or at least
Andrew M. Kuchling <amk@amk.ca>
parents:
16721
diff
changeset
|
389 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
|
390 ['/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
|
391 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
|
392 if db185_incs is not None: |
| 15940 | 393 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
|
394 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
|
395 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
|
396 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
|
397 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
|
398 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
|
399 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
|
400 libraries = dblib) ) |
| 15940 | 401 |
| 402 # 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
|
403 # You need to ftp the GNU MP library. |
| 15940 | 404 # This was originally written and tested against GMP 1.2 and 1.3.2. |
| 405 # It has been modified by Rob Hooft to work with 2.0.2 as well, but I | |
| 406 # haven't tested it recently. For a more complete module, | |
| 407 # refer to pympz.sourceforge.net. | |
| 408 | |
| 409 # A compatible MP library unencombered by the GPL also exists. It was | |
| 410 # posted to comp.sources.misc in volume 40 and is widely available from | |
| 411 # FTP archive sites. One URL for it is: | |
| 412 # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z | |
| 413 | |
| 414 if (self.compiler.find_library_file(lib_dirs, 'gmp')): | |
| 415 exts.append( Extension('mpz', ['mpzmodule.c'], | |
| 416 libraries = ['gmp'] ) ) | |
| 417 | |
| 418 | |
| 419 # Unix-only modules | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
420 if platform not in ['mac', 'win32']: |
| 15940 | 421 # Steen Lumholt's termios module |
| 422 exts.append( Extension('termios', ['termios.c']) ) | |
| 423 # 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
|
424 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
|
425 exts.append( Extension('resource', ['resource.c']) ) |
| 15940 | 426 |
|
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
|
427 # 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
|
428 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
|
429 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
|
430 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
|
431 else: |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
432 libs = [] |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
433 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
|
434 libraries = libs) ) |
| 15940 | 435 |
| 436 # 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
|
437 # 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
|
438 if platform == 'sunos4': |
|
16842
76a684fe3f7f
Fix for bug #404875: fix typo in setup.py
Andrew M. Kuchling <amk@amk.ca>
parents:
16804
diff
changeset
|
439 inc_dirs += ['/usr/5include'] |
| 15940 | 440 lib_dirs += ['/usr/5lib'] |
| 441 | |
| 442 if (self.compiler.find_library_file(lib_dirs, 'ncurses')): | |
| 443 curses_libs = ['ncurses'] | |
| 444 exts.append( Extension('_curses', ['_cursesmodule.c'], | |
| 445 libraries = curses_libs) ) | |
| 446 elif (self.compiler.find_library_file(lib_dirs, 'curses')): | |
| 447 if (self.compiler.find_library_file(lib_dirs, 'terminfo')): | |
| 448 curses_libs = ['curses', 'terminfo'] | |
| 449 else: | |
| 450 curses_libs = ['curses', 'termcap'] | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
451 |
| 15940 | 452 exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 453 libraries = curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
454 |
| 15940 | 455 # If the curses module is enabled, check for the panel module |
| 456 if (os.path.exists('Modules/_curses_panel.c') and | |
| 457 module_enabled(exts, '_curses') and | |
| 458 self.compiler.find_library_file(lib_dirs, 'panel')): | |
| 459 exts.append( Extension('_curses_panel', ['_curses_panel.c'], | |
| 460 libraries = ['panel'] + curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
461 |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
462 |
| 15940 | 463 |
| 464 # Lee Busby's SIGFPE modules. | |
| 465 # The library to link fpectl with is platform specific. | |
| 466 # Choose *one* of the options below for fpectl: | |
| 467 | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
468 if platform == 'irix5': |
| 15940 | 469 # For SGI IRIX (tested on 5.3): |
| 470 exts.append( Extension('fpectl', ['fpectlmodule.c'], | |
| 471 libraries=['fpe']) ) | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
472 elif 0: # XXX how to detect SunPro? |
| 15940 | 473 # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): |
| 474 # (Without the compiler you don't have -lsunmath.) | |
| 475 #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm | |
| 476 pass | |
| 477 else: | |
| 478 # For other systems: see instructions in fpectlmodule.c. | |
| 479 #fpectl fpectlmodule.c ... | |
| 480 exts.append( Extension('fpectl', ['fpectlmodule.c']) ) | |
| 481 | |
| 482 | |
| 483 # Andrew Kuchling's zlib module. | |
| 484 # This require zlib 1.1.3 (or later). | |
| 485 # See http://www.cdrom.com/pub/infozip/zlib/ | |
|
17531
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
486 zlib_inc = find_file('zlib.h', [], inc_dirs) |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
487 if zlib_inc is not None: |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
488 zlib_h = zlib_inc[0] + '/zlib.h' |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
489 version = '"0.0.0"' |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
490 version_req = '"1.1.3"' |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
491 fp = open(zlib_h) |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
492 while 1: |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
493 line = fp.readline() |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
494 if not line: |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
495 break |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
496 if line.find('#define ZLIB_VERSION', 0) == 0: |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
497 version = line.split()[2] |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
498 break |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
499 if version >= version_req: |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
500 if (self.compiler.find_library_file(lib_dirs, 'z')): |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
501 exts.append( Extension('zlib', ['zlibmodule.c'], |
|
c497fa3fe38a
Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents:
17099
diff
changeset
|
502 libraries = ['z']) ) |
| 15940 | 503 |
| 504 # Interface to the Expat XML parser | |
| 505 # | |
| 506 # Expat is written by James Clark and must be downloaded separately | |
| 507 # (see below). The pyexpat module was written by Paul Prescod after a | |
| 508 # prototype by Jack Jansen. | |
| 509 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
510 # 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
|
511 # 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
|
512 # release is always ftp://ftp.jclark.com/pub/xml/expat.zip. |
| 15940 | 513 # |
| 514 # EXPAT_DIR, below, should point to the expat/ directory created by | |
| 515 # unpacking the Expat source distribution. | |
| 516 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
517 # 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
|
518 # 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
|
519 # 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
|
520 # run: |
| 15940 | 521 # |
| 522 # ar cr libexpat.a xmltok/*.o xmlparse/*.o | |
| 523 # | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
524 expat_defs = [] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
525 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
|
526 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
|
527 # 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
|
528 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
|
529 else: |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
530 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
|
531 |
|
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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 libraries = ['expat']) ) |
| 15940 | 537 |
| 538 # Platform-specific libraries | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
539 if platform == 'linux2': |
| 15940 | 540 # Linux-specific modules |
| 541 exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) | |
| 542 | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
543 if platform == 'sunos5': |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
544 # SunOS specific modules |
| 15940 | 545 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
546 |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
547 if platform == 'darwin1': |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
548 # Mac OS X specific modules. These are ported over from MacPython |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
549 # and still experimental. Some (such as gestalt or icglue) are |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
550 # already generally useful, some (the GUI ones) really need to |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
551 # be used from a framework. |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
552 exts.append( Extension('gestalt', ['gestaltmodule.c']) ) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
553 exts.append( Extension('MacOS', ['macosmodule.c']) ) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
554 exts.append( Extension('icglue', ['icgluemodule.c']) ) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
555 exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c']) ) |
|
19049
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
556 ## exts.append( Extension('Nav', ['Nav.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
557 ## exts.append( Extension('AE', ['ae/AEmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
558 ## exts.append( Extension('App', ['app/Appmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
559 ## exts.append( Extension('CF', ['cf/CFmodule.c'], |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
560 ## extra_link_args=['-framework', 'CoreFoundation']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
561 ## exts.append( Extension('Cm', ['cm/Cmmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
562 ## exts.append( Extension('Ctl', ['ctl/Ctlmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
563 ## exts.append( Extension('Dlg', ['dlg/Dlgmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
564 ## exts.append( Extension('Drag', ['drag/Dragmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
565 ## exts.append( Extension('Evt', ['evt/Evtmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
566 ## exts.append( Extension('Fm', ['fm/Fmmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
567 ## exts.append( Extension('Icn', ['icn/Icnmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
568 ## exts.append( Extension('List', ['list/Listmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
569 ## exts.append( Extension('Menu', ['menu/Menumodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
570 ## exts.append( Extension('Mlte', ['mlte/Mltemodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
571 ## exts.append( Extension('Qd', ['qd/Qdmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
572 ## exts.append( Extension('Qdoffs', ['qdoffs/Qdoffsmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
573 ## exts.append( Extension('Qt', ['qt/Qtmodule.c'], |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
574 ## extra_link_args=['-framework', 'QuickTime']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
575 ## exts.append( Extension('Res', ['res/Resmodule.c'] ) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
576 #### exts.append( Extension('Scrap', ['scrap/Scrapmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
577 ## exts.append( Extension('Snd', ['snd/Sndmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
578 ## exts.append( Extension('TE', ['te/TEmodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
579 #### exts.append( Extension('waste', ['waste/wastemodule.c']) ) |
|
28b643bad74d
Commented out most of the MacPython modules. There is a discussion on the
Jack Jansen <jack.jansen@cwi.nl>
parents:
19007
diff
changeset
|
580 ## exts.append( Extension('Win', ['win/Winmodule.c']) ) |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
581 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
582 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
|
583 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
584 # 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
|
585 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
|
586 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
587 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
588 def detect_tkinter(self, inc_dirs, lib_dirs): |
| 15940 | 589 # The _tkinter module. |
|
17099
d9ee56b6db26
Remove Tix detection from Tkinter part; lib-tk/Tix attempts to load Tix
Martin v. Löwis <martin@v.loewis.de>
parents:
17063
diff
changeset
|
590 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
591 # Assume we haven't found any of the libraries or include files |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
592 # The versions with dots are used on Unix, and the versions without |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
593 # dots on Windows, for detection by cygwin. |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
594 tcllib = tklib = tcl_includes = tk_includes = None |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
595 for version in ['8.4', '84', '8.3', '83', '8.2', |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
596 '82', '8.1', '81', '8.0', '80']: |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
597 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
|
598 'tk' + version ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
599 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
|
600 'tcl' + version ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
601 if tklib and tcllib: |
| 15940 | 602 # Exit the loop when we've found the Tcl/Tk libraries |
| 603 break | |
| 604 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
605 # 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
|
606 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
|
607 # 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
|
608 # 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
|
609 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
|
610 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
|
611 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
|
612 tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) |
| 15940 | 613 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
614 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
|
615 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
|
616 # 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
|
617 return |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
618 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
619 # OK... everything seems to be present for Tcl/Tk. |
| 15940 | 620 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
621 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
|
622 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
|
623 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
|
624 include_dirs.append(dir) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
625 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
626 # 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
|
627 platform = self.get_platform() |
|
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
628 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
|
629 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
|
630 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
|
631 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
|
632 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
|
633 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
|
634 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
|
635 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
|
636 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
|
637 else: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
638 # 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
|
639 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
|
640 added_lib_dirs.append('/usr/X11/lib') |
| 15940 | 641 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
642 # 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
|
643 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
|
644 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
|
645 libs.append('BLT8.0') |
| 15940 | 646 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
647 # Add the Tcl/Tk libraries |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
648 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
|
649 libs.append('tcl'+version) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
650 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
651 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
|
652 libs.append('ld') |
| 15940 | 653 |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
654 # Finally, link with the X11 libraries (not appropriate on cygwin) |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
655 if platform != "cygwin": |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
656 libs.append('X11') |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
657 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
658 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
|
659 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
|
660 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
|
661 libraries = libs, |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
662 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
|
663 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
664 self.extensions.append(ext) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
665 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
666 # XXX handle these, but how to detect? |
| 15940 | 667 # *** 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
|
668 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ |
| 15940 | 669 # *** 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
|
670 # -DWITH_TOGL togl.c \ |
| 15940 | 671 # *** Uncomment these for TOGL extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
672 # -lGL -lGLU -lXext -lXmu \ |
| 15940 | 673 |
|
17886
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
674 class PyBuildInstall(install): |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
675 # Suppress the warning about installation into the lib_dynload |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
676 # directory, which is not in sys.path when running Python during |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
677 # installation: |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
678 def initialize_options (self): |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
679 install.initialize_options(self) |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
680 self.warn_dir=0 |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
681 |
| 15940 | 682 def main(): |
|
17890
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
683 # turn off warnings when deprecated modules are imported |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
684 import warnings |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
685 warnings.filterwarnings("ignore",category=DeprecationWarning) |
| 15940 | 686 setup(name = 'Python standard library', |
|
15967
dcae3e08d848
- compile struct module
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
15961
diff
changeset
|
687 version = '%d.%d' % sys.version_info[:2], |
|
17886
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
688 cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall}, |
| 15940 | 689 # The struct module is defined here, because build_ext won't be |
| 690 # called unless there's at least one extension module defined. | |
| 16844 | 691 ext_modules=[Extension('struct', ['structmodule.c'])], |
| 692 | |
| 693 # Scripts to install | |
| 694 scripts = ['Tools/scripts/pydoc'] | |
| 15940 | 695 ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
696 |
| 15940 | 697 # --install-platlib |
| 698 if __name__ == '__main__': | |
| 699 sysconfig.set_python_build() | |
| 700 main() |
