Mercurial > cpython-lru_cache-weakref
annotate setup.py @ 32797:ea54fdb86530 legacy-trunk
Whitespace normalization.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Fri, 23 Jul 2004 02:50:10 +0000 |
| parents | 50ece3d4ff37 |
| children | aad118643598 |
| 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 |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
6 import sys, os, getopt, imp, re |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
7 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
8 from distutils import log |
| 15940 | 9 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
|
10 from distutils import text_file |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
11 from distutils.errors import * |
| 15940 | 12 from distutils.core import Extension, setup |
| 13 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
|
14 from distutils.command.install import install |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
15 from distutils.command.install_lib import install_lib |
| 15940 | 16 |
| 17 # This global variable is used to hold the list of modules to be disabled. | |
| 18 disabled_module_list = [] | |
| 19 | |
|
21742
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
20 def add_dir_to_list(dirlist, dir): |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
21 """Add the directory 'dir' to the list 'dirlist' (at the front) if |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
22 1) 'dir' is not already in 'dirlist' |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
23 2) 'dir' actually exists, and is a directory.""" |
|
24008
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
24 if dir is not None and os.path.isdir(dir) and dir not in dirlist: |
|
21742
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
25 dirlist.insert(0, dir) |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
26 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
27 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
|
28 """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
|
29 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
|
30 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
|
31 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
32 '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
|
33 '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
|
34 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
|
35 '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
|
36 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
|
37 """ |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
38 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
39 # 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
|
40 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
|
41 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
|
42 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
|
43 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
44 # 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
|
45 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
|
46 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
|
47 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
|
48 return [dir] |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
49 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
50 # Not found anywhere |
| 15940 | 51 return None |
| 52 | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
53 def find_library_file(compiler, libname, std_dirs, paths): |
|
26443
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
54 result = compiler.find_library_file(std_dirs + paths, libname) |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
55 if result is None: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
56 return None |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
57 |
|
26443
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
58 # Check whether the found file is in one of the standard directories |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
59 dirname = os.path.dirname(result) |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
60 for p in std_dirs: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
61 # Ensure path doesn't end with path separator |
|
29002
50841898cc19
p.strip(os.sep) can't have possibly worked. It would have stripped both
Skip Montanaro <skip@pobox.com>
parents:
29001
diff
changeset
|
62 p = p.rstrip(os.sep) |
|
26443
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
63 if p == dirname: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
64 return [ ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
65 |
|
26443
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
66 # Otherwise, it must have been in one of the additional directories, |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
67 # so we have to figure out which one. |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
68 for p in paths: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
69 # Ensure path doesn't end with path separator |
|
29002
50841898cc19
p.strip(os.sep) can't have possibly worked. It would have stripped both
Skip Montanaro <skip@pobox.com>
parents:
29001
diff
changeset
|
70 p = p.rstrip(os.sep) |
|
26443
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
71 if p == dirname: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
72 return [p] |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
73 else: |
|
c1258b1a36c6
[Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents:
26396
diff
changeset
|
74 assert False, "Internal error: Path not found in std_dirs or paths" |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
75 |
| 15940 | 76 def module_enabled(extlist, modname): |
| 77 """Returns whether the module 'modname' is present in the list | |
| 78 of extensions 'extlist'.""" | |
| 79 extlist = [ext for ext in extlist if ext.name == modname] | |
| 80 return len(extlist) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
81 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
82 def find_module_file(module, dirlist): |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
83 """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
|
84 return the unadorned filename""" |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
85 list = find_file(module, [], dirlist) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
86 if not list: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
87 return module |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
88 if len(list) > 1: |
|
27989
e7b26c3f356f
Don't use self.announce() in a function that's not a method.
Guido van Rossum <guido@python.org>
parents:
27930
diff
changeset
|
89 log.info("WARNING: multiple copies of %s found"%module) |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
90 return os.path.join(list[0], module) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
91 |
| 15940 | 92 class PyBuildExt(build_ext): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
93 |
| 15940 | 94 def build_extensions(self): |
| 95 | |
| 96 # Detect which modules should be compiled | |
| 97 self.detect_modules() | |
| 98 | |
| 99 # Remove modules that are present on the disabled list | |
| 100 self.extensions = [ext for ext in self.extensions | |
| 101 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
|
102 |
| 15940 | 103 # Fix up the autodetected modules, prefixing all the source files |
| 104 # with Modules/ and adding Python's include directory to the path. | |
| 105 (srcdir,) = sysconfig.get_config_vars('srcdir') | |
| 25790 | 106 if not srcdir: |
| 107 # Maybe running on Windows but not using CYGWIN? | |
| 108 raise ValueError("No source directory; cannot proceed.") | |
| 15940 | 109 |
|
16225
e56dd2dd9960
Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
16201
diff
changeset
|
110 # 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
|
111 moddir = os.path.join(os.getcwd(), srcdir, 'Modules') |
| 15940 | 112 moddir = os.path.normpath(moddir) |
| 113 srcdir, tail = os.path.split(moddir) | |
| 114 srcdir = os.path.normpath(srcdir) | |
| 115 moddir = os.path.normpath(moddir) | |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
116 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
117 moddirlist = [moddir] |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
118 incdirlist = ['./Include'] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
119 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
120 # Platform-dependent module source and include directories |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
121 platform = self.get_platform() |
|
24008
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
122 if platform in ('darwin', 'mac'): |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
123 # 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
|
124 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
|
125 moddirlist.append(macmoddir) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
126 incdirlist.append('./Mac/Include') |
| 15940 | 127 |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
128 alldirlist = moddirlist + incdirlist |
|
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
129 |
|
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
|
130 # 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
|
131 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
|
132 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
|
133 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
134 for ext in self.extensions[:]: |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
135 ext.sources = [ find_module_file(filename, moddirlist) |
| 15940 | 136 for filename in ext.sources ] |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
137 if ext.depends is not None: |
|
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
138 ext.depends = [find_module_file(filename, alldirlist) |
|
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
139 for filename in ext.depends] |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
140 ext.include_dirs.append( '.' ) # to get config.h |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
141 for incdir in incdirlist: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
142 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
|
143 |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
144 # 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
|
145 # 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
|
146 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
|
147 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
|
148 |
|
24008
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
149 if platform != 'mac': |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
150 # Parse Modules/Setup to figure out which modules are turned |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
151 # on in the file. |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
152 input = text_file.TextFile('Modules/Setup', join_lines=1) |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
153 remove_modules = [] |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
154 while 1: |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
155 line = input.readline() |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
156 if not line: break |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
157 line = line.split() |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
158 remove_modules.append( line[0] ) |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
159 input.close() |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
160 |
|
24008
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
161 for ext in self.extensions[:]: |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
162 if ext.name in remove_modules: |
|
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
163 self.extensions.remove(ext) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
164 |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
165 # 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
|
166 # 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
|
167 # 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
|
168 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
|
169 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
|
170 args = {} |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
171 # 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
|
172 # compilers |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
173 if compiler is not None: |
|
27002
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
174 (ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS') |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
175 args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
176 if linker_so is not None: |
|
20313
ea1910d2c781
Do not add -shared to linker_so. Any necessary options should already be
Martin v. Löwis <martin@v.loewis.de>
parents:
20234
diff
changeset
|
177 args['linker_so'] = linker_so |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
178 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
|
179 |
| 15940 | 180 build_ext.build_extensions(self) |
| 181 | |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
182 def build_extension(self, ext): |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
183 |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
184 try: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
185 build_ext.build_extension(self, ext) |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
186 except (CCompilerError, DistutilsError), why: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
187 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
|
188 (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
|
189 return |
|
20815
57ab65c2f170
The import check in setup.py fails on Mac OS X for Carbon-based modules
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
190 # Workaround for Mac OS X: The Carbon-based modules cannot be |
|
57ab65c2f170
The import check in setup.py fails on Mac OS X for Carbon-based modules
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
191 # reliably imported into a command-line Python |
|
57ab65c2f170
The import check in setup.py fails on Mac OS X for Carbon-based modules
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
192 if 'Carbon' in ext.extra_link_args: |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
193 self.announce( |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
194 'WARNING: skipping import check for Carbon-based "%s"' % |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
195 ext.name) |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
196 return |
|
23513
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
197 # Workaround for Cygwin: Cygwin currently has fork issues when many |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
198 # modules have been imported |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
199 if self.get_platform() == 'cygwin': |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
200 self.announce('WARNING: skipping import check for Cygwin-based "%s"' |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
201 % ext.name) |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
202 return |
| 21788 | 203 ext_filename = os.path.join( |
| 204 self.build_lib, | |
| 205 self.get_ext_filename(self.get_ext_fullname(ext.name))) | |
|
17890
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
206 try: |
| 21788 | 207 imp.load_dynamic(ext.name, ext_filename) |
|
28111
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
208 except ImportError, why: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
209 self.announce('*** WARNING: renaming "%s" since importing it' |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
210 ' failed: %s' % (ext.name, why), level=3) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
211 assert not self.inplace |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
212 basename, tail = os.path.splitext(ext_filename) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
213 newname = basename + "_failed" + tail |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
214 if os.path.exists(newname): |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
215 os.remove(newname) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
216 os.rename(ext_filename, newname) |
|
21959
3957d155f8c5
Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents:
21942
diff
changeset
|
217 |
|
28111
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
218 # XXX -- This relies on a Vile HACK in |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
219 # distutils.command.build_ext.build_extension(). The |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
220 # _built_objects attribute is stored there strictly for |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
221 # use here. |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
222 # If there is a failure, _built_objects may not be there, |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
223 # so catch the AttributeError and move on. |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
224 try: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
225 for filename in self._built_objects: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
226 os.remove(filename) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
227 except AttributeError: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
228 self.announce('unable to remove files (ignored)') |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
229 except: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
230 exc_type, why, tb = sys.exc_info() |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
231 self.announce('*** WARNING: importing extension "%s" ' |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
232 'failed with %s: %s' % (ext.name, exc_type, why), |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
233 level=3) |
|
21277
f702ff390e4d
Visious hackery to solve a build-control problem related to our use of
Fred Drake <fdrake@acm.org>
parents:
21274
diff
changeset
|
234 |
|
29508
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
235 def get_platform(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
236 # Get value of sys.platform |
|
29508
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
237 for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']: |
|
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
238 if sys.platform.startswith(platform): |
|
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
239 return platform |
|
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
240 return sys.platform |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
241 |
| 15940 | 242 def detect_modules(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
243 # Ensure that /usr/local is always used |
|
21742
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
244 add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
245 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
|
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
246 |
|
27002
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
247 # fink installs lots of goodies in /sw/... - make sure we |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
248 # check there |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
249 if sys.platform == "darwin": |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
250 add_dir_to_list(self.compiler.library_dirs, '/sw/lib') |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
251 add_dir_to_list(self.compiler.include_dirs, '/sw/include') |
|
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
252 |
| 24477 | 253 if os.path.normpath(sys.prefix) != '/usr': |
| 254 add_dir_to_list(self.compiler.library_dirs, | |
| 255 sysconfig.get_config_var("LIBDIR")) | |
| 256 add_dir_to_list(self.compiler.include_dirs, | |
| 257 sysconfig.get_config_var("INCLUDEDIR")) | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
258 |
|
19343
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
259 try: |
|
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
260 have_unicode = unicode |
|
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
261 except NameError: |
|
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
262 have_unicode = 0 |
|
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
263 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
264 # 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
|
265 # 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
|
266 # be assumed that no additional -I,-L directives are needed. |
|
32244
c8a22b5cf58a
Patch #926209: Patch to setup.py to run on x86_64 Linux.
Martin v. Löwis <martin@v.loewis.de>
parents:
32201
diff
changeset
|
267 lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib', '/usr/lib/lib64'] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
268 inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
| 15940 | 269 exts = [] |
| 270 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
271 platform = self.get_platform() |
|
21942
9d44e752d617
Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents:
21939
diff
changeset
|
272 (srcdir,) = sysconfig.get_config_vars('srcdir') |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
273 |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
274 # Check for AtheOS which has libraries in non-standard locations |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
275 if platform == 'atheos': |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
276 lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
277 lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
278 inc_dirs += ['/system/include', '/atheos/autolnk/include'] |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
279 inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
280 |
|
30770
e0841b5cf2fd
[Patch #772077 from Tim Rice] Fix for compiling the readline module on UnixWare; fix goofy comment indent. 2.3 bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
30731
diff
changeset
|
281 # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) |
|
e0841b5cf2fd
[Patch #772077 from Tim Rice] Fix for compiling the readline module on UnixWare; fix goofy comment indent. 2.3 bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
30731
diff
changeset
|
282 if platform in ['osf1', 'unixware7', 'openunix8']: |
|
29001
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
283 lib_dirs += ['/usr/ccs/lib'] |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
284 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
285 # 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
|
286 math_libs = ['m'] |
|
24008
44f7fc307673
Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
Jack Jansen <jack.jansen@cwi.nl>
parents:
23970
diff
changeset
|
287 if platform in ['darwin', 'beos', 'mac']: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
288 math_libs = [] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
289 |
| 15940 | 290 # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| 291 | |
| 292 # | |
| 293 # The following modules are all pretty straightforward, and compile | |
| 294 # on pretty much any POSIXish platform. | |
| 295 # | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
296 |
| 15940 | 297 # Some modules that are normally always on: |
| 298 exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
299 |
| 20397 | 300 exts.append( Extension('_hotshot', ['_hotshot.c']) ) |
|
16384
c898ceba2261
Add entries for the weakref module to the build control.
Fred Drake <fdrake@acm.org>
parents:
16287
diff
changeset
|
301 exts.append( Extension('_weakref', ['_weakref.c']) ) |
| 15951 | 302 exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) ) |
| 15940 | 303 |
| 304 # array objects | |
| 305 exts.append( Extension('array', ['arraymodule.c']) ) | |
| 306 # 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
|
307 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
|
308 libraries=math_libs) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
309 |
| 15940 | 310 # 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
|
311 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
|
312 libraries=math_libs) ) |
| 15940 | 313 # fast string operations implemented in C |
| 314 exts.append( Extension('strop', ['stropmodule.c']) ) | |
| 315 # 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
|
316 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
|
317 libraries=math_libs) ) |
|
32400
6ce67f7b0430
Add compilation of timemodule.c with datetimemodule.c to get
Brett Cannon <bcannon@gmail.com>
parents:
32244
diff
changeset
|
318 exts.append( Extension('datetime', ['datetimemodule.c', 'timemodule.c'], |
|
26674
c7ec8ad0234f
Build the datetime module for *n*x.
Guido van Rossum <guido@python.org>
parents:
26626
diff
changeset
|
319 libraries=math_libs) ) |
|
26829
f64c96922708
SF patch 658251: Install a C implementation of the Mersenne Twister as the
Raymond Hettinger <python@rcn.com>
parents:
26724
diff
changeset
|
320 # random number generator implemented in C |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
321 exts.append( Extension("_random", ["_randommodule.c"]) ) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
27507
diff
changeset
|
322 # fast iterator tools implemented in C |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
27507
diff
changeset
|
323 exts.append( Extension("itertools", ["itertoolsmodule.c"]) ) |
|
31436
63fa60f2d61c
* Move collections.deque() in from the sandbox
Raymond Hettinger <python@rcn.com>
parents:
31386
diff
changeset
|
324 # high-performance collections |
|
63fa60f2d61c
* Move collections.deque() in from the sandbox
Raymond Hettinger <python@rcn.com>
parents:
31386
diff
changeset
|
325 exts.append( Extension("collections", ["collectionsmodule.c"]) ) |
|
31353
ed20259a1ea5
SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents:
31090
diff
changeset
|
326 # bisect |
|
ed20259a1ea5
SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents:
31090
diff
changeset
|
327 exts.append( Extension("_bisect", ["_bisectmodule.c"]) ) |
|
30875
2acd28bd4d0f
Convert heapq.py to a C implementation.
Raymond Hettinger <python@rcn.com>
parents:
30770
diff
changeset
|
328 # heapq |
|
31931
63b68cb2b442
* Restore the pure python version of heapq.py.
Raymond Hettinger <python@rcn.com>
parents:
31742
diff
changeset
|
329 exts.append( Extension("_heapq", ["_heapqmodule.c"]) ) |
| 15940 | 330 # operator.add() and similar goodies |
| 331 exts.append( Extension('operator', ['operator.c']) ) | |
|
16416
7d39d9dcf2d6
Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents:
16415
diff
changeset
|
332 # 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
|
333 exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) |
| 15940 | 334 # static Unicode character database |
|
19343
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
335 if have_unicode: |
|
7257e87e0720
Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents:
19319
diff
changeset
|
336 exts.append( Extension('unicodedata', ['unicodedata.c']) ) |
| 15940 | 337 # access to ISO C locale support |
|
29471
4f076fc0195a
Patch #752671: NetBSD needs to link libintl to _locale.so.
Martin v. Löwis <martin@v.loewis.de>
parents:
29438
diff
changeset
|
338 data = open('pyconfig.h').read() |
|
4f076fc0195a
Patch #752671: NetBSD needs to link libintl to _locale.so.
Martin v. Löwis <martin@v.loewis.de>
parents:
29438
diff
changeset
|
339 m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data) |
|
4f076fc0195a
Patch #752671: NetBSD needs to link libintl to _locale.so.
Martin v. Löwis <martin@v.loewis.de>
parents:
29438
diff
changeset
|
340 if m is not None: |
|
24810
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
341 locale_libs = ['intl'] |
|
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
342 else: |
|
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
343 locale_libs = [] |
|
32698
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
344 if platform == 'darwin': |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
345 locale_extra_link_args = ['-framework', 'CoreFoundation'] |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
346 else: |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
347 locale_extra_link_args = [] |
|
32735
2bc66f1df7cc
Whitespace normalization. Ran reindent.py over the entire source tree.
Tim Peters <tim.peters@gmail.com>
parents:
32727
diff
changeset
|
348 |
|
32698
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
349 |
|
24810
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
350 exts.append( Extension('_locale', ['_localemodule.c'], |
|
32698
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
351 libraries=locale_libs, |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
352 extra_link_args=locale_extra_link_args) ) |
| 15940 | 353 |
| 354 # Modules with some UNIX dependencies -- on by default: | |
| 355 # (If you have a really backward UNIX, select and socket may not be | |
| 356 # supported...) | |
| 357 | |
| 358 # fcntl(2) and ioctl(2) | |
| 359 exts.append( Extension('fcntl', ['fcntlmodule.c']) ) | |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
360 if platform not in ['mac']: |
|
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
361 # pwd(3) |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
362 exts.append( Extension('pwd', ['pwdmodule.c']) ) |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
363 # grp(3) |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
364 exts.append( Extension('grp', ['grpmodule.c']) ) |
| 15940 | 365 # select(2); not on ancient System V |
| 366 exts.append( Extension('select', ['selectmodule.c']) ) | |
| 367 | |
| 368 # The md5 module implements the RSA Data Security, Inc. MD5 | |
| 21274 | 369 # Message-Digest Algorithm, described in RFC 1321. The |
| 370 # necessary files md5c.c and md5.h are included here. | |
| 15940 | 371 exts.append( Extension('md5', ['md5module.c', 'md5c.c']) ) |
| 372 | |
| 373 # The sha module implements the SHA checksum algorithm. | |
| 374 # (NIST's Secure Hash Algorithm.) | |
| 375 exts.append( Extension('sha', ['shamodule.c']) ) | |
| 376 | |
| 377 # Helper module for various ascii-encoders | |
| 378 exts.append( Extension('binascii', ['binascii.c']) ) | |
| 379 | |
| 380 # Fred Drake's interface to the Python parser | |
| 381 exts.append( Extension('parser', ['parsermodule.c']) ) | |
| 382 | |
|
22805
f1af8ad11000
Removed old Digital Creations copyright/license notices (with
Guido van Rossum <guido@python.org>
parents:
22545
diff
changeset
|
383 # cStringIO and cPickle |
| 15940 | 384 exts.append( Extension('cStringIO', ['cStringIO.c']) ) |
| 385 exts.append( Extension('cPickle', ['cPickle.c']) ) | |
| 386 | |
| 387 # Memory-mapped files (also works on Win32). | |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
388 if platform not in ['atheos', 'mac']: |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
389 exts.append( Extension('mmap', ['mmapmodule.c']) ) |
| 15940 | 390 |
| 391 # Lance Ellinghaus's modules: | |
| 392 # enigma-inspired encryption | |
| 393 exts.append( Extension('rotor', ['rotormodule.c']) ) | |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
394 if platform not in ['mac']: |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
395 # syslog daemon interface |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
396 exts.append( Extension('syslog', ['syslogmodule.c']) ) |
| 15940 | 397 |
| 398 # George Neville-Neil's timing module: | |
| 399 exts.append( Extension('timing', ['timingmodule.c']) ) | |
| 400 | |
| 401 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
402 # 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
|
403 # libraries, are platform-specific, or present other surprises. |
| 15940 | 404 # |
| 405 | |
| 406 # Multimedia modules | |
| 407 # These don't work for 64-bit platforms!!! | |
| 408 # These represent audio samples or images as strings: | |
| 409 | |
|
32763
8ad5a1620092
Move comment that goes along with audioop
Neal Norwitz <nnorwitz@gmail.com>
parents:
32762
diff
changeset
|
410 # Operations on audio samples |
|
32797
ea54fdb86530
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
32765
diff
changeset
|
411 # According to #993173, this one should actually work fine on |
|
32762
76ad814bc67c
Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents:
32735
diff
changeset
|
412 # 64-bit platforms. |
|
76ad814bc67c
Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents:
32735
diff
changeset
|
413 exts.append( Extension('audioop', ['audioop.c']) ) |
|
76ad814bc67c
Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents:
32735
diff
changeset
|
414 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
415 # Disabled on 64-bit platforms |
| 15940 | 416 if sys.maxint != 9223372036854775807L: |
| 417 # Operations on images | |
| 418 exts.append( Extension('imageop', ['imageop.c']) ) | |
| 419 # Read SGI RGB image files (but coded portably) | |
| 420 exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) | |
| 421 | |
| 422 # 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
|
423 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
|
424 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
|
425 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
|
426 'ncurses'): |
|
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
427 readline_libs.append('ncurses') |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
428 elif self.compiler.find_library_file(lib_dirs, 'curses'): |
|
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
429 readline_libs.append('curses') |
|
19319
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
430 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
|
431 ['/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
|
432 'termcap'): |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
433 readline_libs.append('termcap') |
| 15940 | 434 exts.append( Extension('readline', ['readline.c'], |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
435 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
|
436 libraries=readline_libs) ) |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
437 if platform not in ['mac']: |
|
30770
e0841b5cf2fd
[Patch #772077 from Tim Rice] Fix for compiling the readline module on UnixWare; fix goofy comment indent. 2.3 bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
30731
diff
changeset
|
438 # crypt module. |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
439 |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
440 if self.compiler.find_library_file(lib_dirs, 'crypt'): |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
441 libs = ['crypt'] |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
442 else: |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
443 libs = [] |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
444 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) |
| 15940 | 445 |
|
28341
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
446 # CSV files |
|
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
447 exts.append( Extension('_csv', ['_csv.c']) ) |
|
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
448 |
| 15940 | 449 # socket(2) |
|
23811
e3e019bc4e1e
Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents:
23777
diff
changeset
|
450 exts.append( Extension('_socket', ['socketmodule.c'], |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
451 depends = ['socketmodule.h']) ) |
|
21959
3957d155f8c5
Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents:
21942
diff
changeset
|
452 # Detect SSL support for the socket module (via _ssl) |
|
24520
175cd0e088aa
Revert last checkin. Man, that was stupid.
Michael W. Hudson <mwh@python.net>
parents:
24519
diff
changeset
|
453 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
|
454 ['/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
|
455 '/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
|
456 ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
457 ) |
|
29043
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
458 if ssl_incs is not None: |
|
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
459 krb5_h = find_file('krb5.h', inc_dirs, |
|
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
460 ['/usr/kerberos/include']) |
|
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
461 if krb5_h: |
|
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
462 ssl_incs += krb5_h |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
463 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
|
464 ['/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
|
465 '/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
|
466 ] ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
467 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
468 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
|
469 ssl_libs is not None): |
|
21959
3957d155f8c5
Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents:
21942
diff
changeset
|
470 exts.append( Extension('_ssl', ['_ssl.c'], |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
471 include_dirs = ssl_incs, |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
472 library_dirs = ssl_libs, |
|
23811
e3e019bc4e1e
Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents:
23777
diff
changeset
|
473 libraries = ['ssl', 'crypto'], |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
474 depends = ['socketmodule.h']), ) |
| 15940 | 475 |
| 476 # Modules that provide persistent dictionary-like semantics. You will | |
| 477 # probably want to arrange for at least one of them to be available on | |
| 478 # your machine, though none are defined by default because of library | |
| 479 # dependencies. The Python module anydbm.py provides an | |
| 480 # implementation independent wrapper for these; dumbdbm.py provides | |
| 481 # similar functionality (but slower of course) implemented in Python. | |
| 482 | |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
483 # Sleepycat Berkeley DB interface. http://www.sleepycat.com |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
484 # |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
485 # This requires the Sleepycat DB code. The earliest supported version |
|
30912
d432f82b986f
remove "support" for BerkeleyDB 3.1, it hasn't worked for a long time
Gregory P. Smith <greg@mad-scientist.com>
parents:
30875
diff
changeset
|
486 # of that library is 3.2, the latest supported version is 4.2. A list |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
487 # of available releases can be found at |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
488 # |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
489 # http://www.sleepycat.com/update/index.html |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
490 |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
491 # when sorted in reverse order, keys for this dict must appear in the |
|
26280
875140d30e17
Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185.
Martin v. Löwis <martin@v.loewis.de>
parents:
26137
diff
changeset
|
492 # order you wish to search - e.g., search for db4 before db3 |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
493 db_try_this = { |
|
30485
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
494 'db4': {'libs': ('db-4.2', 'db42', 'db-4.1', 'db41', 'db-4.0', 'db4',), |
|
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
495 'libdirs': ('/usr/local/BerkeleyDB.4.2/lib', |
|
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
496 '/usr/local/BerkeleyDB.4.1/lib', |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
497 '/usr/local/BerkeleyDB.4.0/lib', |
|
24841
3af8d81d7f86
Slight reordering of directories searched for BerkDB libs and include files.
Skip Montanaro <skip@pobox.com>
parents:
24810
diff
changeset
|
498 '/usr/local/lib', |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
499 '/opt/sfw', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
500 '/sw/lib', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
501 ), |
|
30485
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
502 'incdirs': ('/usr/local/BerkeleyDB.4.2/include', |
|
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
503 '/usr/local/include/db42', |
|
02257f6a682a
Add BerkeleyDB 4.2 to the library search for the bsddb module.
Gregory P. Smith <greg@mad-scientist.com>
parents:
30425
diff
changeset
|
504 '/usr/local/BerkeleyDB.4.1/include', |
|
29795
d7e1a1bd4880
patch #764612 - find DB 4.1/4.0/3.x on FreeBSD and systems with similar
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents:
29508
diff
changeset
|
505 '/usr/local/include/db41', |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
506 '/usr/local/BerkeleyDB.4.0/include', |
|
26137
a2ae635e43b6
Look in db4 directories when checking for db4.
Martin v. Löwis <martin@v.loewis.de>
parents:
26112
diff
changeset
|
507 '/usr/local/include/db4', |
|
a2ae635e43b6
Look in db4 directories when checking for db4.
Martin v. Löwis <martin@v.loewis.de>
parents:
26112
diff
changeset
|
508 '/opt/sfw/include/db4', |
|
a2ae635e43b6
Look in db4 directories when checking for db4.
Martin v. Löwis <martin@v.loewis.de>
parents:
26112
diff
changeset
|
509 '/sw/include/db4', |
|
a2ae635e43b6
Look in db4 directories when checking for db4.
Martin v. Löwis <martin@v.loewis.de>
parents:
26112
diff
changeset
|
510 '/usr/include/db4', |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
511 )}, |
|
30912
d432f82b986f
remove "support" for BerkeleyDB 3.1, it hasn't worked for a long time
Gregory P. Smith <greg@mad-scientist.com>
parents:
30875
diff
changeset
|
512 'db3': {'libs': ('db-3.3', 'db-3.2', 'db3',), |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
513 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
514 '/usr/local/BerkeleyDB.3.2/lib', |
|
24841
3af8d81d7f86
Slight reordering of directories searched for BerkDB libs and include files.
Skip Montanaro <skip@pobox.com>
parents:
24810
diff
changeset
|
515 '/usr/local/lib', |
|
26570
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
516 '/opt/sfw/lib', |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
517 '/sw/lib', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
518 ), |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
519 'incdirs': ('/usr/local/BerkeleyDB.3.3/include', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
520 '/usr/local/BerkeleyDB.3.2/include', |
|
24841
3af8d81d7f86
Slight reordering of directories searched for BerkDB libs and include files.
Skip Montanaro <skip@pobox.com>
parents:
24810
diff
changeset
|
521 '/usr/local/include/db3', |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
522 '/opt/sfw/include/db3', |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
523 '/sw/include/db3', |
|
24841
3af8d81d7f86
Slight reordering of directories searched for BerkDB libs and include files.
Skip Montanaro <skip@pobox.com>
parents:
24810
diff
changeset
|
524 '/usr/include/db3', |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
525 )}, |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
526 } |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
527 |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
528 db_search_order = db_try_this.keys() |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
529 db_search_order.sort() |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
530 db_search_order.reverse() |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
531 |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
532 class found(Exception): pass |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
533 try: |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
534 # See whether there is a Sleepycat header in the standard |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
535 # search path. |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
536 std_dbinc = None |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
537 for d in inc_dirs: |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
538 f = os.path.join(d, "db.h") |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
539 if os.path.exists(f): |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
540 f = open(f).read() |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
541 m = re.search(r"#define\WDB_VERSION_MAJOR\W([1-9]+)", f) |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
542 if m: |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
543 std_dbinc = 'db' + m.group(1) |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
544 for dbkey in db_search_order: |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
545 dbd = db_try_this[dbkey] |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
546 for dblib in dbd['libs']: |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
547 # Prefer version-specific includes over standard |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
548 # include locations. |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
549 db_incs = find_file('db.h', [], dbd['incdirs']) |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
550 dblib_dir = find_library_file(self.compiler, |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
551 dblib, |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
552 lib_dirs, |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
553 list(dbd['libdirs'])) |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
554 if (db_incs or dbkey == std_dbinc) and \ |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
555 dblib_dir is not None: |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
556 dblibs = [dblib] |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
557 raise found |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
558 except found: |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
559 dblibs = [dblib] |
|
23970
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
560 # A default source build puts Berkeley DB in something like |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
561 # /usr/local/Berkeley.3.3 and the lib dir under that isn't |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
562 # normally on ld.so's search path, unless the sysadmin has hacked |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
563 # /etc/ld.so.conf. We add the directory to runtime_library_dirs |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
564 # so the proper -R/--rpath flags get passed to the linker. This |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
565 # is usually correct and most trouble free, but may cause problems |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
566 # in some unusual system configurations (e.g. the directory is on |
|
a72997f7db4c
In the Extension() call, add runtime_library_dirs so that a useful
Barry Warsaw <barry@python.org>
parents:
23957
diff
changeset
|
567 # an NFS server that goes away). |
|
26280
875140d30e17
Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185.
Martin v. Löwis <martin@v.loewis.de>
parents:
26137
diff
changeset
|
568 exts.append(Extension('_bsddb', ['_bsddb.c'], |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
569 library_dirs=dblib_dir, |
|
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
570 runtime_library_dirs=dblib_dir, |
|
26280
875140d30e17
Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185.
Martin v. Löwis <martin@v.loewis.de>
parents:
26137
diff
changeset
|
571 include_dirs=db_incs, |
|
875140d30e17
Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185.
Martin v. Löwis <martin@v.loewis.de>
parents:
26137
diff
changeset
|
572 libraries=dblibs)) |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
573 else: |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
574 db_incs = None |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
575 dblibs = [] |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
576 dblib_dir = None |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
577 |
|
29001
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
578 |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
579 # Look for Berkeley db 1.85. Note that it is built as a different |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
580 # module name so it can be included even when later versions are |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
581 # available. A very restrictive search is performed to avoid |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
582 # accidentally building this module with a later version of the |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
583 # underlying db library. May BSD-ish Unixes incorporate db 1.85 |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
584 # symbols into libc and place the include file in /usr/include. |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
585 f = "/usr/include/db.h" |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
586 if os.path.exists(f): |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
587 data = open(f).read() |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
588 m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
589 if m is not None: |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
590 # bingo - old version used hash file format version 2 |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
591 ### XXX this should be fixed to not be platform-dependent |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
592 ### but I don't have direct access to an osf1 platform and |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
593 ### seemed to be muffing the search somehow |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
594 libraries = platform == "osf1" and ['db'] or None |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
595 if libraries is not None: |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
596 exts.append(Extension('bsddb185', ['bsddbmodule.c'], |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
597 libraries=libraries)) |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
598 else: |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
599 exts.append(Extension('bsddb185', ['bsddbmodule.c'])) |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
600 |
| 15940 | 601 # The standard Unix dbm module: |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
602 if platform not in ['cygwin']: |
|
26570
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
603 if find_file("ndbm.h", inc_dirs, []) is not None: |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
604 # Some systems have -lndbm, others don't |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
605 if self.compiler.find_library_file(lib_dirs, 'ndbm'): |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
606 ndbm_libs = ['ndbm'] |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
607 else: |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
608 ndbm_libs = [] |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
609 exts.append( Extension('dbm', ['dbmmodule.c'], |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
610 define_macros=[('HAVE_NDBM_H',None)], |
|
26570
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
611 libraries = ndbm_libs ) ) |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
612 elif (self.compiler.find_library_file(lib_dirs, 'gdbm') |
|
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
613 and find_file("gdbm/ndbm.h", inc_dirs, []) is not None): |
|
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
614 exts.append( Extension('dbm', ['dbmmodule.c'], |
|
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
615 define_macros=[('HAVE_GDBM_NDBM_H',None)], |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
616 libraries = ['gdbm'] ) ) |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
617 elif db_incs is not None: |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
618 exts.append( Extension('dbm', ['dbmmodule.c'], |
|
26570
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
619 library_dirs=dblib_dir, |
|
2aba1ac4744c
Correct db3 /opt/sfw library path. Link ndbm with libc only if ndbm.h
Martin v. Löwis <martin@v.loewis.de>
parents:
26548
diff
changeset
|
620 runtime_library_dirs=dblib_dir, |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
621 include_dirs=db_incs, |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
622 define_macros=[('HAVE_BERKDB_H',None), |
|
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
623 ('DB_DBM_HSEARCH',None)], |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
624 libraries=dblibs)) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
625 |
| 15940 | 626 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: |
| 627 if (self.compiler.find_library_file(lib_dirs, 'gdbm')): | |
| 628 exts.append( Extension('gdbm', ['gdbmmodule.c'], | |
| 629 libraries = ['gdbm'] ) ) | |
| 630 | |
| 631 # 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
|
632 # You need to ftp the GNU MP library. |
| 15940 | 633 # This was originally written and tested against GMP 1.2 and 1.3.2. |
| 634 # It has been modified by Rob Hooft to work with 2.0.2 as well, but I | |
|
21452
fb6b3fc4e0c1
Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents:
21391
diff
changeset
|
635 # haven't tested it recently, and it definitely doesn't work with |
|
fb6b3fc4e0c1
Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents:
21391
diff
changeset
|
636 # GMP 4.0. For more complete modules, refer to |
|
fb6b3fc4e0c1
Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents:
21391
diff
changeset
|
637 # http://gmpy.sourceforge.net and |
|
fb6b3fc4e0c1
Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents:
21391
diff
changeset
|
638 # http://www.egenix.com/files/python/mxNumber.html |
| 15940 | 639 |
|
20234
7ea61da878af
Fix a spelling error that has been bugging me for longer than I care to admit.
Greg Ward <gward@python.net>
parents:
19968
diff
changeset
|
640 # A compatible MP library unencumbered by the GPL also exists. It was |
| 15940 | 641 # posted to comp.sources.misc in volume 40 and is widely available from |
| 642 # FTP archive sites. One URL for it is: | |
| 643 # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z | |
| 644 | |
| 645 if (self.compiler.find_library_file(lib_dirs, 'gmp')): | |
| 646 exts.append( Extension('mpz', ['mpzmodule.c'], | |
| 647 libraries = ['gmp'] ) ) | |
| 648 | |
| 649 | |
| 650 # Unix-only modules | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
651 if platform not in ['mac', 'win32']: |
| 15940 | 652 # Steen Lumholt's termios module |
| 653 exts.append( Extension('termios', ['termios.c']) ) | |
| 654 # Jeremy Hylton's rlimit interface | |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
655 if platform not in ['atheos']: |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
656 exts.append( Extension('resource', ['resource.c']) ) |
| 15940 | 657 |
|
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
|
658 # Sun yellow pages. Some systems have the functions in libc. |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
659 if platform not in ['cygwin', 'atheos']: |
|
16804
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
660 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
|
661 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
|
662 else: |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
663 libs = [] |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
664 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
|
665 libraries = libs) ) |
| 15940 | 666 |
|
31468
de2ed800fa50
a couple other sunos4 support items removed
Skip Montanaro <skip@pobox.com>
parents:
31436
diff
changeset
|
667 # Curses support, requiring 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
|
668 # provided by the ncurses library. |
| 15940 | 669 if (self.compiler.find_library_file(lib_dirs, 'ncurses')): |
| 670 curses_libs = ['ncurses'] | |
| 671 exts.append( Extension('_curses', ['_cursesmodule.c'], | |
| 672 libraries = curses_libs) ) | |
| 21274 | 673 elif (self.compiler.find_library_file(lib_dirs, 'curses') |
| 674 and platform != 'darwin'): | |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
675 # OSX has an old Berkeley curses, not good enough for |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
676 # the _curses module. |
| 15940 | 677 if (self.compiler.find_library_file(lib_dirs, 'terminfo')): |
| 678 curses_libs = ['curses', 'terminfo'] | |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
679 elif (self.compiler.find_library_file(lib_dirs, 'termcap')): |
|
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
680 curses_libs = ['curses', 'termcap'] |
| 15940 | 681 else: |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
682 curses_libs = ['curses'] |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
683 |
| 15940 | 684 exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 685 libraries = curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
686 |
| 15940 | 687 # If the curses module is enabled, check for the panel module |
|
21256
fbf68c59d66c
[Bug #480882] Remove now-pointless check for existence for _curses_panel.c;
Andrew M. Kuchling <amk@amk.ca>
parents:
21233
diff
changeset
|
688 if (module_enabled(exts, '_curses') and |
| 15940 | 689 self.compiler.find_library_file(lib_dirs, 'panel')): |
| 690 exts.append( Extension('_curses_panel', ['_curses_panel.c'], | |
| 691 libraries = ['panel'] + curses_libs) ) | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
692 |
|
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
693 |
|
24790
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
694 # Andrew Kuchling's zlib module. Note that some versions of zlib |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
695 # 1.1.3 have security problems. See CERT Advisory CA-2002-07: |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
696 # http://www.cert.org/advisories/CA-2002-07.html |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
697 # |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
698 # zlib 1.1.4 is fixed, but at least one vendor (RedHat) has decided to |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
699 # patch its zlib 1.1.3 package instead of upgrading to 1.1.4. For |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
700 # now, we still accept 1.1.3, because we think it's difficult to |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
701 # exploit this in Python, and we'd rather make it RedHat's problem |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
702 # than our problem <wink>. |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
703 # |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
704 # You can upgrade zlib to version 1.1.4 yourself by going to |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
705 # http://www.gzip.org/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
|
706 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
|
707 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
|
708 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
|
709 version = '"0.0.0"' |
|
24790
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
710 version_req = '"1.1.3"' |
|
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
|
711 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
|
712 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
|
713 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
|
714 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
|
715 break |
|
24605
fd4575b56a4d
Update the URL for getting zlib, and update the minimal required
Guido van Rossum <guido@python.org>
parents:
24579
diff
changeset
|
716 if line.startswith('#define ZLIB_VERSION'): |
|
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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 libraries = ['z']) ) |
| 15940 | 723 |
|
26037
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
724 # Gustavo Niemeyer's bz2 module. |
|
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
725 if (self.compiler.find_library_file(lib_dirs, 'bz2')): |
|
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
726 exts.append( Extension('bz2', ['bz2module.c'], |
|
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
727 libraries = ['bz2']) ) |
|
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
728 |
| 15940 | 729 # Interface to the Expat XML parser |
| 730 # | |
|
23889
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
731 # Expat was written by James Clark and is now maintained by a |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
732 # group of developers on SourceForge; see www.libexpat.org for |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
733 # more information. The pyexpat module was written by Paul |
|
30425
d864f3168cac
Remove possibly-misleading Expat version
Andrew M. Kuchling <amk@amk.ca>
parents:
29795
diff
changeset
|
734 # Prescod after a prototype by Jack Jansen. The Expat source |
|
d864f3168cac
Remove possibly-misleading Expat version
Andrew M. Kuchling <amk@amk.ca>
parents:
29795
diff
changeset
|
735 # is included in Modules/expat/. Usage of a system |
|
23889
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
736 # shared libexpat.so/expat.dll is not advised. |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
737 # |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
738 # More information on Expat can be found at www.libexpat.org. |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
739 # |
|
21932
ab68ad43d514
Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents:
21788
diff
changeset
|
740 if sys.byteorder == "little": |
|
27384
d363f83c2846
Incorporate Expat 1.95.6.
Martin v. Löwis <martin@v.loewis.de>
parents:
27331
diff
changeset
|
741 xmlbo = "1234" |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
742 else: |
|
27384
d363f83c2846
Incorporate Expat 1.95.6.
Martin v. Löwis <martin@v.loewis.de>
parents:
27331
diff
changeset
|
743 xmlbo = "4321" |
|
21942
9d44e752d617
Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents:
21939
diff
changeset
|
744 expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat') |
|
30731
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
745 define_macros = [ |
|
21932
ab68ad43d514
Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents:
21788
diff
changeset
|
746 ('XML_NS', '1'), |
|
ab68ad43d514
Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents:
21788
diff
changeset
|
747 ('XML_DTD', '1'), |
|
27384
d363f83c2846
Incorporate Expat 1.95.6.
Martin v. Löwis <martin@v.loewis.de>
parents:
27331
diff
changeset
|
748 ('BYTEORDER', xmlbo), |
|
21932
ab68ad43d514
Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents:
21788
diff
changeset
|
749 ('XML_CONTEXT_BYTES','1024'), |
|
30731
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
750 ] |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
751 config_h = sysconfig.get_config_h_filename() |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
752 config_h_vars = sysconfig.parse_config_h(open(config_h)) |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
753 for feature_macro in ['HAVE_MEMMOVE', 'HAVE_BCOPY']: |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
754 if config_h_vars.has_key(feature_macro): |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
755 define_macros.append((feature_macro, '1')) |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
756 exts.append(Extension('pyexpat', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
757 define_macros = define_macros, |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
758 include_dirs = [expatinc], |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
759 sources = ['pyexpat.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
760 'expat/xmlparse.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
761 'expat/xmlrole.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
762 'expat/xmltok.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
763 ], |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
764 )) |
| 15940 | 765 |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
31353
diff
changeset
|
766 # Hye-Shik Chang's CJKCodecs modules. |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
31353
diff
changeset
|
767 exts.append(Extension('_multibytecodec', |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
31353
diff
changeset
|
768 ['cjkcodecs/multibytecodec.c'])) |
|
32727
69dadc2ca14d
Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
Hye-Shik Chang <hyeshik@gmail.com>
parents:
32698
diff
changeset
|
769 for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'): |
|
69dadc2ca14d
Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
Hye-Shik Chang <hyeshik@gmail.com>
parents:
32698
diff
changeset
|
770 exts.append(Extension('_codecs_' + loc, |
|
69dadc2ca14d
Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
Hye-Shik Chang <hyeshik@gmail.com>
parents:
32698
diff
changeset
|
771 ['cjkcodecs/_codecs_%s.c' % loc])) |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
31353
diff
changeset
|
772 |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
773 # Dynamic loading module |
|
25232
aac1ee966f56
Only build the 'dl' extension when sys.maxint equals 2**31-1.
Guido van Rossum <guido@python.org>
parents:
25075
diff
changeset
|
774 if sys.maxint == 0x7fffffff: |
|
aac1ee966f56
Only build the 'dl' extension when sys.maxint equals 2**31-1.
Guido van Rossum <guido@python.org>
parents:
25075
diff
changeset
|
775 # This requires sizeof(int) == sizeof(long) == sizeof(char*) |
|
aac1ee966f56
Only build the 'dl' extension when sys.maxint equals 2**31-1.
Guido van Rossum <guido@python.org>
parents:
25075
diff
changeset
|
776 dl_inc = find_file('dlfcn.h', [], inc_dirs) |
|
27930
850c0da101b6
Don't try to build dl on darwin. It doesn't build out of the box, and it
Jack Jansen <jack.jansen@cwi.nl>
parents:
27865
diff
changeset
|
777 if (dl_inc is not None) and (platform not in ['atheos', 'darwin']): |
|
25232
aac1ee966f56
Only build the 'dl' extension when sys.maxint equals 2**31-1.
Guido van Rossum <guido@python.org>
parents:
25075
diff
changeset
|
778 exts.append( Extension('dl', ['dlmodule.c']) ) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
779 |
| 15940 | 780 # Platform-specific libraries |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
781 if platform == 'linux2': |
| 15940 | 782 # Linux-specific modules |
| 783 exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) | |
|
27149
5ed820670af3
Add reminder that ossaudiodev can/should also be built on FreeBSD.
Greg Ward <gward@python.net>
parents:
27148
diff
changeset
|
784 |
|
32765
50ece3d4ff37
ossaudiodev is available on FreeBSD 5 too.
Hye-Shik Chang <hyeshik@gmail.com>
parents:
32763
diff
changeset
|
785 if platform in ('linux2', 'freebsd4', 'freebsd5'): |
|
27865
65494469ad3e
Re-enable compiling ossaudiodev now that it seems to work again.
Guido van Rossum <guido@python.org>
parents:
27820
diff
changeset
|
786 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) |
| 15940 | 787 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
788 if platform == 'sunos5': |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
789 # SunOS specific modules |
| 15940 | 790 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
791 |
|
21233
803ccbe3ee7c
As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents:
21039
diff
changeset
|
792 if platform == 'darwin': |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
793 # Mac OS X specific modules. |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
794 exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'], |
|
22159
71902e1cfbef
Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents:
22104
diff
changeset
|
795 extra_link_args=['-framework', 'CoreFoundation']) ) |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
796 |
|
29253
b4c92e9803a6
Somehow ColorPicker has never been included or tested under darwin, but it works just fine.
Just van Rossum <just@letterror.com>
parents:
29043
diff
changeset
|
797 exts.append( Extension('ColorPicker', ['ColorPickermodule.c'], |
|
b4c92e9803a6
Somehow ColorPicker has never been included or tested under darwin, but it works just fine.
Just van Rossum <just@letterror.com>
parents:
29043
diff
changeset
|
798 extra_link_args=['-framework', 'Carbon']) ) |
|
28940
fa057824c9b4
build the new autoGIL module on OSX
Just van Rossum <just@letterror.com>
parents:
28661
diff
changeset
|
799 exts.append( Extension('autoGIL', ['autoGIL.c'], |
|
fa057824c9b4
build the new autoGIL module on OSX
Just van Rossum <just@letterror.com>
parents:
28661
diff
changeset
|
800 extra_link_args=['-framework', 'CoreFoundation']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
801 exts.append( Extension('gestalt', ['gestaltmodule.c'], |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
802 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
803 exts.append( Extension('MacOS', ['macosmodule.c'], |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
804 extra_link_args=['-framework', 'Carbon']) ) |
|
28208
439101d4705b
Build the OSATerminology module on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28137
diff
changeset
|
805 exts.append( Extension('OSATerminology', ['OSATerminology.c'], |
|
439101d4705b
Build the OSATerminology module on MacOSX.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28137
diff
changeset
|
806 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
807 exts.append( Extension('icglue', ['icgluemodule.c'], |
|
25075
31a774a6f604
Revived the Carbon.Help module, but implementing the MacHelp API in stead
Jack Jansen <jack.jansen@cwi.nl>
parents:
24841
diff
changeset
|
808 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
809 exts.append( Extension('_Res', ['res/_Resmodule.c'], |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
810 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
811 exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
812 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
813 exts.append( Extension('Nav', ['Nav.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
814 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
815 exts.append( Extension('_AE', ['ae/_AEmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
816 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
817 exts.append( Extension('_AH', ['ah/_AHmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
818 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
819 exts.append( Extension('_App', ['app/_Appmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
820 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
821 exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
822 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
823 exts.append( Extension('_CG', ['cg/_CGmodule.c'], |
|
28137
789b24d65d42
_CG module only needs the ApplicationServices framework, not Carbon.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28111
diff
changeset
|
824 extra_link_args=['-framework', 'ApplicationServices']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
825 exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
826 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
827 exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
828 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
829 exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
830 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
831 exts.append( Extension('_Drag', ['drag/_Dragmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
832 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
833 exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
834 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
835 exts.append( Extension('_File', ['file/_Filemodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
836 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
837 exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
838 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
839 exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
840 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
841 exts.append( Extension('_Help', ['help/_Helpmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
842 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
843 exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
844 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
845 exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
846 extra_link_args=['-framework', 'Carbon']) ) |
|
31075
5b515cc90b5a
An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
30912
diff
changeset
|
847 exts.append( Extension('_Launch', ['launch/_Launchmodule.c'], |
|
5b515cc90b5a
An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
30912
diff
changeset
|
848 extra_link_args=['-framework', 'ApplicationServices']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
849 exts.append( Extension('_List', ['list/_Listmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
850 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
851 exts.append( Extension('_Menu', ['menu/_Menumodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
852 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
853 exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
854 extra_link_args=['-framework', 'Carbon']) ) |
|
31090
0a7f1a53c773
Adding an interface to the high-level Open Scripting Architecture,
Jack Jansen <jack.jansen@cwi.nl>
parents:
31075
diff
changeset
|
855 exts.append( Extension('_OSA', ['osa/_OSAmodule.c'], |
|
0a7f1a53c773
Adding an interface to the high-level Open Scripting Architecture,
Jack Jansen <jack.jansen@cwi.nl>
parents:
31075
diff
changeset
|
856 extra_link_args=['-framework', 'Carbon']) ) |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
857 exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
858 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
859 exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
860 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
861 exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
862 extra_link_args=['-framework', 'QuickTime', |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
863 '-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
864 exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
865 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
866 exts.append( Extension('_TE', ['te/_TEmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
867 extra_link_args=['-framework', 'Carbon']) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
868 # As there is no standardized place (yet) to put |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
869 # user-installed Mac libraries on OSX, we search for "waste" |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
870 # in parent directories of the Python source tree. You |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
871 # should put a symlink to your Waste installation in the |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
872 # same folder as your python source tree. Or modify the |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
873 # next few lines:-) |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
874 waste_incs = find_file("WASTE.h", [], |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
875 ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
876 waste_libs = find_library_file(self.compiler, "WASTE", [], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
877 ["../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
878 if waste_incs != None and waste_libs != None: |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
879 (srcdir,) = sysconfig.get_config_vars('srcdir') |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
880 exts.append( Extension('waste', |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
881 ['waste/wastemodule.c'] + [ |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
882 os.path.join(srcdir, d) for d in |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
883 'Mac/Wastemods/WEObjectHandlers.c', |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
884 'Mac/Wastemods/WETabHooks.c', |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
885 'Mac/Wastemods/WETabs.c' |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
886 ], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
887 include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
888 library_dirs = waste_libs, |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
889 libraries = ['WASTE'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
890 extra_link_args = ['-framework', 'Carbon'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
891 ) ) |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
892 exts.append( Extension('_Win', ['win/_Winmodule.c'], |
|
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
893 extra_link_args=['-framework', 'Carbon']) ) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
894 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
895 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
|
896 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
897 # 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
|
898 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
|
899 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
900 def detect_tkinter_darwin(self, inc_dirs, lib_dirs): |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
901 # The _tkinter module, using frameworks. Since frameworks are quite |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
902 # different the UNIX search logic is not sharable. |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
903 from os.path import join, exists |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
904 framework_dirs = [ |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
905 '/System/Library/Frameworks/', |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
906 '/Library/Frameworks', |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
907 join(os.getenv('HOME'), '/Library/Frameworks') |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
908 ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
909 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
910 # Find the directory that contains the Tcl.framwork and Tk.framework |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
911 # bundles. |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
912 # XXX distutils should support -F! |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
913 for F in framework_dirs: |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
914 # both Tcl.framework and Tk.framework should be present |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
915 for fw in 'Tcl', 'Tk': |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
916 if not exists(join(F, fw + '.framework')): |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
917 break |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
918 else: |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
919 # ok, F is now directory with both frameworks. Continure |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
920 # building |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
921 break |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
922 else: |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
923 # Tk and Tcl frameworks not found. Normal "unix" tkinter search |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
924 # will now resume. |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
925 return 0 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
926 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
927 # For 8.4a2, we must add -I options that point inside the Tcl and Tk |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
928 # frameworks. In later release we should hopefully be able to pass |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
929 # the -F option to gcc, which specifies a framework lookup path. |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
930 # |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
931 include_dirs = [ |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
932 join(F, fw + '.framework', H) |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
933 for fw in 'Tcl', 'Tk' |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
934 for H in 'Headers', 'Versions/Current/PrivateHeaders' |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
935 ] |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
936 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
937 # For 8.4a2, the X11 headers are not included. Rather than include a |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
938 # complicated search, this is a hard-coded path. It could bail out |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
939 # if X11 libs are not found... |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
940 include_dirs.append('/usr/X11R6/include') |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
941 frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
942 |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
943 ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
944 define_macros=[('WITH_APPINIT', 1)], |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
945 include_dirs = include_dirs, |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
946 libraries = [], |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
947 extra_compile_args = frameworks, |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
948 extra_link_args = frameworks, |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
949 ) |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
950 self.extensions.append(ext) |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
951 return 1 |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
952 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
953 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
954 def detect_tkinter(self, inc_dirs, lib_dirs): |
| 15940 | 955 # The _tkinter module. |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
956 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
957 # Rather than complicate the code below, detecting and building |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
958 # AquaTk is a separate method. Only one Tkinter will be built on |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
959 # Darwin - either AquaTk, if it is found, or X11 based Tk. |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
960 platform = self.get_platform() |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
961 if platform == 'darwin' and \ |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
962 self.detect_tkinter_darwin(inc_dirs, lib_dirs): |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
963 return |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
964 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
965 # 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
|
966 # 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
|
967 # 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
|
968 tcllib = tklib = tcl_includes = tk_includes = None |
|
31742
c061f25f74e0
[Patch #905863] Support the CVS version of Tcl/Tk, which has the version number 8.5
Andrew M. Kuchling <amk@amk.ca>
parents:
31741
diff
changeset
|
969 for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2', |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
970 '82', '8.1', '81', '8.0', '80']: |
|
27694
7c4dda0c145f
This patch enables Cygwin Python to build _tkinter against Tcl/Tk 8.4.
Jason Tishler <jason@tishler.net>
parents:
27598
diff
changeset
|
971 tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) |
|
7c4dda0c145f
This patch enables Cygwin Python to build _tkinter against Tcl/Tk 8.4.
Jason Tishler <jason@tishler.net>
parents:
27598
diff
changeset
|
972 tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version) |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
973 if tklib and tcllib: |
| 15940 | 974 # Exit the loop when we've found the Tcl/Tk libraries |
| 975 break | |
| 976 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
977 # 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
|
978 if tklib and tcllib: |
|
31741
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
979 # Check for the include files on Debian and {Free,Open}BSD, where |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
980 # they're put in /usr/include/{tcl,tk}X.Y |
|
31741
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
981 dotversion = version |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
982 if '.' not in dotversion and "bsd" in sys.platform.lower(): |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
983 # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
984 # but the include subdirs are named like .../include/tcl8.3. |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
985 dotversion = dotversion[:-1] + '.' + dotversion[-1] |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
986 tcl_include_sub = [] |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
987 tk_include_sub = [] |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
988 for dir in inc_dirs: |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
989 tcl_include_sub += [dir + os.sep + "tcl" + dotversion] |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
990 tk_include_sub += [dir + os.sep + "tk" + dotversion] |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
991 tk_include_sub += tcl_include_sub |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
992 tcl_includes = find_file('tcl.h', inc_dirs, tcl_include_sub) |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
993 tk_includes = find_file('tk.h', inc_dirs, tk_include_sub) |
| 15940 | 994 |
|
28947
8df897f14fb8
Change 'and' to 'or' in _tkinter test.
Martin v. Löwis <martin@v.loewis.de>
parents:
28940
diff
changeset
|
995 if (tcllib is None or tklib is None or |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
996 tcl_includes is None or tk_includes is None): |
|
31741
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
997 self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
998 return |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
999 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1000 # OK... everything seems to be present for Tcl/Tk. |
| 15940 | 1001 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1002 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
|
1003 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
|
1004 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
|
1005 include_dirs.append(dir) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1006 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1007 # 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
|
1008 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
|
1009 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
|
1010 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
|
1011 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
|
1012 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
|
1013 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
|
1014 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
|
1015 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
|
1016 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
|
1017 else: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1018 # 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
|
1019 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
|
1020 added_lib_dirs.append('/usr/X11/lib') |
| 15940 | 1021 |
|
27695
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1022 # If Cygwin, then verify that X is installed before proceeding |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1023 if platform == 'cygwin': |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1024 x11_inc = find_file('X11/Xlib.h', [], include_dirs) |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1025 if x11_inc is None: |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1026 return |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1027 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1028 # Check for BLT extension |
| 21274 | 1029 if self.compiler.find_library_file(lib_dirs + added_lib_dirs, |
| 1030 'BLT8.0'): | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1031 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
|
1032 libs.append('BLT8.0') |
|
26626
e41ee2b8e73d
Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents:
26616
diff
changeset
|
1033 elif self.compiler.find_library_file(lib_dirs + added_lib_dirs, |
|
e41ee2b8e73d
Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents:
26616
diff
changeset
|
1034 'BLT'): |
|
e41ee2b8e73d
Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents:
26616
diff
changeset
|
1035 defs.append( ('WITH_BLT', 1) ) |
|
e41ee2b8e73d
Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents:
26616
diff
changeset
|
1036 libs.append('BLT') |
| 15940 | 1037 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1038 # Add the Tcl/Tk libraries |
|
27694
7c4dda0c145f
This patch enables Cygwin Python to build _tkinter against Tcl/Tk 8.4.
Jason Tishler <jason@tishler.net>
parents:
27598
diff
changeset
|
1039 libs.append('tk'+ version) |
|
7c4dda0c145f
This patch enables Cygwin Python to build _tkinter against Tcl/Tk 8.4.
Jason Tishler <jason@tishler.net>
parents:
27598
diff
changeset
|
1040 libs.append('tcl'+ version) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1041 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
1042 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
|
1043 libs.append('ld') |
| 15940 | 1044 |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
1045 # 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
|
1046 if platform != "cygwin": |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
1047 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
|
1048 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1049 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
|
1050 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
|
1051 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
|
1052 libraries = libs, |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1053 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
|
1054 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1055 self.extensions.append(ext) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1056 |
|
27820
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1057 ## # Uncomment these lines if you want to play with xxmodule.c |
|
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1058 ## ext = Extension('xx', ['xxmodule.c']) |
|
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1059 ## self.extensions.append(ext) |
|
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1060 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1061 # XXX handle these, but how to detect? |
| 15940 | 1062 # *** 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
|
1063 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ |
| 15940 | 1064 # *** 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
|
1065 # -DWITH_TOGL togl.c \ |
| 15940 | 1066 # *** Uncomment these for TOGL extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1067 # -lGL -lGLU -lXext -lXmu \ |
| 15940 | 1068 |
|
17886
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
1069 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
|
1070 # 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
|
1071 # 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
|
1072 # installation: |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
1073 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
|
1074 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
|
1075 self.warn_dir=0 |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
1076 |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1077 class PyBuildInstallLib(install_lib): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1078 # Do exactly what install_lib does but make sure correct access modes get |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1079 # set on installed directories and files. All installed files with get |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1080 # mode 644 unless they are a shared library in which case they will get |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1081 # mode 755. All installed directories will get mode 755. |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1082 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1083 so_ext = sysconfig.get_config_var("SO") |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1084 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1085 def install(self): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1086 outfiles = install_lib.install(self) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1087 self.set_file_modes(outfiles, 0644, 0755) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1088 self.set_dir_modes(self.install_dir, 0755) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1089 return outfiles |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1090 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1091 def set_file_modes(self, files, defaultMode, sharedLibMode): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1092 if not self.is_chmod_supported(): return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1093 if not files: return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1094 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1095 for filename in files: |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1096 if os.path.islink(filename): continue |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1097 mode = defaultMode |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1098 if filename.endswith(self.so_ext): mode = sharedLibMode |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1099 log.info("changing mode of %s to %o", filename, mode) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1100 if not self.dry_run: os.chmod(filename, mode) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1101 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1102 def set_dir_modes(self, dirname, mode): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1103 if not self.is_chmod_supported(): return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1104 os.path.walk(dirname, self.set_dir_modes_visitor, mode) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1105 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1106 def set_dir_modes_visitor(self, mode, dirname, names): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1107 if os.path.islink(dirname): return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1108 log.info("changing mode of %s to %o", dirname, mode) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1109 if not self.dry_run: os.chmod(dirname, mode) |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1110 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1111 def is_chmod_supported(self): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1112 return hasattr(os, 'chmod') |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1113 |
|
27990
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1114 SUMMARY = """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1115 Python is an interpreted, interactive, object-oriented programming |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1116 language. It is often compared to Tcl, Perl, Scheme or Java. |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1117 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1118 Python combines remarkable power with very clear syntax. It has |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1119 modules, classes, exceptions, very high level dynamic data types, and |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1120 dynamic typing. There are interfaces to many system calls and |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1121 libraries, as well as to various windowing systems (X11, Motif, Tk, |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1122 Mac, MFC). New built-in modules are easily written in C or C++. Python |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1123 is also usable as an extension language for applications that need a |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1124 programmable interface. |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1125 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1126 The Python implementation is portable: it runs on many brands of UNIX, |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1127 on Windows, DOS, OS/2, Mac, Amiga... If your favorite system isn't |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1128 listed here, it may still be supported, if there's a C compiler for |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1129 it. Ask around on comp.lang.python -- or just try compiling Python |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1130 yourself. |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1131 """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1132 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1133 CLASSIFIERS = """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1134 Development Status :: 3 - Alpha |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1135 Development Status :: 6 - Mature |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1136 License :: OSI Approved :: Python Software Foundation License |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1137 Natural Language :: English |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1138 Programming Language :: C |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1139 Programming Language :: Python |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1140 Topic :: Software Development |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1141 """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1142 |
| 15940 | 1143 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
|
1144 # 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
|
1145 import warnings |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
1146 warnings.filterwarnings("ignore",category=DeprecationWarning) |
|
27990
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1147 setup(# PyPI Metadata (PEP 301) |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1148 name = "Python", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1149 version = sys.version.split()[0], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1150 url = "http://www.python.org/%s" % sys.version[:3], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1151 maintainer = "Guido van Rossum and the Python community", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1152 maintainer_email = "python-dev@python.org", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1153 description = "A high-level object-oriented programming language", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1154 long_description = SUMMARY.strip(), |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1155 license = "PSF license", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1156 classifiers = filter(None, CLASSIFIERS.split("\n")), |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1157 platforms = ["Many"], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1158 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1159 # Build info |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1160 cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1161 'install_lib':PyBuildInstallLib}, |
| 15940 | 1162 # The struct module is defined here, because build_ext won't be |
| 1163 # called unless there's at least one extension module defined. | |
| 16844 | 1164 ext_modules=[Extension('struct', ['structmodule.c'])], |
| 1165 | |
| 1166 # Scripts to install | |
|
32416
950cf69c69b6
Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents:
32400
diff
changeset
|
1167 scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', |
|
950cf69c69b6
Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents:
32400
diff
changeset
|
1168 'Lib/smtpd.py'] |
| 15940 | 1169 ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1170 |
| 15940 | 1171 # --install-platlib |
| 1172 if __name__ == '__main__': | |
| 1173 main() |
