Mercurial > cpython-lru_cache-weakref
annotate setup.py @ 42775:d7517c306791
Merged revisions 57221-57391 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57227 | facundo.batista | 2007-08-20 17:16:21 -0700 (Mon, 20 Aug 2007) | 5 lines
Catch ProtocolError exceptions and include the header information in
test output (to make it easier to debug test failures caused by
problems in the server). [GSoC - Alan McIntyre]
........
r57229 | mark.hammond | 2007-08-20 18:04:47 -0700 (Mon, 20 Aug 2007) | 5 lines
[ 1761786 ] distutils.util.get_platform() return value on 64bit Windows
As discussed on distutils-sig: Allows the generated installer name on
64bit Windows platforms to be different than the name generated for
32bit Windows platforms.
........
r57230 | mark.hammond | 2007-08-20 18:05:16 -0700 (Mon, 20 Aug 2007) | 5 lines
[ 1761786 ] distutils.util.get_platform() return value on 64bit Windows
As discussed on distutils-sig: Allows the generated installer name on
64bit Windows platforms to be different than the name generated for
32bit Windows platforms.
........
r57253 | georg.brandl | 2007-08-20 23:01:18 -0700 (Mon, 20 Aug 2007) | 2 lines
Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.
........
r57254 | georg.brandl | 2007-08-20 23:03:43 -0700 (Mon, 20 Aug 2007) | 2 lines
Revert accidental checkins from last commit.
........
r57255 | georg.brandl | 2007-08-20 23:07:08 -0700 (Mon, 20 Aug 2007) | 2 lines
Bug #1777160: mention explicitly that e.g. -1**2 is -1.
........
r57256 | georg.brandl | 2007-08-20 23:12:19 -0700 (Mon, 20 Aug 2007) | 3 lines
Bug #1777168: replace operator names "opa"... with "op1"... and mark everything up as literal,
to enhance readability.
........
r57259 | facundo.batista | 2007-08-21 09:57:18 -0700 (Tue, 21 Aug 2007) | 8 lines
Added test for behavior of operations on an unconnected SMTP object,
and tests for NOOP, RSET, and VRFY. Corrected typo in a comment for
testNonnumericPort. Added a check for constructing SMTP objects when
non-numeric ports are included in the host name. Derived a server from
SMTPServer to test various ESMTP/SMTP capabilities. Check that a
second HELO to DebuggingServer returns an error. [GSoC - Alan McIntyre]
........
r57279 | skip.montanaro | 2007-08-22 12:02:16 -0700 (Wed, 22 Aug 2007) | 2 lines
Note that BeOS is unsupported as of Python 2.6.
........
r57280 | skip.montanaro | 2007-08-22 12:05:21 -0700 (Wed, 22 Aug 2007) | 1 line
whoops - need to check in configure as well
........
r57284 | alex.martelli | 2007-08-22 14:14:17 -0700 (Wed, 22 Aug 2007) | 5 lines
Fix compile.c so that it records 0.0 and -0.0 as separate constants in a code
object's co_consts tuple; add a test to show that the previous behavior (where
these two constants were "collapsed" into one) causes serious malfunctioning.
........
r57286 | gregory.p.smith | 2007-08-22 14:32:34 -0700 (Wed, 22 Aug 2007) | 3 lines
stop leaving log.0000001 __db.00* and xxx.db turds in developer
sandboxes when bsddb3 tests are run.
........
r57301 | jeffrey.yasskin | 2007-08-22 16:14:27 -0700 (Wed, 22 Aug 2007) | 3 lines
When setup.py fails to find the necessary bits to build some modules, have it
print a slightly more informative message.
........
r57320 | brett.cannon | 2007-08-23 07:53:17 -0700 (Thu, 23 Aug 2007) | 2 lines
Make test_runpy re-entrant.
........
r57324 | georg.brandl | 2007-08-23 10:54:11 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1768121: fix wrong/missing opcode docs.
........
r57326 | georg.brandl | 2007-08-23 10:57:05 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1766421: "return code" vs. "status code".
........
r57328 | georg.brandl | 2007-08-23 11:08:06 -0700 (Thu, 23 Aug 2007) | 2 lines
Second half of #1752175: #ifdef out references to PyImport_DynLoadFiletab if HAVE_DYNAMIC_LOADING is not defined.
........
r57331 | georg.brandl | 2007-08-23 11:11:33 -0700 (Thu, 23 Aug 2007) | 2 lines
Use try-except-finally in contextlib.
........
r57343 | georg.brandl | 2007-08-23 13:35:00 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1697820: document that the old slice protocol is still used by builtin types.
........
r57345 | georg.brandl | 2007-08-23 13:40:01 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1573854: fix docs for sqlite3 cursor rowcount attr.
........
r57347 | georg.brandl | 2007-08-23 13:50:23 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1694833: fix imp.find_module() docs wrt. packages.
........
r57348 | georg.brandl | 2007-08-23 13:53:28 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1594966: fix misleading usage example
........
r57349 | georg.brandl | 2007-08-23 13:55:44 -0700 (Thu, 23 Aug 2007) | 2 lines
Clarify wording a bit.
........
r57351 | georg.brandl | 2007-08-23 14:18:44 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1752332: httplib no longer uses socket.getaddrinfo().
........
r57352 | georg.brandl | 2007-08-23 14:21:36 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1734111: document struct.Struct.size.
........
r57353 | georg.brandl | 2007-08-23 14:27:57 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1688564: document os.path.join's absolute path behavior in the docstring.
........
r57354 | georg.brandl | 2007-08-23 14:36:05 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1625381: clarify match vs search introduction.
........
r57355 | georg.brandl | 2007-08-23 14:42:54 -0700 (Thu, 23 Aug 2007) | 2 lines
Bug #1758696: more info about descriptors.
........
r57357 | georg.brandl | 2007-08-23 14:55:57 -0700 (Thu, 23 Aug 2007) | 2 lines
Patch #1779550: remove redundant code in logging.
........
r57378 | gregory.p.smith | 2007-08-23 22:11:38 -0700 (Thu, 23 Aug 2007) | 2 lines
Fix bug 1725856.
........
r57382 | georg.brandl | 2007-08-23 23:10:01 -0700 (Thu, 23 Aug 2007) | 2 lines
uuid creation is now threadsafe, backport from py3k rev. 57375.
........
r57389 | georg.brandl | 2007-08-24 04:47:37 -0700 (Fri, 24 Aug 2007) | 2 lines
Bug #1765375: fix stripping of unwanted LDFLAGS.
........
r57391 | guido.van.rossum | 2007-08-24 07:53:14 -0700 (Fri, 24 Aug 2007) | 2 lines
Fix silly typo in test name.
........
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 24 Aug 2007 16:32:05 +0000 |
| parents | 986776456791 |
| children | 27f0289b6835 |
| 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 |
|
34125
1a938f456053
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
Brett Cannon <bcannon@gmail.com>
parents:
34124
diff
changeset
|
6 import sys, os, imp, re, optparse |
|
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 |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
94 def __init__(self, dist): |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
95 build_ext.__init__(self, dist) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
96 self.failed = [] |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
97 |
| 15940 | 98 def build_extensions(self): |
| 99 | |
| 100 # Detect which modules should be compiled | |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
101 missing = self.detect_modules() |
| 15940 | 102 |
| 103 # Remove modules that are present on the disabled list | |
| 104 self.extensions = [ext for ext in self.extensions | |
| 105 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
|
106 |
| 15940 | 107 # Fix up the autodetected modules, prefixing all the source files |
| 108 # with Modules/ and adding Python's include directory to the path. | |
| 109 (srcdir,) = sysconfig.get_config_vars('srcdir') | |
| 25790 | 110 if not srcdir: |
| 111 # Maybe running on Windows but not using CYGWIN? | |
| 112 raise ValueError("No source directory; cannot proceed.") | |
| 15940 | 113 |
|
16225
e56dd2dd9960
Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
16201
diff
changeset
|
114 # 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
|
115 moddir = os.path.join(os.getcwd(), srcdir, 'Modules') |
| 15940 | 116 moddir = os.path.normpath(moddir) |
| 117 srcdir, tail = os.path.split(moddir) | |
| 118 srcdir = os.path.normpath(srcdir) | |
| 119 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
|
120 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
121 moddirlist = [moddir] |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
122 incdirlist = ['./Include'] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
123 |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
124 # Platform-dependent module source and include directories |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
125 platform = self.get_platform() |
|
33294
67fbbeb1e218
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
33285
diff
changeset
|
126 if platform in ('darwin', 'mac') and ("--disable-toolbox-glue" not in |
|
33285
ee703a094dfb
When building with --disable-toolbox-glue under Darwin, skip building any
Brett Cannon <bcannon@gmail.com>
parents:
33180
diff
changeset
|
127 sysconfig.get_config_var("CONFIG_ARGS")): |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
128 # 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
|
129 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
|
130 moddirlist.append(macmoddir) |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
131 incdirlist.append('./Mac/Include') |
| 15940 | 132 |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
133 alldirlist = moddirlist + incdirlist |
|
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
134 |
|
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
|
135 # 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
|
136 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
|
137 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
|
138 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
139 for ext in self.extensions[:]: |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
140 ext.sources = [ find_module_file(filename, moddirlist) |
| 15940 | 141 for filename in ext.sources ] |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
142 if ext.depends is not None: |
|
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
143 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
|
144 for filename in ext.depends] |
|
19007
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
145 ext.include_dirs.append( '.' ) # to get config.h |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
146 for incdir in incdirlist: |
|
cefdcd60a8b2
Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents:
18845
diff
changeset
|
147 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
|
148 |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
149 # 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
|
150 # 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
|
151 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
|
152 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
|
153 |
|
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
|
154 if platform != 'mac': |
|
36144
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
155 # Parse Modules/Setup and Modules/Setup.local to figure out which |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
156 # modules are turned on in the file. |
|
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
|
157 remove_modules = [] |
|
36144
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
158 for filename in ('Modules/Setup', 'Modules/Setup.local'): |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
159 input = text_file.TextFile(filename, join_lines=1) |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
160 while 1: |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
161 line = input.readline() |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
162 if not line: break |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
163 line = line.split() |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
164 remove_modules.append(line[0]) |
|
82a52a464aa2
Bug #999767: make setup.py obey Setup.local wrt shared modules
Georg Brandl <georg@python.org>
parents:
36026
diff
changeset
|
165 input.close() |
|
36162
1e595b6c924e
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
36156
diff
changeset
|
166 |
|
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
|
167 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
|
168 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
|
169 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
|
170 |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
171 # 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
|
172 # 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
|
173 # 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
|
174 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
|
175 args = {} |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
176 # 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
|
177 # compilers |
|
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
178 if compiler is not None: |
|
34930
294dabcb379b
Make parse_makefile fallback to environment variables if nothing is
Martin v. Löwis <martin@v.loewis.de>
parents:
34911
diff
changeset
|
179 (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS') |
|
294dabcb379b
Make parse_makefile fallback to environment variables if nothing is
Martin v. Löwis <martin@v.loewis.de>
parents:
34911
diff
changeset
|
180 args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
181 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
|
182 |
| 15940 | 183 build_ext.build_extensions(self) |
| 184 | |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
185 longest = max([len(e.name) for e in self.extensions]) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
186 if self.failed: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
187 longest = max(longest, max([len(name) for name in self.failed])) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
188 |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
189 def print_three_column(lst): |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
190 lst.sort(key=str.lower) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
191 # guarantee zip() doesn't drop anything |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
192 while len(lst) % 3: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
193 lst.append("") |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
194 for e, f, g in zip(lst[::3], lst[1::3], lst[2::3]): |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
195 print("%-*s %-*s %-*s" % (longest, e, longest, f, |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
196 longest, g)) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
197 |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
198 if missing: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
199 print() |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
200 print("Failed to find the necessary bits to build these modules:") |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
201 print_three_column(missing) |
|
42775
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
202 print("To find the necessary bits, look in setup.py in" |
|
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
203 " detect_modules() for the module's name.") |
|
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
204 print() |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
205 |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
206 if self.failed: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
207 failed = self.failed[:] |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
208 print() |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
209 print("Failed to build these modules:") |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
210 print_three_column(failed) |
|
42775
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
211 print() |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
212 |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
213 def build_extension(self, ext): |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
214 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
215 if ext.name == '_ctypes': |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
216 if not self.configure_ctypes(ext): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
217 return |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
218 |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
219 try: |
|
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
220 build_ext.build_extension(self, ext) |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40582
diff
changeset
|
221 except (CCompilerError, DistutilsError) as why: |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
222 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
|
223 (ext.name, sys.exc_info()[1])) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
224 self.failed.append(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
|
225 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
|
226 # 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
|
227 # 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
|
228 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
|
229 self.announce( |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
230 '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
|
231 ext.name) |
|
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
232 return |
|
23513
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
233 # 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
|
234 # modules have been imported |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
235 if self.get_platform() == 'cygwin': |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
236 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
|
237 % ext.name) |
|
35f01bf34d60
Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents:
22805
diff
changeset
|
238 return |
| 21788 | 239 ext_filename = os.path.join( |
| 240 self.build_lib, | |
| 241 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
|
242 try: |
| 21788 | 243 imp.load_dynamic(ext.name, ext_filename) |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40582
diff
changeset
|
244 except ImportError as why: |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
245 self.failed.append(ext.name) |
|
28111
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
246 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
|
247 ' 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
|
248 assert not self.inplace |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
249 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
|
250 newname = basename + "_failed" + tail |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
251 if os.path.exists(newname): |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
252 os.remove(newname) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
253 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
|
254 |
|
28111
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
255 # 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
|
256 # 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
|
257 # _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
|
258 # use here. |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
259 # 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
|
260 # 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
|
261 try: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
262 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
|
263 os.remove(filename) |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
264 except AttributeError: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
265 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
|
266 except: |
|
7a2f683395e7
Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents:
28109
diff
changeset
|
267 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
|
268 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
|
269 '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
|
270 level=3) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
271 self.failed.append(ext.name) |
|
21277
f702ff390e4d
Visious hackery to solve a build-control problem related to our use of
Fred Drake <fdrake@acm.org>
parents:
21274
diff
changeset
|
272 |
|
29508
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
273 def get_platform(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
274 # Get value of sys.platform |
| 42645 | 275 for platform in ['cygwin', 'darwin', 'atheos', 'osf1']: |
|
29508
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
276 if sys.platform.startswith(platform): |
|
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
277 return platform |
|
53554688e5a2
Convert some repetitive code into a loop
Neal Norwitz <nnorwitz@gmail.com>
parents:
29471
diff
changeset
|
278 return sys.platform |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
279 |
| 15940 | 280 def detect_modules(self): |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
281 # Ensure that /usr/local is always used |
|
21742
9d5adff87f30
Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents:
21610
diff
changeset
|
282 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
|
283 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
|
284 |
|
34124
4e38ecd1912e
setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents:
33986
diff
changeset
|
285 # Add paths specified in the environment variables LDFLAGS and |
|
34288
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
286 # CPPFLAGS for header and library files. |
|
34186
521bec60eb30
Switch from getting LDFLAGS and CPPFLAGS from the environment to the Makefile.
Brett Cannon <bcannon@gmail.com>
parents:
34158
diff
changeset
|
287 # We must get the values from the Makefile and not the environment |
|
521bec60eb30
Switch from getting LDFLAGS and CPPFLAGS from the environment to the Makefile.
Brett Cannon <bcannon@gmail.com>
parents:
34158
diff
changeset
|
288 # directly since an inconsistently reproducible issue comes up where |
|
521bec60eb30
Switch from getting LDFLAGS and CPPFLAGS from the environment to the Makefile.
Brett Cannon <bcannon@gmail.com>
parents:
34158
diff
changeset
|
289 # the environment variable is not set even though the value were passed |
|
34288
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
290 # into configure and stored in the Makefile (issue found on OS X 10.3). |
|
34124
4e38ecd1912e
setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents:
33986
diff
changeset
|
291 for env_var, arg_name, dir_list in ( |
|
4e38ecd1912e
setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents:
33986
diff
changeset
|
292 ('LDFLAGS', '-L', self.compiler.library_dirs), |
|
4e38ecd1912e
setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents:
33986
diff
changeset
|
293 ('CPPFLAGS', '-I', self.compiler.include_dirs)): |
|
34186
521bec60eb30
Switch from getting LDFLAGS and CPPFLAGS from the environment to the Makefile.
Brett Cannon <bcannon@gmail.com>
parents:
34158
diff
changeset
|
294 env_val = sysconfig.get_config_var(env_var) |
|
34124
4e38ecd1912e
setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents:
33986
diff
changeset
|
295 if env_val: |
|
34288
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
296 # To prevent optparse from raising an exception about any |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
297 # options in env_val that is doesn't know about we strip out |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
298 # all double dashes and any dashes followed by a character |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
299 # that is not for the option we are dealing with. |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
300 # |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
301 # Please note that order of the regex is important! We must |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
302 # strip out double-dashes first so that we don't end up with |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
303 # substituting "--Long" to "-Long" and thus lead to "ong" being |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
304 # used for a library directory. |
|
42775
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
305 env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1], |
|
d7517c306791
Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42653
diff
changeset
|
306 ' ', env_val) |
|
34125
1a938f456053
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
Brett Cannon <bcannon@gmail.com>
parents:
34124
diff
changeset
|
307 parser = optparse.OptionParser() |
|
34288
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
308 # Make sure that allowing args interspersed with options is |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
309 # allowed |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
310 parser.allow_interspersed_args = True |
|
5dc274e15822
Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents:
34186
diff
changeset
|
311 parser.error = lambda msg: None |
|
34125
1a938f456053
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
Brett Cannon <bcannon@gmail.com>
parents:
34124
diff
changeset
|
312 parser.add_option(arg_name, dest="dirs", action="append") |
|
1a938f456053
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
Brett Cannon <bcannon@gmail.com>
parents:
34124
diff
changeset
|
313 options = parser.parse_args(env_val.split())[0] |
|
34306
f1c35da64d55
Since it is a possibility that LDFLAGS or CPPFLAGS were set with options that
Brett Cannon <bcannon@gmail.com>
parents:
34288
diff
changeset
|
314 if options.dirs: |
|
f1c35da64d55
Since it is a possibility that LDFLAGS or CPPFLAGS were set with options that
Brett Cannon <bcannon@gmail.com>
parents:
34288
diff
changeset
|
315 for directory in options.dirs: |
|
f1c35da64d55
Since it is a possibility that LDFLAGS or CPPFLAGS were set with options that
Brett Cannon <bcannon@gmail.com>
parents:
34288
diff
changeset
|
316 add_dir_to_list(dir_list, directory) |
|
27002
293eda3e69f5
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
Skip Montanaro <skip@pobox.com>
parents:
26989
diff
changeset
|
317 |
| 24477 | 318 if os.path.normpath(sys.prefix) != '/usr': |
| 319 add_dir_to_list(self.compiler.library_dirs, | |
| 320 sysconfig.get_config_var("LIBDIR")) | |
| 321 add_dir_to_list(self.compiler.include_dirs, | |
| 322 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
|
323 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
324 # 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
|
325 # 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
|
326 # be assumed that no additional -I,-L directives are needed. |
|
33986
49b6e966e57f
Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents:
33750
diff
changeset
|
327 lib_dirs = self.compiler.library_dirs + [ |
|
49b6e966e57f
Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents:
33750
diff
changeset
|
328 '/lib64', '/usr/lib64', |
|
49b6e966e57f
Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents:
33750
diff
changeset
|
329 '/lib', '/usr/lib', |
|
49b6e966e57f
Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents:
33750
diff
changeset
|
330 ] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
331 inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
| 15940 | 332 exts = [] |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
333 missing = [] |
| 15940 | 334 |
|
34911
87719ae9288c
Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents:
34717
diff
changeset
|
335 config_h = sysconfig.get_config_h_filename() |
|
87719ae9288c
Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents:
34717
diff
changeset
|
336 config_h_vars = sysconfig.parse_config_h(open(config_h)) |
|
87719ae9288c
Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents:
34717
diff
changeset
|
337 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
338 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
|
339 (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
|
340 |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
341 # 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
|
342 if platform == 'atheos': |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
343 lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
344 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
|
345 inc_dirs += ['/system/include', '/atheos/autolnk/include'] |
|
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
346 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
|
347 |
|
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
|
348 # 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
|
349 if platform in ['osf1', 'unixware7', 'openunix8']: |
|
29001
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
350 lib_dirs += ['/usr/ccs/lib'] |
|
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
351 |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
352 if platform == 'darwin': |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
353 # This should work on any unixy platform ;-) |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
354 # If the user has bothered specifying additional -I and -L flags |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
355 # in OPT and LDFLAGS we might as well use them here. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
356 # NOTE: using shlex.split would technically be more correct, but |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
357 # also gives a bootstrap problem. Let's hope nobody uses directories |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
358 # with whitespace in the name to store libraries. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
359 cflags, ldflags = sysconfig.get_config_vars( |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
360 'CFLAGS', 'LDFLAGS') |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
361 for item in cflags.split(): |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
362 if item.startswith('-I'): |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
363 inc_dirs.append(item[2:]) |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
364 |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
365 for item in ldflags.split(): |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
366 if item.startswith('-L'): |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
367 lib_dirs.append(item[2:]) |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
368 |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
369 # 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
|
370 math_libs = ['m'] |
| 42645 | 371 if platform in ['darwin', 'mac']: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
372 math_libs = [] |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
373 |
| 15940 | 374 # XXX Omitted modules: gl, pure, dl, SGI-specific modules |
| 375 | |
| 376 # | |
| 377 # The following modules are all pretty straightforward, and compile | |
| 378 # on pretty much any POSIXish platform. | |
| 379 # | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
380 |
| 15940 | 381 # Some modules that are normally always on: |
|
16384
c898ceba2261
Add entries for the weakref module to the build control.
Fred Drake <fdrake@acm.org>
parents:
16287
diff
changeset
|
382 exts.append( Extension('_weakref', ['_weakref.c']) ) |
| 15940 | 383 |
| 384 # array objects | |
| 385 exts.append( Extension('array', ['arraymodule.c']) ) | |
| 386 # 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
|
387 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
|
388 libraries=math_libs) ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
389 |
| 15940 | 390 # 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
|
391 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
|
392 libraries=math_libs) ) |
| 15940 | 393 # 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
|
394 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
|
395 libraries=math_libs) ) |
|
32400
6ce67f7b0430
Add compilation of timemodule.c with datetimemodule.c to get
Brett Cannon <bcannon@gmail.com>
parents:
32244
diff
changeset
|
396 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
|
397 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
|
398 # random number generator implemented in C |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
399 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
|
400 # 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
|
401 exts.append( Extension("itertools", ["itertoolsmodule.c"]) ) |
|
31436
63fa60f2d61c
* Move collections.deque() in from the sandbox
Raymond Hettinger <python@rcn.com>
parents:
31386
diff
changeset
|
402 # high-performance collections |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
403 exts.append( Extension("_collections", ["_collectionsmodule.c"]) ) |
|
31353
ed20259a1ea5
SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents:
31090
diff
changeset
|
404 # bisect |
|
ed20259a1ea5
SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents:
31090
diff
changeset
|
405 exts.append( Extension("_bisect", ["_bisectmodule.c"]) ) |
|
30875
2acd28bd4d0f
Convert heapq.py to a C implementation.
Raymond Hettinger <python@rcn.com>
parents:
30770
diff
changeset
|
406 # heapq |
|
31931
63b68cb2b442
* Restore the pure python version of heapq.py.
Raymond Hettinger <python@rcn.com>
parents:
31742
diff
changeset
|
407 exts.append( Extension("_heapq", ["_heapqmodule.c"]) ) |
| 15940 | 408 # operator.add() and similar goodies |
| 409 exts.append( Extension('operator', ['operator.c']) ) | |
|
38669
19fd6141940d
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
410 # _functools |
|
19fd6141940d
Partially merge trunk into p3yk. The removal of Mac/Tools is confusing svn
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
411 exts.append( Extension("_functools", ["_functoolsmodule.c"]) ) |
|
41253
f29f1a8b7869
Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
Collin Winter <collinw@gmail.com>
parents:
41064
diff
changeset
|
412 # atexit |
|
f29f1a8b7869
Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
Collin Winter <collinw@gmail.com>
parents:
41064
diff
changeset
|
413 exts.append( Extension("atexit", ["atexitmodule.c"]) ) |
|
16416
7d39d9dcf2d6
Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents:
16415
diff
changeset
|
414 # 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
|
415 exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) |
| 36459 | 416 # profilers (_lsprof is for cProfile.py) |
| 417 exts.append( Extension('_hotshot', ['_hotshot.c']) ) | |
| 418 exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) ) | |
| 15940 | 419 # static Unicode character database |
|
41818
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
420 exts.append( Extension('unicodedata', ['unicodedata.c']) ) |
| 15940 | 421 # 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
|
422 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
|
423 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
|
424 if m is not None: |
|
24810
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
425 locale_libs = ['intl'] |
|
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
426 else: |
|
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
427 locale_libs = [] |
|
32698
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
428 if platform == 'darwin': |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
429 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
|
430 else: |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
431 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
|
432 |
|
32698
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
433 |
|
24810
7ce82e9d08c7
Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents:
24790
diff
changeset
|
434 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
|
435 libraries=locale_libs, |
|
7742f85a3723
_localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents:
32416
diff
changeset
|
436 extra_link_args=locale_extra_link_args) ) |
| 15940 | 437 |
| 438 # Modules with some UNIX dependencies -- on by default: | |
| 439 # (If you have a really backward UNIX, select and socket may not be | |
| 440 # supported...) | |
| 441 | |
| 442 # fcntl(2) and ioctl(2) | |
| 443 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
|
444 if platform not in ['mac']: |
|
34592
fa52f1ffc161
spwdmodule.c should only be built when either HAVE_GETSPNAM or HAVE_GETSPENT is
Brett Cannon <bcannon@gmail.com>
parents:
34481
diff
changeset
|
445 # pwd(3) |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
446 exts.append( Extension('pwd', ['pwdmodule.c']) ) |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
447 # grp(3) |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
448 exts.append( Extension('grp', ['grpmodule.c']) ) |
|
34481
9c62e7d690a5
Patch #579435: Shadow Password Support Module
Martin v. Löwis <martin@v.loewis.de>
parents:
34306
diff
changeset
|
449 # spwd, shadow passwords |
|
34911
87719ae9288c
Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents:
34717
diff
changeset
|
450 if (config_h_vars.get('HAVE_GETSPNAM', False) or |
|
87719ae9288c
Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents:
34717
diff
changeset
|
451 config_h_vars.get('HAVE_GETSPENT', False)): |
|
34592
fa52f1ffc161
spwdmodule.c should only be built when either HAVE_GETSPNAM or HAVE_GETSPENT is
Brett Cannon <bcannon@gmail.com>
parents:
34481
diff
changeset
|
452 exts.append( Extension('spwd', ['spwdmodule.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
453 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
454 missing.append('spwd') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
455 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
456 missing.extend(['pwd', 'grp', 'spwd']) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
457 |
| 15940 | 458 # select(2); not on ancient System V |
| 459 exts.append( Extension('select', ['selectmodule.c']) ) | |
| 460 | |
| 461 # Helper module for various ascii-encoders | |
| 462 exts.append( Extension('binascii', ['binascii.c']) ) | |
| 463 | |
| 464 # Fred Drake's interface to the Python parser | |
| 465 exts.append( Extension('parser', ['parsermodule.c']) ) | |
| 466 | |
| 467 # 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
|
468 if platform not in ['atheos', 'mac']: |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
469 exts.append( Extension('mmap', ['mmapmodule.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
470 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
471 missing.append('mmap') |
| 15940 | 472 |
|
33370
af65004f622f
Remove mpz, rotor, xreadlines modules
Andrew M. Kuchling <amk@amk.ca>
parents:
33294
diff
changeset
|
473 # Lance Ellinghaus's syslog module |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
474 if platform not in ['mac']: |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
475 # syslog daemon interface |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
476 exts.append( Extension('syslog', ['syslogmodule.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
477 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
478 missing.append('syslog') |
| 15940 | 479 |
| 480 # | |
|
15998
f390f43ac4b6
Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents:
15996
diff
changeset
|
481 # 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
|
482 # libraries, are platform-specific, or present other surprises. |
| 15940 | 483 # |
| 484 | |
| 485 # Multimedia modules | |
| 486 # These don't work for 64-bit platforms!!! | |
| 487 # These represent audio samples or images as strings: | |
| 488 | |
|
32763
8ad5a1620092
Move comment that goes along with audioop
Neal Norwitz <nnorwitz@gmail.com>
parents:
32762
diff
changeset
|
489 # Operations on audio samples |
|
32797
ea54fdb86530
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
32765
diff
changeset
|
490 # 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
|
491 # 64-bit platforms. |
|
76ad814bc67c
Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents:
32735
diff
changeset
|
492 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
|
493 |
| 15940 | 494 # readline |
|
36648
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
495 do_readline = self.compiler.find_library_file(lib_dirs, 'readline') |
|
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
496 if platform == 'darwin': |
|
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
497 # MacOSX 10.4 has a broken readline. Don't try to build |
|
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
498 # the readline module unless the user has installed a fixed |
|
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
499 # readline package |
|
36668
8410f06ad36e
Check for a not-found rlconf.h by testing for None.
Martin v. Löwis <martin@v.loewis.de>
parents:
36648
diff
changeset
|
500 if find_file('readline/rlconf.h', inc_dirs, []) is None: |
|
36648
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
501 do_readline = False |
|
95800875bd12
If the readline library is found try and determine whether it's the broken
Jack Jansen <jack.jansen@cwi.nl>
parents:
36479
diff
changeset
|
502 if do_readline: |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
503 if sys.platform == 'darwin': |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
504 # In every directory on the search path search for a dynamic |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
505 # library and then a static library, instead of first looking |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
506 # for dynamic libraries on the entiry path. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
507 # This way a staticly linked custom readline gets picked up |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
508 # before the (broken) dynamic library in /usr/lib. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
509 readline_extra_link_args = ('-Wl,-search_paths_first',) |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
510 else: |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
511 readline_extra_link_args = () |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
512 |
|
16283
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
513 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
|
514 if self.compiler.find_library_file(lib_dirs, |
|
36479
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
515 'ncursesw'): |
|
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
516 readline_libs.append('ncursesw') |
|
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
517 elif self.compiler.find_library_file(lib_dirs, |
|
19319
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
518 'ncurses'): |
|
d370a58fb7fd
Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents:
19269
diff
changeset
|
519 readline_libs.append('ncurses') |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 ['/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
|
524 'termcap'): |
|
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
525 readline_libs.append('termcap') |
| 15940 | 526 exts.append( Extension('readline', ['readline.c'], |
|
16282
ea4a2f3b266e
Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents:
16225
diff
changeset
|
527 library_dirs=['/usr/lib/termcap'], |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
528 extra_link_args=readline_extra_link_args, |
|
16283
65c6a2998b1b
Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents:
16282
diff
changeset
|
529 libraries=readline_libs) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
530 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
531 missing.append('readline') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
532 |
|
24032
c10c09192c12
More fixes for building MacPython extension modules. It now actually succeeds
Jack Jansen <jack.jansen@cwi.nl>
parents:
24008
diff
changeset
|
533 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
|
534 # crypt module. |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
535 |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
536 if self.compiler.find_library_file(lib_dirs, 'crypt'): |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
537 libs = ['crypt'] |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
538 else: |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
539 libs = [] |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
540 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
541 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
542 missing.append('crypt') |
| 15940 | 543 |
|
28341
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
544 # CSV files |
|
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
545 exts.append( Extension('_csv', ['_csv.c']) ) |
|
797909492c38
build _csv extension module
Skip Montanaro <skip@pobox.com>
parents:
28208
diff
changeset
|
546 |
| 15940 | 547 # socket(2) |
|
23811
e3e019bc4e1e
Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents:
23777
diff
changeset
|
548 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
|
549 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
|
550 # Detect SSL support for the socket module (via _ssl) |
|
35396
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
551 search_for_ssl_incs_in = [ |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
552 '/usr/local/ssl/include', |
|
16038
b6863ba88989
GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents:
16013
diff
changeset
|
553 '/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
|
554 ] |
|
35396
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
555 ssl_incs = find_file('openssl/ssl.h', inc_dirs, |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
556 search_for_ssl_incs_in |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
557 ) |
|
29043
8e79dc3731bf
Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents:
29013
diff
changeset
|
558 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
|
559 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
|
560 ['/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
|
561 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
|
562 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
|
563 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
|
564 ['/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
|
565 '/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
|
566 ] ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
567 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
568 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
|
569 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
|
570 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
|
571 include_dirs = ssl_incs, |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
572 library_dirs = ssl_libs, |
|
23811
e3e019bc4e1e
Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents:
23777
diff
changeset
|
573 libraries = ['ssl', 'crypto'], |
|
23825
9f0009ca97b9
Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
23816
diff
changeset
|
574 depends = ['socketmodule.h']), ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
575 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
576 missing.append('_ssl') |
| 15940 | 577 |
|
35396
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
578 # find out which version of OpenSSL we have |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
579 openssl_ver = 0 |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
580 openssl_ver_re = re.compile( |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
581 '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' ) |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
582 for ssl_inc_dir in inc_dirs + search_for_ssl_incs_in: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
583 name = os.path.join(ssl_inc_dir, 'openssl', 'opensslv.h') |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
584 if os.path.isfile(name): |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
585 try: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
586 incfile = open(name, 'r') |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
587 for line in incfile: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
588 m = openssl_ver_re.match(line) |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
589 if m: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
590 openssl_ver = eval(m.group(1)) |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
591 break |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
592 except IOError: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
593 pass |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
594 |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
595 # first version found is what we'll use (as the compiler should) |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
596 if openssl_ver: |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
597 break |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
598 |
|
42653
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
599 #print('openssl_ver = 0x%08x' % openssl_ver) |
|
35396
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
600 |
|
42653
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
601 if ssl_incs is not None and ssl_libs is not None: |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
602 if openssl_ver >= 0x00907000: |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
603 # The _hashlib module wraps optimized implementations |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
604 # of hash functions from the OpenSSL library. |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
605 exts.append( Extension('_hashlib', ['_hashopenssl.c'], |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
606 include_dirs = ssl_incs, |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
607 library_dirs = ssl_libs, |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
608 libraries = ['ssl', 'crypto']) ) |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
609 else: |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
610 print("warning: openssl 0x%08x is too old for _hashlib" % |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
611 openssl_ver) |
|
986776456791
Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents:
42645
diff
changeset
|
612 missing.append('_hashlib') |
|
35375
624918e1c1b2
[ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents:
35238
diff
changeset
|
613 else: |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
614 missing.append('_hashlib') |
|
35375
624918e1c1b2
[ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents:
35238
diff
changeset
|
615 |
|
35396
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
616 if (openssl_ver < 0x00908000): |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
617 # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
618 exts.append( Extension('_sha256', ['sha256module.c']) ) |
|
12a9bb24b6d9
Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents:
35375
diff
changeset
|
619 exts.append( Extension('_sha512', ['sha512module.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
620 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
621 missing.extend(['_sha256', '_sha512']) |
|
35375
624918e1c1b2
[ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents:
35238
diff
changeset
|
622 |
| 15940 | 623 # Modules that provide persistent dictionary-like semantics. You will |
| 624 # probably want to arrange for at least one of them to be available on | |
| 625 # your machine, though none are defined by default because of library | |
| 626 # dependencies. The Python module anydbm.py provides an | |
| 627 # implementation independent wrapper for these; dumbdbm.py provides | |
| 628 # similar functionality (but slower of course) implemented in Python. | |
| 629 | |
|
26874
26df6013b303
Search for and use BerkeleyDB 4.1 if it's available. Python's
Barry Warsaw <barry@python.org>
parents:
26829
diff
changeset
|
630 # 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
|
631 # |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
632 # This requires the Sleepycat DB code. The supported versions |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
633 # are set below. Visit http://www.sleepycat.com/ to download |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
634 # a release. Most open source OSes come with one or more |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
635 # versions of BerkeleyDB already installed. |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
636 |
|
40582
67287ca4e1e8
Merged revisions 53005-53303 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
637 max_db_ver = (4, 5) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
638 min_db_ver = (3, 3) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
639 db_setup_debug = False # verbose debug prints from this script? |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
640 |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
641 # construct a list of paths to look for the header file in on |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
642 # top of the normal inc_dirs. |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
643 db_inc_paths = [ |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
644 '/usr/include/db4', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
645 '/usr/local/include/db4', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
646 '/opt/sfw/include/db4', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
647 '/usr/include/db3', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
648 '/usr/local/include/db3', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
649 '/opt/sfw/include/db3', |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
650 # Fink defaults (http://fink.sourceforge.net/) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
651 '/sw/include/db4', |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
652 '/sw/include/db3', |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
653 ] |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
654 # 4.x minor number specific paths |
|
40582
67287ca4e1e8
Merged revisions 53005-53303 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
655 for x in (0,1,2,3,4,5): |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
656 db_inc_paths.append('/usr/include/db4%d' % x) |
|
35737
5390ddc77eb8
Find bsd db v4 on gentoo (2005 i think)
Neal Norwitz <nnorwitz@gmail.com>
parents:
35396
diff
changeset
|
657 db_inc_paths.append('/usr/include/db4.%d' % x) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
658 db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
659 db_inc_paths.append('/usr/local/include/db4%d' % x) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
660 db_inc_paths.append('/pkg/db-4.%d/include' % x) |
|
36396
0372e25e430e
Support for BerkeleyDB 4.4 (tested against 4.4.20 as well as all the
Gregory P. Smith <greg@mad-scientist.com>
parents:
36162
diff
changeset
|
661 db_inc_paths.append('/opt/db-4.%d/include' % x) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
662 # MacPorts default (http://www.macports.org/) |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
663 db_inc_paths.append('/opt/local/include/db4%d' % x) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
664 # 3.x minor number specific paths |
|
40582
67287ca4e1e8
Merged revisions 53005-53303 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
665 for x in (3,): |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
666 db_inc_paths.append('/usr/include/db3%d' % x) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
667 db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
668 db_inc_paths.append('/usr/local/include/db3%d' % x) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
669 db_inc_paths.append('/pkg/db-3.%d/include' % x) |
|
36396
0372e25e430e
Support for BerkeleyDB 4.4 (tested against 4.4.20 as well as all the
Gregory P. Smith <greg@mad-scientist.com>
parents:
36162
diff
changeset
|
670 db_inc_paths.append('/opt/db-3.%d/include' % x) |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
671 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
672 # Add some common subdirectories for Sleepycat DB to the list, |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
673 # based on the standard include directories. This way DB3/4 gets |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
674 # picked up when it is installed in a non-standard prefix and |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
675 # the user has added that prefix into inc_dirs. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
676 std_variants = [] |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
677 for dn in inc_dirs: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
678 std_variants.append(os.path.join(dn, 'db3')) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
679 std_variants.append(os.path.join(dn, 'db4')) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
680 for x in (0,1,2,3,4): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
681 std_variants.append(os.path.join(dn, "db4%d"%x)) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
682 std_variants.append(os.path.join(dn, "db4.%d"%x)) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
683 for x in (2,3): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
684 std_variants.append(os.path.join(dn, "db3%d"%x)) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
685 std_variants.append(os.path.join(dn, "db3.%d"%x)) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
686 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
687 db_inc_paths = std_variants + db_inc_paths |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
688 db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)] |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
689 |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
690 db_ver_inc_map = {} |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
691 |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
692 class db_found(Exception): pass |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
693 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
|
694 # 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
|
695 # search path. |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
696 for d in inc_dirs + db_inc_paths: |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
697 f = os.path.join(d, "db.h") |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
698 if db_setup_debug: print("db: looking for db.h in", f) |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
699 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
|
700 f = open(f).read() |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
701 m = re.search(r"#define\WDB_VERSION_MAJOR\W(\d+)", f) |
|
26548
67912d83799f
Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents:
26443
diff
changeset
|
702 if m: |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
703 db_major = int(m.group(1)) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
704 m = re.search(r"#define\WDB_VERSION_MINOR\W(\d+)", f) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
705 db_minor = int(m.group(1)) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
706 db_ver = (db_major, db_minor) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
707 |
|
39575
63237fcefd99
Get rid of dict.has_key(). Boy this has a lot of repercussions!
Guido van Rossum <guido@python.org>
parents:
39545
diff
changeset
|
708 if ( (db_ver not in db_ver_inc_map) and |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
709 (db_ver <= max_db_ver and db_ver >= min_db_ver) ): |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
710 # save the include directory with the db.h version |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
711 # (first occurrence only) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
712 db_ver_inc_map[db_ver] = d |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39575
diff
changeset
|
713 if db_setup_debug: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
714 print("db.h: found", db_ver, "in", d) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
715 else: |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
716 # we already found a header for this library version |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
717 if db_setup_debug: print("db.h: ignoring", d) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
718 else: |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
719 # ignore this header, it didn't contain a version number |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
720 if db_setup_debug: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
721 print("db.h: no version number version in", d) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
722 |
|
40807
f229645d607d
Random change to make this work unchanged when dict.keys() returns a dict view.
Guido van Rossum <guido@python.org>
parents:
40774
diff
changeset
|
723 db_found_vers = sorted(db_ver_inc_map.keys()) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
724 |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
725 while db_found_vers: |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
726 db_ver = db_found_vers.pop() |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
727 db_incdir = db_ver_inc_map[db_ver] |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
728 |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
729 # check lib directories parallel to the location of the header |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
730 db_dirs_to_check = [ |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
731 db_incdir.replace("include", 'lib64'), |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
732 db_incdir.replace("include", 'lib'), |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
733 ] |
|
42142
a53e48be6df9
Merged revisions 56125-56153 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42084
diff
changeset
|
734 db_dirs_to_check = [x for x in db_dirs_to_check if os.path.isdir(x)] |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
735 |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
736 # Look for a version specific db-X.Y before an ambiguoius dbX |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
737 # XXX should we -ever- look for a dbX name? Do any |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
738 # systems really not name their library by version and |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
739 # symlink to more general names? |
|
34717
516f15521598
add support for another DB library naming convention (FreeBSD ports)
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents:
34706
diff
changeset
|
740 for dblib in (('db-%d.%d' % db_ver), |
|
516f15521598
add support for another DB library naming convention (FreeBSD ports)
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents:
34706
diff
changeset
|
741 ('db%d%d' % db_ver), |
|
516f15521598
add support for another DB library naming convention (FreeBSD ports)
Andrew MacIntyre <andymac@bullseye.apana.org.au>
parents:
34706
diff
changeset
|
742 ('db%d' % db_ver[0])): |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
743 dblib_file = self.compiler.find_library_file( |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
744 db_dirs_to_check + lib_dirs, dblib ) |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
745 if dblib_file: |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
746 dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ] |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
747 raise db_found |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
748 else: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
749 if db_setup_debug: print("db lib: ", dblib, "not found") |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
750 |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
751 except db_found: |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39575
diff
changeset
|
752 if db_setup_debug: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
753 print("db lib: using", db_ver, dblib) |
|
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
754 print("db: lib dir", dblib_dir, "inc dir", db_incdir) |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
755 db_incs = [db_incdir] |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
756 dblibs = [dblib] |
|
34158
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
757 # We add the runtime_library_dirs argument because the |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
758 # BerkeleyDB lib we're linking against often isn't in the |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
759 # system dynamic library search path. This is usually |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
760 # correct and most trouble free, but may cause problems in |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
761 # some unusual system configurations (e.g. the directory |
|
3626db433104
rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents:
34156
diff
changeset
|
762 # is on 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 libraries=dblibs)) |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
768 else: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
769 if db_setup_debug: print("db: no appropriate library found") |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
770 db_incs = None |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
771 dblibs = [] |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
772 dblib_dir = None |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
773 missing.append('_bsddb') |
|
23867
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
774 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
775 # The sqlite interface |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39575
diff
changeset
|
776 sqlite_setup_debug = False # verbose debug prints from this script? |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
777 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
778 # We hunt for #define SQLITE_VERSION "n.n.n" |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
779 # We need to find >= sqlite version 3.0.8 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
780 sqlite_incdir = sqlite_libdir = None |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
781 sqlite_inc_paths = [ '/usr/include', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
782 '/usr/include/sqlite', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
783 '/usr/include/sqlite3', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
784 '/usr/local/include', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
785 '/usr/local/include/sqlite', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
786 '/usr/local/include/sqlite3', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
787 ] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
788 MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
789 MIN_SQLITE_VERSION = ".".join([str(x) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
790 for x in MIN_SQLITE_VERSION_NUMBER]) |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
791 |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
792 # Scan the default include directories before the SQLite specific |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
793 # ones. This allows one to override the copy of sqlite on OSX, |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
794 # where /usr/include contains an old version of sqlite. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
795 for d in inc_dirs + sqlite_inc_paths: |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
796 f = os.path.join(d, "sqlite3.h") |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
797 if os.path.exists(f): |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
798 if sqlite_setup_debug: print("sqlite: found %s"%f) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
799 incf = open(f).read() |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
800 m = re.search( |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
801 r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"(.*)"', incf) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
802 if m: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
803 sqlite_version = m.group(1) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
804 sqlite_version_tuple = tuple([int(x) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
805 for x in sqlite_version.split(".")]) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
806 if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
807 # we win! |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39575
diff
changeset
|
808 if sqlite_setup_debug: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
809 print("%s/sqlite3.h: version %s"%(d, sqlite_version)) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
810 sqlite_incdir = d |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
811 break |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
812 else: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
813 if sqlite_setup_debug: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
814 print("%s: version %d is too old, need >= %s"%(d, |
|
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
815 sqlite_version, MIN_SQLITE_VERSION)) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
816 elif sqlite_setup_debug: |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
817 print("sqlite: %s had no SQLITE_VERSION"%(f,)) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
818 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
819 if sqlite_incdir: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
820 sqlite_dirs_to_check = [ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
821 os.path.join(sqlite_incdir, '..', 'lib64'), |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
822 os.path.join(sqlite_incdir, '..', 'lib'), |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
823 os.path.join(sqlite_incdir, '..', '..', 'lib64'), |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
824 os.path.join(sqlite_incdir, '..', '..', 'lib'), |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
825 ] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
826 sqlite_libfile = self.compiler.find_library_file( |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
827 sqlite_dirs_to_check + lib_dirs, 'sqlite3') |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
828 sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
829 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
830 if sqlite_incdir and sqlite_libdir: |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
831 sqlite_srcs = ['_sqlite/cache.c', |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
832 '_sqlite/connection.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
833 '_sqlite/cursor.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
834 '_sqlite/microprotocols.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
835 '_sqlite/module.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
836 '_sqlite/prepare_protocol.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
837 '_sqlite/row.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
838 '_sqlite/statement.c', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
839 '_sqlite/util.c', ] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
840 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
841 sqlite_defines = [] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
842 if sys.platform != "win32": |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
843 sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
844 else: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
845 sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
846 |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
847 |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
848 if sys.platform == 'darwin': |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
849 # In every directory on the search path search for a dynamic |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
850 # library and then a static library, instead of first looking |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
851 # for dynamic libraries on the entiry path. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
852 # This way a staticly linked custom sqlite gets picked up |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
853 # before the dynamic library in /usr/lib. |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
854 sqlite_extra_link_args = ('-Wl,-search_paths_first',) |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
855 else: |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
856 sqlite_extra_link_args = () |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
857 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
858 exts.append(Extension('_sqlite3', sqlite_srcs, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
859 define_macros=sqlite_defines, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
860 include_dirs=["Modules/_sqlite", |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
861 sqlite_incdir], |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
862 library_dirs=sqlite_libdir, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
863 runtime_library_dirs=sqlite_libdir, |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
864 extra_link_args=sqlite_extra_link_args, |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
865 libraries=["sqlite3",])) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
866 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
867 missing.append('_sqlite3') |
|
29001
6c40b73c7045
build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents:
28947
diff
changeset
|
868 |
| 15940 | 869 # 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
|
870 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
|
871 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
|
872 # 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
|
873 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
|
874 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
|
875 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
|
876 ndbm_libs = [] |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
877 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
|
878 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
|
879 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
|
880 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
|
881 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
|
882 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
|
883 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
|
884 libraries = ['gdbm'] ) ) |
|
45d676933882
This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents:
23825
diff
changeset
|
885 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
|
886 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
|
887 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
|
888 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
|
889 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
|
890 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
|
891 ('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
|
892 libraries=dblibs)) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
893 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
894 missing.append('dbm') |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
895 |
| 15940 | 896 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: |
| 897 if (self.compiler.find_library_file(lib_dirs, 'gdbm')): | |
| 898 exts.append( Extension('gdbm', ['gdbmmodule.c'], | |
| 899 libraries = ['gdbm'] ) ) | |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
900 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
901 missing.append('gdbm') |
| 15940 | 902 |
| 903 # Unix-only modules | |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
904 if platform not in ['mac', 'win32']: |
| 15940 | 905 # Steen Lumholt's termios module |
| 906 exts.append( Extension('termios', ['termios.c']) ) | |
| 907 # Jeremy Hylton's rlimit interface | |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
908 if platform not in ['atheos']: |
|
23777
bec1b942e0bc
Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents:
23659
diff
changeset
|
909 exts.append( Extension('resource', ['resource.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
910 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
911 missing.append('resource') |
| 15940 | 912 |
|
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
|
913 # 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
|
914 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
|
915 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
|
916 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
|
917 else: |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
918 libs = [] |
|
8156879fe60d
Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents:
16750
diff
changeset
|
919 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
|
920 libraries = libs) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
921 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
922 missing.append('nis') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
923 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
924 missing.extend(['nis', 'resource', 'termios']) |
| 15940 | 925 |
|
31468
de2ed800fa50
a couple other sunos4 support items removed
Skip Montanaro <skip@pobox.com>
parents:
31436
diff
changeset
|
926 # 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
|
927 # provided by the ncurses library. |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
928 panel_library = 'panel' |
|
36479
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
929 if (self.compiler.find_library_file(lib_dirs, 'ncursesw')): |
|
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
930 curses_libs = ['ncursesw'] |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
931 # Bug 1464056: If _curses.so links with ncursesw, |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
932 # _curses_panel.so must link with panelw. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
933 panel_library = 'panelw' |
|
36479
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
934 exts.append( Extension('_curses', ['_cursesmodule.c'], |
|
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
935 libraries = curses_libs) ) |
|
d496c0764ad6
Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents:
36459
diff
changeset
|
936 elif (self.compiler.find_library_file(lib_dirs, 'ncurses')): |
| 15940 | 937 curses_libs = ['ncurses'] |
| 938 exts.append( Extension('_curses', ['_cursesmodule.c'], | |
| 939 libraries = curses_libs) ) | |
| 21274 | 940 elif (self.compiler.find_library_file(lib_dirs, 'curses') |
| 941 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
|
942 # 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
|
943 # the _curses module. |
| 15940 | 944 if (self.compiler.find_library_file(lib_dirs, 'terminfo')): |
| 945 curses_libs = ['curses', 'terminfo'] | |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
946 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
|
947 curses_libs = ['curses', 'termcap'] |
| 15940 | 948 else: |
|
28473
0f558eede6c5
SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents:
28356
diff
changeset
|
949 curses_libs = ['curses'] |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
950 |
| 15940 | 951 exts.append( Extension('_curses', ['_cursesmodule.c'], |
| 952 libraries = curses_libs) ) | |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
953 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
954 missing.append('_curses') |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
955 |
| 15940 | 956 # 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
|
957 if (module_enabled(exts, '_curses') and |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
958 self.compiler.find_library_file(lib_dirs, panel_library)): |
| 15940 | 959 exts.append( Extension('_curses_panel', ['_curses_panel.c'], |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
960 libraries = [panel_library] + curses_libs) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
961 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
962 missing.append('_curses_panel') |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
963 |
|
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
|
964 # 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
|
965 # 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
|
966 # 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
|
967 # |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
968 # 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
|
969 # 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
|
970 # 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
|
971 # 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
|
972 # 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
|
973 # |
|
825948c21f0d
Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents:
24605
diff
changeset
|
974 # 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
|
975 # 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
|
976 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 break |
|
24605
fd4575b56a4d
Update the URL for getting zlib, and update the minimal required
Guido van Rossum <guido@python.org>
parents:
24579
diff
changeset
|
986 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
|
987 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
|
988 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
|
989 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
|
990 if (self.compiler.find_library_file(lib_dirs, 'z')): |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
991 if sys.platform == "darwin": |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
992 zlib_extra_link_args = ('-Wl,-search_paths_first',) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
993 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
994 zlib_extra_link_args = () |
|
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
|
995 exts.append( Extension('zlib', ['zlibmodule.c'], |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
996 libraries = ['z'], |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
997 extra_link_args = zlib_extra_link_args)) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
998 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
999 missing.append('zlib') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1000 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1001 missing.append('zlib') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1002 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1003 missing.append('zlib') |
| 15940 | 1004 |
|
26037
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
1005 # Gustavo Niemeyer's bz2 module. |
|
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
1006 if (self.compiler.find_library_file(lib_dirs, 'bz2')): |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1007 if sys.platform == "darwin": |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1008 bz2_extra_link_args = ('-Wl,-search_paths_first',) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1009 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1010 bz2_extra_link_args = () |
|
26037
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
1011 exts.append( Extension('bz2', ['bz2module.c'], |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1012 libraries = ['bz2'], |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1013 extra_link_args = bz2_extra_link_args) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1014 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1015 missing.append('bz2') |
|
26037
521e89c4ff44
Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents:
25790
diff
changeset
|
1016 |
| 15940 | 1017 # Interface to the Expat XML parser |
| 1018 # | |
|
23889
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
1019 # 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
|
1020 # 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
|
1021 # 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
|
1022 # 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
|
1023 # 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
|
1024 # shared libexpat.so/expat.dll is not advised. |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
1025 # |
|
41ab532d4f60
Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents:
23867
diff
changeset
|
1026 # 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
|
1027 # |
|
21942
9d44e752d617
Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents:
21939
diff
changeset
|
1028 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
|
1029 define_macros = [ |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1030 ('HAVE_EXPAT_CONFIG_H', '1'), |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1031 ] |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1032 |
|
30731
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1033 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
|
1034 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
|
1035 include_dirs = [expatinc], |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1036 sources = ['pyexpat.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1037 'expat/xmlparse.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1038 'expat/xmlrole.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1039 'expat/xmltok.c', |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1040 ], |
|
f0da0cad5cd5
Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents:
30485
diff
changeset
|
1041 )) |
| 15940 | 1042 |
|
36026
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1043 # Fredrik Lundh's cElementTree module. Note that this also |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1044 # uses expat (via the CAPI hook in pyexpat). |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1045 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1046 if os.path.isfile(os.path.join(srcdir, 'Modules', '_elementtree.c')): |
|
36026
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1047 define_macros.append(('USE_PYEXPAT_CAPI', None)) |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1048 exts.append(Extension('_elementtree', |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1049 define_macros = define_macros, |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1050 include_dirs = [expatinc], |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1051 sources = ['_elementtree.c'], |
|
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1052 )) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1053 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1054 missing.append('_elementtree') |
|
36026
e01d8524b6f6
added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents:
35737
diff
changeset
|
1055 |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
31353
diff
changeset
|
1056 # Hye-Shik Chang's CJKCodecs modules. |
|
41818
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
1057 exts.append(Extension('_multibytecodec', |
|
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
1058 ['cjkcodecs/multibytecodec.c'])) |
|
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
1059 for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'): |
|
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
1060 exts.append(Extension('_codecs_%s' % loc, |
|
bfc73d849e28
The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents:
41749
diff
changeset
|
1061 ['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
|
1062 |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
1063 # 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
|
1064 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
|
1065 # 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
|
1066 dl_inc = find_file('dlfcn.h', [], inc_dirs) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1067 if (dl_inc is not None) and (platform not in ['atheos']): |
|
25232
aac1ee966f56
Only build the 'dl' extension when sys.maxint equals 2**31-1.
Guido van Rossum <guido@python.org>
parents:
25075
diff
changeset
|
1068 exts.append( Extension('dl', ['dlmodule.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1069 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1070 missing.append('dl') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1071 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1072 missing.append('dl') |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
1073 |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1074 # Thomas Heller's _ctypes module |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1075 self.detect_ctypes(inc_dirs, lib_dirs) |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1076 |
|
41064
6e1cf4d28af3
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
Guido van Rossum <guido@python.org>
parents:
40893
diff
changeset
|
1077 # _fileio -- supposedly cross platform |
|
6e1cf4d28af3
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
Guido van Rossum <guido@python.org>
parents:
40893
diff
changeset
|
1078 exts.append(Extension('_fileio', ['_fileio.c'])) |
|
6e1cf4d28af3
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
Guido van Rossum <guido@python.org>
parents:
40893
diff
changeset
|
1079 |
| 15940 | 1080 # Platform-specific libraries |
|
35238
526faaab00eb
Add support for FreeBSD 7.
Hye-Shik Chang <hyeshik@gmail.com>
parents:
34930
diff
changeset
|
1081 if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', |
|
526faaab00eb
Add support for FreeBSD 7.
Hye-Shik Chang <hyeshik@gmail.com>
parents:
34930
diff
changeset
|
1082 'freebsd7'): |
|
27865
65494469ad3e
Re-enable compiling ossaudiodev now that it seems to work again.
Guido van Rossum <guido@python.org>
parents:
27820
diff
changeset
|
1083 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1084 else: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1085 missing.append('ossaudiodev') |
| 15940 | 1086 |
|
33294
67fbbeb1e218
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
33285
diff
changeset
|
1087 if platform == 'darwin' and ("--disable-toolbox-glue" not in |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1088 sysconfig.get_config_var("CONFIG_ARGS")): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1089 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1090 if os.uname()[2] > '8.': |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1091 # We're on Mac OS X 10.4 or later, the compiler should |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1092 # support '-Wno-deprecated-declarations'. This will |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1093 # surpress deprecation warnings for the Carbon extensions, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1094 # these extensions wrap the Carbon APIs and even those |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1095 # parts that are deprecated. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1096 carbon_extra_compile_args = ['-Wno-deprecated-declarations'] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1097 else: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1098 carbon_extra_compile_args = [] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1099 |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
1100 # Mac OS X specific modules. |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1101 def macSrcExists(name1, name2=''): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1102 if not name1: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1103 return None |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1104 names = (name1,) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1105 if name2: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1106 names = (name1, name2) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1107 path = os.path.join(srcdir, 'Mac', 'Modules', *names) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1108 return os.path.exists(path) |
|
24143
e9e6111beec1
The readme file said that OSX Carbon modules were only built for
Jack Jansen <jack.jansen@cwi.nl>
parents:
24032
diff
changeset
|
1109 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1110 def addMacExtension(name, kwds, extra_srcs=[]): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1111 dirname = '' |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1112 if name[0] == '_': |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1113 dirname = name[1:].lower() |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1114 cname = name + '.c' |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1115 cmodulename = name + 'module.c' |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1116 # Check for NNN.c, NNNmodule.c, _nnn/NNN.c, _nnn/NNNmodule.c |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1117 if macSrcExists(cname): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1118 srcs = [cname] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1119 elif macSrcExists(cmodulename): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1120 srcs = [cmodulename] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1121 elif macSrcExists(dirname, cname): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1122 # XXX(nnorwitz): If all the names ended with module, we |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1123 # wouldn't need this condition. ibcarbon is the only one. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1124 srcs = [os.path.join(dirname, cname)] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1125 elif macSrcExists(dirname, cmodulename): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1126 srcs = [os.path.join(dirname, cmodulename)] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1127 else: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1128 raise RuntimeError("%s not found" % name) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1129 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1130 # Here's the whole point: add the extension with sources |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1131 exts.append(Extension(name, srcs + extra_srcs, **kwds)) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1132 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1133 # Core Foundation |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1134 core_kwds = {'extra_compile_args': carbon_extra_compile_args, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1135 'extra_link_args': ['-framework', 'CoreFoundation'], |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1136 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1137 addMacExtension('_CF', core_kwds, ['cf/pycfbridge.c']) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1138 addMacExtension('autoGIL', core_kwds) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1139 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1140 # Carbon |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1141 carbon_kwds = {'extra_compile_args': carbon_extra_compile_args, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1142 'extra_link_args': ['-framework', 'Carbon'], |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1143 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1144 CARBON_EXTS = ['ColorPicker', 'gestalt', 'MacOS', 'Nav', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1145 'OSATerminology', 'icglue', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1146 # All these are in subdirs |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1147 '_AE', '_AH', '_App', '_CarbonEvt', '_Cm', '_Ctl', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1148 '_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1149 '_Help', '_Icn', '_IBCarbon', '_List', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1150 '_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1151 '_Scrap', '_Snd', '_TE', '_Win', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1152 ] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1153 for name in CARBON_EXTS: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1154 addMacExtension(name, carbon_kwds) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1155 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1156 # Application Services & QuickTime |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1157 app_kwds = {'extra_compile_args': carbon_extra_compile_args, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1158 'extra_link_args': ['-framework','ApplicationServices'], |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1159 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1160 addMacExtension('_Launch', app_kwds) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1161 addMacExtension('_CG', app_kwds) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1162 |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
1163 exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1164 extra_compile_args=carbon_extra_compile_args, |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1165 extra_link_args=['-framework', 'QuickTime', |
|
26396
e3fae7b6c207
Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents:
26351
diff
changeset
|
1166 '-framework', 'Carbon']) ) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1167 |
|
21787
3ef7bed007f6
Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents:
21775
diff
changeset
|
1168 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1169 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
|
1170 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1171 # 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
|
1172 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
|
1173 |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1174 if '_tkinter' not in [e.name for e in self.extensions]: |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1175 missing.append('_tkinter') |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1176 |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1177 return missing |
|
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41464
diff
changeset
|
1178 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1179 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
|
1180 # 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
|
1181 # 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
|
1182 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
|
1183 framework_dirs = [ |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1184 '/System/Library/Frameworks/', |
|
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1185 '/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
|
1186 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
|
1187 ] |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1188 |
|
36156
c71ca1cd363b
typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents:
36144
diff
changeset
|
1189 # Find the directory that contains the Tcl.framework and Tk.framework |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1190 # bundles. |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1191 # 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
|
1192 for F in framework_dirs: |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1193 # 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
|
1194 for fw in 'Tcl', 'Tk': |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1195 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
|
1196 break |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1197 else: |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1198 # 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
|
1199 # building |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1200 break |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1201 else: |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1202 # 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
|
1203 # 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
|
1204 return 0 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1205 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1206 # 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
|
1207 # 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
|
1208 # 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
|
1209 # |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1210 include_dirs = [ |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1211 join(F, fw + '.framework', H) |
|
41464
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41253
diff
changeset
|
1212 for fw in ('Tcl', 'Tk') |
|
060c79f6d919
Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents:
41253
diff
changeset
|
1213 for H in ('Headers', 'Versions/Current/PrivateHeaders') |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1214 ] |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1215 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1216 # 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
|
1217 # 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
|
1218 # 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
|
1219 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
|
1220 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
|
1221 |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1222 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
|
1223 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
|
1224 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
|
1225 libraries = [], |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1226 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
|
1227 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
|
1228 ) |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1229 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
|
1230 return 1 |
|
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1231 |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1232 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1233 def detect_tkinter(self, inc_dirs, lib_dirs): |
| 15940 | 1234 # 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
|
1235 |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1236 # 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
|
1237 # 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
|
1238 # 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
|
1239 platform = self.get_platform() |
|
36156
c71ca1cd363b
typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents:
36144
diff
changeset
|
1240 if (platform == 'darwin' and |
|
c71ca1cd363b
typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents:
36144
diff
changeset
|
1241 self.detect_tkinter_darwin(inc_dirs, lib_dirs)): |
|
27507
d9d57f5f98cd
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
27396
diff
changeset
|
1242 return |
|
23957
03bba7282852
Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents:
23889
diff
changeset
|
1243 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1244 # 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
|
1245 # 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
|
1246 # 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
|
1247 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
|
1248 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
|
1249 '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
|
1250 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
|
1251 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
|
1252 if tklib and tcllib: |
| 15940 | 1253 # Exit the loop when we've found the Tcl/Tk libraries |
| 1254 break | |
| 1255 | |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1256 # 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
|
1257 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
|
1258 # 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
|
1259 # 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
|
1260 dotversion = version |
|
4eb458c3941d
[Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents:
31468
diff
changeset
|
1261 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
|
1262 # 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
|
1263 # 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
|
1264 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
|
1265 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
|
1266 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
|
1267 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
|
1268 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
|
1269 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
|
1270 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
|
1271 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
|
1272 tk_includes = find_file('tk.h', inc_dirs, tk_include_sub) |
| 15940 | 1273 |
|
28947
8df897f14fb8
Change 'and' to 'or' in _tkinter test.
Martin v. Löwis <martin@v.loewis.de>
parents:
28940
diff
changeset
|
1274 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
|
1275 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
|
1276 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
|
1277 return |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1278 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1279 # OK... everything seems to be present for Tcl/Tk. |
| 15940 | 1280 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1281 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
|
1282 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
|
1283 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
|
1284 include_dirs.append(dir) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1285 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1286 # 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
|
1287 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
|
1288 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
|
1289 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
|
1290 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
|
1291 include_dirs.append('/usr/X11R6/include') |
|
33986
49b6e966e57f
Patch #1050475: Fix various x86_64 build issues
Martin v. Löwis <martin@v.loewis.de>
parents:
33750
diff
changeset
|
1292 added_lib_dirs.append('/usr/X11R6/lib64') |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1293 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
|
1294 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
|
1295 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
|
1296 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
|
1297 else: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1298 # 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
|
1299 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
|
1300 added_lib_dirs.append('/usr/X11/lib') |
| 15940 | 1301 |
|
27695
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1302 # 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
|
1303 if platform == 'cygwin': |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1304 x11_inc = find_file('X11/Xlib.h', [], include_dirs) |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1305 if x11_inc is None: |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1306 return |
|
1a300f475332
This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents:
27694
diff
changeset
|
1307 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1308 # Check for BLT extension |
| 21274 | 1309 if self.compiler.find_library_file(lib_dirs + added_lib_dirs, |
| 1310 'BLT8.0'): | |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1311 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
|
1312 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
|
1313 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
|
1314 'BLT'): |
|
e41ee2b8e73d
Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents:
26616
diff
changeset
|
1315 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
|
1316 libs.append('BLT') |
| 15940 | 1317 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1318 # 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
|
1319 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
|
1320 libs.append('tcl'+ version) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1321 |
|
16192
4fe69a9f8b30
Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents:
16176
diff
changeset
|
1322 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
|
1323 libs.append('ld') |
| 15940 | 1324 |
|
18819
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
1325 # 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
|
1326 if platform != "cygwin": |
|
dc9baf80c45a
Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents:
18601
diff
changeset
|
1327 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
|
1328 |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1329 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
|
1330 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
|
1331 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
|
1332 libraries = libs, |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1333 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
|
1334 ) |
|
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1335 self.extensions.append(ext) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1336 |
|
27820
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1337 ## # 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
|
1338 ## ext = Extension('xx', ['xxmodule.c']) |
|
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1339 ## self.extensions.append(ext) |
|
fbc45beaf034
Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents:
27695
diff
changeset
|
1340 |
|
15996
c503fa9b265e
Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents:
15970
diff
changeset
|
1341 # XXX handle these, but how to detect? |
| 15940 | 1342 # *** 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
|
1343 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ |
| 15940 | 1344 # *** 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
|
1345 # -DWITH_TOGL togl.c \ |
| 15940 | 1346 # *** Uncomment these for TOGL extension only: |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1347 # -lGL -lGLU -lXext -lXmu \ |
| 15940 | 1348 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1349 def configure_ctypes(self, ext): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1350 if not self.use_system_libffi: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1351 (srcdir,) = sysconfig.get_config_vars('srcdir') |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1352 ffi_builddir = os.path.join(self.build_temp, 'libffi') |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1353 ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules', |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1354 '_ctypes', 'libffi')) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1355 ffi_configfile = os.path.join(ffi_builddir, 'fficonfig.py') |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1356 |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1357 from distutils.dep_util import newer_group |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1358 |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1359 config_sources = [os.path.join(ffi_srcdir, fname) |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40807
diff
changeset
|
1360 for fname in os.listdir(ffi_srcdir) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40807
diff
changeset
|
1361 if os.path.isfile(os.path.join(ffi_srcdir, fname))] |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1362 if self.force or newer_group(config_sources, |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1363 ffi_configfile): |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1364 from distutils.dir_util import mkpath |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1365 mkpath(ffi_builddir) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1366 config_args = [] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1367 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1368 # Pass empty CFLAGS because we'll just append the resulting |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1369 # CFLAGS to Python's; -g or -O2 is to be avoided. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1370 cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1371 % (ffi_builddir, ffi_srcdir, " ".join(config_args)) |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1372 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1373 res = os.system(cmd) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1374 if res or not os.path.exists(ffi_configfile): |
|
40774
793e0323d4d6
Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents:
40645
diff
changeset
|
1375 print("Failed to configure _ctypes module") |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1376 return False |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1377 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1378 fficonfig = {} |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1379 fp = open(ffi_configfile) |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1380 try: |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1381 script = fp.read() |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1382 finally: |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1383 fp.close() |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42501
diff
changeset
|
1384 exec(script, globals(), fficonfig) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1385 ffi_srcdir = os.path.join(fficonfig['ffi_srcdir'], 'src') |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1386 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1387 # Add .S (preprocessed assembly) to C compiler source extensions. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1388 self.compiler.src_extensions.append('.S') |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1389 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1390 include_dirs = [os.path.join(ffi_builddir, 'include'), |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1391 ffi_builddir, ffi_srcdir] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1392 extra_compile_args = fficonfig['ffi_cflags'].split() |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1393 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1394 ext.sources.extend(fficonfig['ffi_sources']) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1395 ext.include_dirs.extend(include_dirs) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1396 ext.extra_compile_args.extend(extra_compile_args) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1397 return True |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1398 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1399 def detect_ctypes(self, inc_dirs, lib_dirs): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1400 self.use_system_libffi = False |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1401 include_dirs = [] |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1402 extra_compile_args = [] |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1403 extra_link_args = [] |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1404 sources = ['_ctypes/_ctypes.c', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1405 '_ctypes/callbacks.c', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1406 '_ctypes/callproc.c', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1407 '_ctypes/stgdict.c', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1408 '_ctypes/cfield.c', |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1409 '_ctypes/malloc_closure.c'] |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1410 depends = ['_ctypes/ctypes.h'] |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1411 |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1412 if sys.platform == 'darwin': |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1413 sources.append('_ctypes/darwin/dlfcn_simple.c') |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1414 include_dirs.append('_ctypes/darwin') |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1415 # XXX Is this still needed? |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1416 ## extra_link_args.extend(['-read_only_relocs', 'warning']) |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1417 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1418 elif sys.platform == 'sunos5': |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1419 # XXX This shouldn't be necessary; it appears that some |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1420 # of the assembler code is non-PIC (i.e. it has relocations |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1421 # when it shouldn't. The proper fix would be to rewrite |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1422 # the assembler code to be PIC. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1423 # This only works with GCC; the Sun compiler likely refuses |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1424 # this option. If you want to compile ctypes with the Sun |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1425 # compiler, please research a proper solution, instead of |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1426 # finding some -z option for the Sun compiler. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1427 extra_link_args.append('-mimpure-text') |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1428 |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1429 ext = Extension('_ctypes', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1430 include_dirs=include_dirs, |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1431 extra_compile_args=extra_compile_args, |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
1432 extra_link_args=extra_link_args, |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1433 libraries=[], |
|
36898
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1434 sources=sources, |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1435 depends=depends) |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1436 ext_test = Extension('_ctypes_test', |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1437 sources=['_ctypes/_ctypes_test.c']) |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1438 self.extensions.extend([ext, ext_test]) |
|
27905ebaddab
Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents:
36817
diff
changeset
|
1439 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1440 if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1441 return |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1442 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1443 ffi_inc = find_file('ffi.h', [], inc_dirs) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1444 if ffi_inc is not None: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1445 ffi_h = ffi_inc[0] + '/ffi.h' |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1446 fp = open(ffi_h) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1447 while 1: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1448 line = fp.readline() |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1449 if not line: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1450 ffi_inc = None |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1451 break |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1452 if line.startswith('#define LIBFFI_H'): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1453 break |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1454 ffi_lib = None |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1455 if ffi_inc is not None: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1456 for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1457 if (self.compiler.find_library_file(lib_dirs, lib_name)): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1458 ffi_lib = lib_name |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1459 break |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1460 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1461 if ffi_inc and ffi_lib: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1462 ext.include_dirs.extend(ffi_inc) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1463 ext.libraries.append(ffi_lib) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1464 self.use_system_libffi = True |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1465 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36898
diff
changeset
|
1466 |
|
17886
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
1467 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
|
1468 # 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
|
1469 # 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
|
1470 # installation: |
|
0af824c88203
Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents:
17531
diff
changeset
|
1471 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
|
1472 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
|
1473 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
|
1474 |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1475 class PyBuildInstallLib(install_lib): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1476 # 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
|
1477 # 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
|
1478 # 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
|
1479 # 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
|
1480 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1481 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
|
1482 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1483 def install(self): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1484 outfiles = install_lib.install(self) |
|
42084
229c28cb9afb
Merged revisions 55817-55961 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41969
diff
changeset
|
1485 self.set_file_modes(outfiles, 0o644, 0o755) |
|
229c28cb9afb
Merged revisions 55817-55961 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41969
diff
changeset
|
1486 self.set_dir_modes(self.install_dir, 0o755) |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1487 return outfiles |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1488 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1489 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
|
1490 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
|
1491 if not files: return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1492 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1493 for filename in files: |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1494 if os.path.islink(filename): continue |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1495 mode = defaultMode |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1496 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
|
1497 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
|
1498 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
|
1499 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1500 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
|
1501 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
|
1502 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
|
1503 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1504 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
|
1505 if os.path.islink(dirname): return |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1506 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
|
1507 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
|
1508 |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1509 def is_chmod_supported(self): |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1510 return hasattr(os, 'chmod') |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1511 |
|
27990
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1512 SUMMARY = """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1513 Python is an interpreted, interactive, object-oriented programming |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1514 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
|
1515 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1516 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
|
1517 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
|
1518 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
|
1519 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
|
1520 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
|
1521 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
|
1522 programmable interface. |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1523 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1524 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
|
1525 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
|
1526 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
|
1527 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
|
1528 yourself. |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1529 """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1530 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1531 CLASSIFIERS = """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1532 Development Status :: 3 - Alpha |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1533 Development Status :: 6 - Mature |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1534 License :: OSI Approved :: Python Software Foundation License |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1535 Natural Language :: English |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1536 Programming Language :: C |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1537 Programming Language :: Python |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1538 Topic :: Software Development |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1539 """ |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1540 |
| 15940 | 1541 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
|
1542 # 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
|
1543 import warnings |
|
a1ddc4080cc5
Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents:
17889
diff
changeset
|
1544 warnings.filterwarnings("ignore",category=DeprecationWarning) |
|
27990
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1545 setup(# PyPI Metadata (PEP 301) |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1546 name = "Python", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1547 version = sys.version.split()[0], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1548 url = "http://www.python.org/%s" % sys.version[:3], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1549 maintainer = "Guido van Rossum and the Python community", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1550 maintainer_email = "python-dev@python.org", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1551 description = "A high-level object-oriented programming language", |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1552 long_description = SUMMARY.strip(), |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1553 license = "PSF license", |
|
42142
a53e48be6df9
Merged revisions 56125-56153 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42084
diff
changeset
|
1554 classifiers = [x for x in CLASSIFIERS.split("\n") if x], |
|
27990
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1555 platforms = ["Many"], |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1556 |
|
0b3db0edb151
Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents:
27989
diff
changeset
|
1557 # Build info |
|
26687
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1558 cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, |
|
6b390548c698
This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents:
26674
diff
changeset
|
1559 'install_lib':PyBuildInstallLib}, |
| 15940 | 1560 # The struct module is defined here, because build_ext won't be |
| 1561 # called unless there's at least one extension module defined. | |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1562 ext_modules=[Extension('_struct', ['_struct.c'])], |
| 16844 | 1563 |
| 1564 # Scripts to install | |
|
32416
950cf69c69b6
Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents:
32400
diff
changeset
|
1565 scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', |
|
950cf69c69b6
Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents:
32400
diff
changeset
|
1566 'Lib/smtpd.py'] |
| 15940 | 1567 ) |
|
16201
38678cb0b3cd
the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents:
16192
diff
changeset
|
1568 |
| 15940 | 1569 # --install-platlib |
| 1570 if __name__ == '__main__': | |
| 1571 main() |
