annotate setup.py @ 83240:87331820569a 2.7

- Issue #17086: Search the include and library directories provided by the compiler.
author doko@ubuntu.com
date Thu, 11 Apr 2013 00:19:55 +0200
parents 83fd64c97296
children cd577c328886
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
44948
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
7 from glob import glob
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
8 from platform import machine as platform_machine
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58294
diff changeset
9 import sysconfig
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
10
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
11 from distutils import log
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
12 from distutils import text_file
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
13 from distutils.errors import *
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
14 from distutils.core import Extension, setup
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
15 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
16 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
17 from distutils.command.install_lib import install_lib
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
18 from distutils.spawn import find_executable
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
19
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
20 cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
21
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
22 def get_platform():
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
23 # cross build
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
24 if "_PYTHON_HOST_PLATFORM" in os.environ:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
25 return os.environ["_PYTHON_HOST_PLATFORM"]
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
26 # Get value of sys.platform
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
27 if sys.platform.startswith('osf1'):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
28 return 'osf1'
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
29 return sys.platform
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
30 host_platform = get_platform()
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
31
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
32 # Were we compiled --with-pydebug or with #define Py_DEBUG?
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
33 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
34
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
35 # This global variable is used to hold the list of modules to be disabled.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
36 disabled_module_list = []
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
37
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
38 def add_dir_to_list(dirlist, dir):
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
39 """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
40 1) 'dir' is not already in 'dirlist'
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
41 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
42 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
43 dirlist.insert(0, dir)
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
44
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
45 def macosx_sdk_root():
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
46 """
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
47 Return the directory of the current OSX SDK,
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
48 or '/' if no SDK was specified.
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
49 """
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
50 cflags = sysconfig.get_config_var('CFLAGS')
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
51 m = re.search(r'-isysroot\s+(\S+)', cflags)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
52 if m is None:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
53 sysroot = '/'
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
54 else:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
55 sysroot = m.group(1)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
56 return sysroot
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
57
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
58 def is_macosx_sdk_path(path):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
59 """
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
60 Returns True if 'path' can be located in an OSX SDK
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
61 """
78330
e0eb7dea245f Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77483
diff changeset
62 return ( (path.startswith('/usr/') and not path.startswith('/usr/local'))
e0eb7dea245f Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77483
diff changeset
63 or path.startswith('/System/')
e0eb7dea245f Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77483
diff changeset
64 or path.startswith('/Library/') )
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
65
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
66 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
67 """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
68 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
69 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
70
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
71 '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
72 '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
73 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
74 '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
75 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
76 """
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
77 if host_platform == 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
78 # Honor the MacOSX SDK setting when one was specified.
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
79 # An SDK is a directory with the same structure as a real
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
80 # system, but with only header files and libraries.
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
81 sysroot = macosx_sdk_root()
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
82
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
83 # 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
84 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
85 f = os.path.join(dir, filename)
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
86
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
87 if host_platform == 'darwin' and is_macosx_sdk_path(dir):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
88 f = os.path.join(sysroot, dir[1:], filename)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
89
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
90 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
91
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
92 # 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
93 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
94 f = os.path.join(dir, filename)
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
95
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
96 if host_platform == 'darwin' and is_macosx_sdk_path(dir):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
97 f = os.path.join(sysroot, dir[1:], filename)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
98
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
99 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
100 return [dir]
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
101
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
102 # Not found anywhere
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
103 return None
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
104
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
105 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
106 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
107 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
108 return None
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
109
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
110 if host_platform == 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
111 sysroot = macosx_sdk_root()
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
112
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
113 # 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
114 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
115 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
116 # 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
117 p = p.rstrip(os.sep)
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
118
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
119 if host_platform == 'darwin' and is_macosx_sdk_path(p):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
120 if os.path.join(sysroot, p[1:]) == dirname:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
121 return [ ]
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
122
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
123 if p == dirname:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
124 return [ ]
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
125
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
126 # 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
127 # 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
128 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
129 # 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
130 p = p.rstrip(os.sep)
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
131
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
132 if host_platform == 'darwin' and is_macosx_sdk_path(p):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
133 if os.path.join(sysroot, p[1:]) == dirname:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
134 return [ p ]
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
135
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
136 if p == dirname:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
137 return [p]
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
138 else:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
139 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
140
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
141 def module_enabled(extlist, modname):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
142 """Returns whether the module 'modname' is present in the list
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
143 of extensions 'extlist'."""
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
144 extlist = [ext for ext in extlist if ext.name == modname]
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
145 return len(extlist)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
146
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
147 def find_module_file(module, dirlist):
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
148 """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
149 return the unadorned filename"""
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
150 list = find_file(module, [], dirlist)
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
151 if not list:
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
152 return module
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
153 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
154 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
155 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
156
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
157 class PyBuildExt(build_ext):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
158
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
159 def __init__(self, dist):
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
160 build_ext.__init__(self, dist)
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
161 self.failed = []
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
162
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
163 def build_extensions(self):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
164
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
165 # Detect which modules should be compiled
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
166 missing = self.detect_modules()
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
167
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
168 # Remove modules that are present on the disabled list
44741
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
169 extensions = [ext for ext in self.extensions
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
170 if ext.name not in disabled_module_list]
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
171 # move ctypes to the end, it depends on other modules
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
172 ext_map = dict((ext.name, i) for i, ext in enumerate(extensions))
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
173 if "_ctypes" in ext_map:
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
174 ctypes = extensions.pop(ext_map["_ctypes"])
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
175 extensions.append(ctypes)
bbf484581043 Build _ctypes after the other extensions. Its build process depends
Christian Heimes <christian@cheimes.de>
parents: 43703
diff changeset
176 self.extensions = extensions
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
177
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
178 # Fix up the autodetected modules, prefixing all the source files
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
179 # with Modules/ and adding Python's include directory to the path.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
180 (srcdir,) = sysconfig.get_config_vars('srcdir')
25790
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
181 if not srcdir:
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
182 # Maybe running on Windows but not using CYGWIN?
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
183 raise ValueError("No source directory; cannot proceed.")
51358
a1893c691879 Distutils apparently requires an absolute path so provide one.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51351
diff changeset
184 srcdir = os.path.abspath(srcdir)
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
185 moddirlist = [os.path.join(srcdir, 'Modules')]
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
186
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
187 # Platform-dependent module source and include directories
51351
e05c6be6af10 Oops, Mac build needs the 'incdirlist' variable so restore it.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51346
diff changeset
188 incdirlist = []
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
189
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
190 if host_platform == 'darwin' 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
191 sysconfig.get_config_var("CONFIG_ARGS")):
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
192 # Mac OS X also includes some mac-specific modules
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
193 macmoddir = os.path.join(srcdir, 'Mac/Modules')
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
194 moddirlist.append(macmoddir)
51351
e05c6be6af10 Oops, Mac build needs the 'incdirlist' variable so restore it.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51346
diff changeset
195 incdirlist.append(os.path.join(srcdir, 'Mac/Include'))
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
196
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
197 # 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
198 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
199 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
200
44948
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
201 # Python header files
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
202 headers = [sysconfig.get_config_h_filename()]
75350
3e2c230f4664 Issue #14152: backport fix.
Stefan Krah <skrah@bytereef.org>
parents: 69188
diff changeset
203 headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
204 for ext in self.extensions[:]:
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
205 ext.sources = [ find_module_file(filename, moddirlist)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
206 for filename in ext.sources ]
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
207 if ext.depends is not None:
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
208 ext.depends = [find_module_file(filename, moddirlist)
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
209 for filename in ext.depends]
44948
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
210 else:
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
211 ext.depends = []
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
212 # re-compile extensions if a header file has been changed
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
213 ext.depends.extend(headers)
1be93dd179df Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
Christian Heimes <christian@cheimes.de>
parents: 44945
diff changeset
214
51351
e05c6be6af10 Oops, Mac build needs the 'incdirlist' variable so restore it.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51346
diff changeset
215 # platform specific include directories
e05c6be6af10 Oops, Mac build needs the 'incdirlist' variable so restore it.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51346
diff changeset
216 ext.include_dirs.extend(incdirlist)
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
217
16038
b6863ba88989 GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents: 16013
diff changeset
218 # 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
219 # 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
220 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
221 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
222
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
223 # Parse Modules/Setup and Modules/Setup.local to figure out which
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
224 # modules are turned on in the file.
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
225 remove_modules = []
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
226 for filename in ('Modules/Setup', 'Modules/Setup.local'):
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
227 input = text_file.TextFile(filename, join_lines=1)
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
228 while 1:
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
229 line = input.readline()
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
230 if not line: break
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
231 line = line.split()
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
232 remove_modules.append(line[0])
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
233 input.close()
36162
1e595b6c924e Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 36156
diff changeset
234
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
235 for ext in self.extensions[:]:
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
236 if ext.name in remove_modules:
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
237 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
238
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
239 # 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
240 # 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
241 # 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
242 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
243 args = {}
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
244 # 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
245 # compilers
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
246 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
247 (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
248 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
249 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
250
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
251 build_ext.build_extensions(self)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
252
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
253 longest = max([len(e.name) for e in self.extensions])
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
254 if self.failed:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
255 longest = max(longest, max([len(name) for name in self.failed]))
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
256
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
257 def print_three_column(lst):
41028
d4577215539d Fix cmp vs. key argument for list.sort.
Georg Brandl <georg@python.org>
parents: 41025
diff changeset
258 lst.sort(key=str.lower)
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
259 # guarantee zip() doesn't drop anything
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
260 while len(lst) % 3:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
261 lst.append("")
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
262 for e, f, g in zip(lst[::3], lst[1::3], lst[2::3]):
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
263 print "%-*s %-*s %-*s" % (longest, e, longest, f,
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
264 longest, g)
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
265
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
266 if missing:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
267 print
50332
6a0566a51218 #4731: clarify message about missing module prerequisites.
Georg Brandl <georg@python.org>
parents: 50062
diff changeset
268 print ("Python build finished, but the necessary bits to build "
6a0566a51218 #4731: clarify message about missing module prerequisites.
Georg Brandl <georg@python.org>
parents: 50062
diff changeset
269 "these modules were not found:")
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
270 print_three_column(missing)
42717
199504fb91c5 When setup.py fails to find the necessary bits to build some modules, have it
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 41784
diff changeset
271 print ("To find the necessary bits, look in setup.py in"
199504fb91c5 When setup.py fails to find the necessary bits to build some modules, have it
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 41784
diff changeset
272 " detect_modules() for the module's name.")
199504fb91c5 When setup.py fails to find the necessary bits to build some modules, have it
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 41784
diff changeset
273 print
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
274
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
275 if self.failed:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
276 failed = self.failed[:]
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
277 print
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
278 print "Failed to build these modules:"
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
279 print_three_column(failed)
42717
199504fb91c5 When setup.py fails to find the necessary bits to build some modules, have it
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 41784
diff changeset
280 print
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
281
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
282 def build_extension(self, ext):
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
283
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
284 if ext.name == '_ctypes':
37537
5bc2b4e3ffc1 Don't try to build ctypes when configuration of libffi fails.
Thomas Heller <theller@ctypes.org>
parents: 37536
diff changeset
285 if not self.configure_ctypes(ext):
5bc2b4e3ffc1 Don't try to build ctypes when configuration of libffi fails.
Thomas Heller <theller@ctypes.org>
parents: 37536
diff changeset
286 return
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
287
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
288 try:
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
289 build_ext.build_extension(self, ext)
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
290 except (CCompilerError, DistutilsError), why:
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
291 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
292 (ext.name, sys.exc_info()[1]))
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
293 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
294 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
295 # 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
296 # 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
297 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
298 self.announce(
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
299 '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
300 ext.name)
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
301 return
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
302
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
303 if host_platform == 'darwin' and (
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
304 sys.maxint > 2**32 and '-arch' in ext.extra_link_args):
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
305 # Don't bother doing an import check when an extension was
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
306 # build with an explicit '-arch' flag on OSX. That's currently
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
307 # only used to build 32-bit only extensions in a 4-way
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
308 # universal build and loading 32-bit code into a 64-bit
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
309 # process will fail.
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
310 self.announce(
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
311 'WARNING: skipping import check for "%s"' %
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
312 ext.name)
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
313 return
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
314
23513
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
315 # 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
316 # modules have been imported
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
317 if host_platform == 'cygwin':
23513
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
318 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
319 % ext.name)
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
320 return
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
321 ext_filename = os.path.join(
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
322 self.build_lib,
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
323 self.get_ext_filename(self.get_ext_fullname(ext.name)))
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
324
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
325 # Don't try to load extensions for cross builds
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
326 if cross_compiling:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
327 return
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
328
17890
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
329 try:
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
330 imp.load_dynamic(ext.name, ext_filename)
28111
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
331 except ImportError, why:
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
332 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
333 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
334 ' 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
335 assert not self.inplace
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
336 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
337 newname = basename + "_failed" + tail
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
338 if os.path.exists(newname):
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
339 os.remove(newname)
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
340 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
341
28111
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
342 # 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
343 # 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
344 # _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
345 # use here.
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
346 # 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
347 # 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
348 try:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
349 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
350 os.remove(filename)
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
351 except AttributeError:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
352 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
353 except:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
354 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
355 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
356 '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
357 level=3)
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
358 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
359
69188
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
360 def add_multiarch_paths(self):
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
361 # Debian/Ubuntu multiarch support.
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
362 # https://wiki.ubuntu.com/MultiarchSpec
79080
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
363 cc = sysconfig.get_config_var('CC')
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
364 tmpfile = os.path.join(self.build_temp, 'multiarch')
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
365 if not os.path.exists(self.build_temp):
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
366 os.makedirs(self.build_temp)
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
367 ret = os.system(
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
368 '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
369 multiarch_path_component = ''
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
370 try:
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
371 if ret >> 8 == 0:
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
372 with open(tmpfile) as fp:
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
373 multiarch_path_component = fp.readline().strip()
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
374 finally:
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
375 os.unlink(tmpfile)
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
376
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
377 if multiarch_path_component != '':
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
378 add_dir_to_list(self.compiler.library_dirs,
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
379 '/usr/lib/' + multiarch_path_component)
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
380 add_dir_to_list(self.compiler.include_dirs,
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
381 '/usr/include/' + multiarch_path_component)
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
382 return
53fa224b95f4 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78863
diff changeset
383
69188
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
384 if not find_executable('dpkg-architecture'):
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
385 return
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
386 opt = ''
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
387 if cross_compiling:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
388 opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')
69188
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
389 tmpfile = os.path.join(self.build_temp, 'multiarch')
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
390 if not os.path.exists(self.build_temp):
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
391 os.makedirs(self.build_temp)
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
392 ret = os.system(
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
393 'dpkg-architecture %s -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
394 (opt, tmpfile))
69188
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
395 try:
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
396 if ret >> 8 == 0:
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
397 with open(tmpfile) as fp:
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
398 multiarch_path_component = fp.readline().strip()
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
399 add_dir_to_list(self.compiler.library_dirs,
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
400 '/usr/lib/' + multiarch_path_component)
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
401 add_dir_to_list(self.compiler.include_dirs,
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
402 '/usr/include/' + multiarch_path_component)
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
403 finally:
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
404 os.unlink(tmpfile)
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
405
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
406 def add_gcc_paths(self):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
407 gcc = sysconfig.get_config_var('CC')
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
408 tmpfile = os.path.join(self.build_temp, 'gccpaths')
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
409 if not os.path.exists(self.build_temp):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
410 os.makedirs(self.build_temp)
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
411 ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
412 is_gcc = False
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
413 in_incdirs = False
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
414 inc_dirs = []
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
415 lib_dirs = []
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
416 try:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
417 if ret >> 8 == 0:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
418 with open(tmpfile) as fp:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
419 for line in fp.readlines():
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
420 if line.startswith("gcc version"):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
421 is_gcc = True
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
422 elif line.startswith("#include <...>"):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
423 in_incdirs = True
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
424 elif line.startswith("End of search list"):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
425 in_incdirs = False
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
426 elif is_gcc and line.startswith("LIBRARY_PATH"):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
427 for d in line.strip().split("=")[1].split(":"):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
428 d = os.path.normpath(d)
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
429 if '/gcc/' not in d:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
430 add_dir_to_list(self.compiler.library_dirs,
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
431 d)
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
432 elif is_gcc and in_incdirs and '/gcc/' not in line:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
433 add_dir_to_list(self.compiler.include_dirs,
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
434 line.strip())
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
435 finally:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
436 os.unlink(tmpfile)
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
437
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
438 def detect_modules(self):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
439 # Ensure that /usr/local is always used
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
440 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
441 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
83240
87331820569a - Issue #17086: Search the include and library directories provided by the
doko@ubuntu.com
parents: 82777
diff changeset
442 self.add_gcc_paths()
69188
bd0f73a9538e Backport for Python 2.7 of issue 11715 support for building Python on
Barry Warsaw <barry@python.org>
parents: 68588
diff changeset
443 self.add_multiarch_paths()
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
444
34124
4e38ecd1912e setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents: 33986
diff changeset
445 # 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
446 # 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
447 # 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
448 # 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
449 # 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
450 # 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
451 for env_var, arg_name, dir_list in (
49517
8d2a69711a97 backport a fix for setup.py's -R
Benjamin Peterson <benjamin@python.org>
parents: 45157
diff changeset
452 ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
34124
4e38ecd1912e setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents: 33986
diff changeset
453 ('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
454 ('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
455 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
456 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
457 # To prevent optparse from raising an exception about any
49454
7efddae50d25 backport
Skip Montanaro <skip@pobox.com>
parents: 49445
diff changeset
458 # options in env_val that it doesn't know about we strip out
34288
5dc274e15822 Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents: 34186
diff changeset
459 # 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
460 # 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
461 #
5dc274e15822 Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents: 34186
diff changeset
462 # 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
463 # 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
464 # 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
465 # used for a library directory.
42773
3fba14ec9aae Bug #1765375: fix stripping of unwanted LDFLAGS.
Georg Brandl <georg@python.org>
parents: 42770
diff changeset
466 env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1],
3fba14ec9aae Bug #1765375: fix stripping of unwanted LDFLAGS.
Georg Brandl <georg@python.org>
parents: 42770
diff changeset
467 ' ', 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
468 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
469 # 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
470 # allowed
5dc274e15822 Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents: 34186
diff changeset
471 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
472 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
473 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
474 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
475 if options.dirs:
45130
6e134aa73879 Backport r60537: have order of CPPFLAGS and LDFLAGS be honored.
Brett Cannon <bcannon@gmail.com>
parents: 45129
diff changeset
476 for directory in reversed(options.dirs):
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
477 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
478
65558
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
479 if os.path.normpath(sys.prefix) != '/usr' \
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
480 and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
481 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
482 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
483 # building a framework with different architectures than
e850bb930c84 Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64778
diff changeset
484 # the one that is currently installed (issue #7473)
24477
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
485 add_dir_to_list(self.compiler.library_dirs,
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
486 sysconfig.get_config_var("LIBDIR"))
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
487 add_dir_to_list(self.compiler.include_dirs,
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
488 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
489
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
490 try:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
491 have_unicode = unicode
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
492 except NameError:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
493 have_unicode = 0
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
494
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
495 # 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
496 # 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
497 # be assumed that no additional -I,-L directives are needed.
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
498 inc_dirs = self.compiler.include_dirs[:]
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
499 lib_dirs = self.compiler.library_dirs[:]
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
500 if not cross_compiling:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
501 for d in (
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
502 '/usr/include',
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
503 ):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
504 add_dir_to_list(inc_dirs, d)
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
505 for d in (
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
506 '/lib64', '/usr/lib64',
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
507 '/lib', '/usr/lib',
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
508 ):
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
509 add_dir_to_list(lib_dirs, d)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
510 exts = []
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
511 missing = []
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
512
34911
87719ae9288c Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents: 34717
diff changeset
513 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
514 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
515
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
516 srcdir = sysconfig.get_config_var('srcdir')
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
517
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
518 # Check for AtheOS which has libraries in non-standard locations
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
519 if host_platform == 'atheos':
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
520 lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
521 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
522 inc_dirs += ['/system/include', '/atheos/autolnk/include']
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
523 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
524
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
525 # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
526 if host_platform in ['osf1', 'unixware7', 'openunix8']:
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
527 lib_dirs += ['/usr/ccs/lib']
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
528
76265
cc2e3c6d2669 Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75350
diff changeset
529 # HP-UX11iv3 keeps files in lib/hpux folders.
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
530 if host_platform == 'hp-ux11':
76265
cc2e3c6d2669 Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75350
diff changeset
531 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
cc2e3c6d2669 Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75350
diff changeset
532
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
533 if host_platform == 'darwin':
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
534 # This should work on any unixy platform ;-)
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
535 # If the user has bothered specifying additional -I and -L flags
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
536 # in OPT and LDFLAGS we might as well use them here.
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
537 # NOTE: using shlex.split would technically be more correct, but
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
538 # also gives a bootstrap problem. Let's hope nobody uses directories
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
539 # with whitespace in the name to store libraries.
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
540 cflags, ldflags = sysconfig.get_config_vars(
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
541 'CFLAGS', 'LDFLAGS')
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
542 for item in cflags.split():
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
543 if item.startswith('-I'):
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
544 inc_dirs.append(item[2:])
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
545
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
546 for item in ldflags.split():
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
547 if item.startswith('-L'):
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
548 lib_dirs.append(item[2:])
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
549
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
550 # 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
551 math_libs = ['m']
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
552 if host_platform in ['darwin', 'beos']:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
553 math_libs = []
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
554
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
555 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
556
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
557 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
558 # The following modules are all pretty straightforward, and compile
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
559 # on pretty much any POSIXish platform.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
560 #
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
561
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
562 # Some modules that are normally always on:
64202
996604cde41f Remove weakref from setup.py now that it is builtin.
Georg Brandl <georg@python.org>
parents: 63831
diff changeset
563 #exts.append( Extension('_weakref', ['_weakref.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
564
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
565 # array objects
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
566 exts.append( Extension('array', ['arraymodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
567 # complex math library functions
57864
7f5cbc28f433 Issue #7518: Move substitute definitions of C99 math functions from
Mark Dickinson <dickinsm@gmail.com>
parents: 57760
diff changeset
568 exts.append( Extension('cmath', ['cmathmodule.c', '_math.c'],
7f5cbc28f433 Issue #7518: Move substitute definitions of C99 math functions from
Mark Dickinson <dickinsm@gmail.com>
parents: 57760
diff changeset
569 depends=['_math.h'],
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
570 libraries=math_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
571 # math library functions, e.g. sin()
57756
b206ad8cf5bf Issue #3366: Add expm1 function to math module. Thanks Eric Smith for
Mark Dickinson <dickinsm@gmail.com>
parents: 57482
diff changeset
572 exts.append( Extension('math', ['mathmodule.c', '_math.c'],
57760
b356ed9564e6 Add _math.h to math module dependencies in setup.py.
Mark Dickinson <dickinsm@gmail.com>
parents: 57756
diff changeset
573 depends=['_math.h'],
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
574 libraries=math_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
575 # fast string operations implemented in C
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
576 exts.append( Extension('strop', ['stropmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
577 # 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
578 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
579 libraries=math_libs) )
32400
6ce67f7b0430 Add compilation of timemodule.c with datetimemodule.c to get
Brett Cannon <bcannon@gmail.com>
parents: 32244
diff changeset
580 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
581 libraries=math_libs) )
46024
7da5b68971a5 Move itertools before future_builtins since the latter depends on the former.
Neal Norwitz <nnorwitz@gmail.com>
parents: 45655
diff changeset
582 # fast iterator tools implemented in C
7da5b68971a5 Move itertools before future_builtins since the latter depends on the former.
Neal Norwitz <nnorwitz@gmail.com>
parents: 45655
diff changeset
583 exts.append( Extension("itertools", ["itertoolsmodule.c"]) )
45439
8eb598331231 Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct().
Eric Smith <eric@trueblade.com>
parents: 45128
diff changeset
584 # code that will be builtins in the future, but conflict with the
8eb598331231 Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct().
Eric Smith <eric@trueblade.com>
parents: 45128
diff changeset
585 # current builtins
8eb598331231 Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct().
Eric Smith <eric@trueblade.com>
parents: 45128
diff changeset
586 exts.append( Extension('future_builtins', ['future_builtins.c']) )
26829
f64c96922708 SF patch 658251: Install a C implementation of the Mersenne Twister as the
Raymond Hettinger <python@rcn.com>
parents: 26724
diff changeset
587 # random number generator implemented in C
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
588 exts.append( Extension("_random", ["_randommodule.c"]) )
31436
63fa60f2d61c * Move collections.deque() in from the sandbox
Raymond Hettinger <python@rcn.com>
parents: 31386
diff changeset
589 # high-performance collections
40989
4087c0ec733b Prepare collections module for pure python code entries.
Raymond Hettinger <python@rcn.com>
parents: 40844
diff changeset
590 exts.append( Extension("_collections", ["_collectionsmodule.c"]) )
31353
ed20259a1ea5 SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents: 31090
diff changeset
591 # bisect
ed20259a1ea5 SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents: 31090
diff changeset
592 exts.append( Extension("_bisect", ["_bisectmodule.c"]) )
30875
2acd28bd4d0f Convert heapq.py to a C implementation.
Raymond Hettinger <python@rcn.com>
parents: 30770
diff changeset
593 # heapq
31931
63b68cb2b442 * Restore the pure python version of heapq.py.
Raymond Hettinger <python@rcn.com>
parents: 31742
diff changeset
594 exts.append( Extension("_heapq", ["_heapqmodule.c"]) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
595 # operator.add() and similar goodies
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
596 exts.append( Extension('operator', ['operator.c']) )
54717
760a710eb6c1 Issue #6215: backport the 3.1 io lib
Antoine Pitrou <solipsis@pitrou.net>
parents: 53605
diff changeset
597 # Python 3.1 _io library
760a710eb6c1 Issue #6215: backport the 3.1 io lib
Antoine Pitrou <solipsis@pitrou.net>
parents: 53605
diff changeset
598 exts.append( Extension("_io",
760a710eb6c1 Issue #6215: backport the 3.1 io lib
Antoine Pitrou <solipsis@pitrou.net>
parents: 53605
diff changeset
599 ["_io/bufferedio.c", "_io/bytesio.c", "_io/fileio.c",
760a710eb6c1 Issue #6215: backport the 3.1 io lib
Antoine Pitrou <solipsis@pitrou.net>
parents: 53605
diff changeset
600 "_io/iobase.c", "_io/_iomodule.c", "_io/stringio.c", "_io/textio.c"],
760a710eb6c1 Issue #6215: backport the 3.1 io lib
Antoine Pitrou <solipsis@pitrou.net>
parents: 53605
diff changeset
601 depends=["_io/_iomodule.h"], include_dirs=["Modules/_io"]))
38477
aa065f820252 Apply modified version of Collin Winter's patch #1478788
Nick Coghlan <ncoghlan@gmail.com>
parents: 38348
diff changeset
602 # _functools
aa065f820252 Apply modified version of Collin Winter's patch #1478788
Nick Coghlan <ncoghlan@gmail.com>
parents: 38348
diff changeset
603 exts.append( Extension("_functools", ["_functoolsmodule.c"]) )
46676
4ded35754cb7 Add the 'json' package. Code taken from simplejson 1.9 and contributed by Bob
Brett Cannon <bcannon@gmail.com>
parents: 46319
diff changeset
604 # _json speedups
4ded35754cb7 Add the 'json' package. Code taken from simplejson 1.9 and contributed by Bob
Brett Cannon <bcannon@gmail.com>
parents: 46319
diff changeset
605 exts.append( Extension("_json", ["_json.c"]) )
16416
7d39d9dcf2d6 Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents: 16415
diff changeset
606 # Python C API test module
51521
7d6cdf335a57 Merged revisions 69500 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 50062
diff changeset
607 exts.append( Extension('_testcapi', ['_testcapimodule.c'],
7d6cdf335a57 Merged revisions 69500 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 50062
diff changeset
608 depends=['testcapi_long.h']) )
36459
3abf33264146 Added the cProfile module.
Armin Rigo <arigo@tunes.org>
parents: 36396
diff changeset
609 # profilers (_lsprof is for cProfile.py)
3abf33264146 Added the cProfile module.
Armin Rigo <arigo@tunes.org>
parents: 36396
diff changeset
610 exts.append( Extension('_hotshot', ['_hotshot.c']) )
3abf33264146 Added the cProfile module.
Armin Rigo <arigo@tunes.org>
parents: 36396
diff changeset
611 exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
612 # static Unicode character database
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
613 if have_unicode:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
614 exts.append( Extension('unicodedata', ['unicodedata.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
615 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
616 missing.append('unicodedata')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
617 # 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
618 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
619 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
620 if m is not None:
24810
7ce82e9d08c7 Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents: 24790
diff changeset
621 locale_libs = ['intl']
7ce82e9d08c7 Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents: 24790
diff changeset
622 else:
7ce82e9d08c7 Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents: 24790
diff changeset
623 locale_libs = []
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
624 if host_platform == 'darwin':
32698
7742f85a3723 _localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents: 32416
diff changeset
625 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
626 else:
7742f85a3723 _localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents: 32416
diff changeset
627 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
628
32698
7742f85a3723 _localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents: 32416
diff changeset
629
24810
7ce82e9d08c7 Patch #588564: _locale library patch
Jason Tishler <jason@tishler.net>
parents: 24790
diff changeset
630 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
631 libraries=locale_libs,
7742f85a3723 _localemodule now needs to be linked with CoreFoundation on darwin.
Jack Jansen <jack.jansen@cwi.nl>
parents: 32416
diff changeset
632 extra_link_args=locale_extra_link_args) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
633
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
634 # Modules with some UNIX dependencies -- on by default:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
635 # (If you have a really backward UNIX, select and socket may not be
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
636 # supported...)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
637
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
638 # fcntl(2) and ioctl(2)
64521
adfa1e488734 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64202
diff changeset
639 libs = []
adfa1e488734 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64202
diff changeset
640 if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
adfa1e488734 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64202
diff changeset
641 # May be necessary on AIX for flock function
adfa1e488734 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64202
diff changeset
642 libs = ['bsd']
adfa1e488734 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64202
diff changeset
643 exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
644 # pwd(3)
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
645 exts.append( Extension('pwd', ['pwdmodule.c']) )
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
646 # grp(3)
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
647 exts.append( Extension('grp', ['grpmodule.c']) )
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
648 # spwd, shadow passwords
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
649 if (config_h_vars.get('HAVE_GETSPNAM', False) or
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
650 config_h_vars.get('HAVE_GETSPENT', False)):
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
651 exts.append( Extension('spwd', ['spwdmodule.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
652 else:
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
653 missing.append('spwd')
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
654
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
655 # select(2); not on ancient System V
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
656 exts.append( Extension('select', ['selectmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
657
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
658 # Fred Drake's interface to the Python parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
659 exts.append( Extension('parser', ['parsermodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
660
22805
f1af8ad11000 Removed old Digital Creations copyright/license notices (with
Guido van Rossum <guido@python.org>
parents: 22545
diff changeset
661 # cStringIO and cPickle
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
662 exts.append( Extension('cStringIO', ['cStringIO.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
663 exts.append( Extension('cPickle', ['cPickle.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
664
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
665 # Memory-mapped files (also works on Win32).
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
666 if host_platform not in ['atheos']:
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
667 exts.append( Extension('mmap', ['mmapmodule.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
668 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
669 missing.append('mmap')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
670
33370
af65004f622f Remove mpz, rotor, xreadlines modules
Andrew M. Kuchling <amk@amk.ca>
parents: 33294
diff changeset
671 # Lance Ellinghaus's syslog module
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
672 # syslog daemon interface
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
673 exts.append( Extension('syslog', ['syslogmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
674
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
675 # George Neville-Neil's timing module:
36817
bc0797b06a99 Stop building timing module, it's old and deprecated
Neal Norwitz <nnorwitz@gmail.com>
parents: 36668
diff changeset
676 # Deprecated in PEP 4 http://www.python.org/peps/pep-0004.html
bc0797b06a99 Stop building timing module, it's old and deprecated
Neal Norwitz <nnorwitz@gmail.com>
parents: 36668
diff changeset
677 # http://mail.python.org/pipermail/python-dev/2006-January/060023.html
bc0797b06a99 Stop building timing module, it's old and deprecated
Neal Norwitz <nnorwitz@gmail.com>
parents: 36668
diff changeset
678 #exts.append( Extension('timing', ['timingmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
679
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
680 #
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
681 # 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
682 # libraries, are platform-specific, or present other surprises.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
683 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
684
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
685 # Multimedia modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
686 # These don't work for 64-bit platforms!!!
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
687 # These represent audio samples or images as strings:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
688
32763
8ad5a1620092 Move comment that goes along with audioop
Neal Norwitz <nnorwitz@gmail.com>
parents: 32762
diff changeset
689 # Operations on audio samples
32797
ea54fdb86530 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 32765
diff changeset
690 # 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
691 # 64-bit platforms.
76ad814bc67c Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents: 32735
diff changeset
692 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
693
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
694 # Disabled on 64-bit platforms
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
695 if sys.maxint != 9223372036854775807L:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
696 # Operations on images
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
697 exts.append( Extension('imageop', ['imageop.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
698 else:
41784
b7fb942b403e Remove the rgbimg module. It has been deprecated since Python 2.5.
Brett Cannon <bcannon@gmail.com>
parents: 41028
diff changeset
699 missing.extend(['imageop'])
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
700
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
701 # 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
702 do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
703 readline_termcap_library = ""
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
704 curses_library = ""
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
705 # Determine if readline is already linked against curses or tinfo.
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
706 if do_readline and find_executable('ldd'):
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
707 fp = os.popen("ldd %s" % do_readline)
63054
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
708 ldd_output = fp.readlines()
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
709 ret = fp.close()
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
710 if ret is None or ret >> 8 == 0:
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
711 for ln in ldd_output:
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
712 if 'curses' in ln:
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
713 readline_termcap_library = re.sub(
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
714 r'.*lib(n?cursesw?)\.so.*', r'\1', ln
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
715 ).rstrip()
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
716 break
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
717 if 'tinfo' in ln: # termcap interface split out from ncurses
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
718 readline_termcap_library = 'tinfo'
b22893be08c7 Merged revisions 82929 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62542
diff changeset
719 break
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
720 # Issue 7384: If readline is already linked against curses,
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
721 # use the same library for the readline and curses modules.
62046
1b4c30742a24 Issue #7384: If the system readline library is linked against ncurses,
Stefan Krah <stefan@bytereef.org>
parents: 62039
diff changeset
722 if 'curses' in readline_termcap_library:
1b4c30742a24 Issue #7384: If the system readline library is linked against ncurses,
Stefan Krah <stefan@bytereef.org>
parents: 62039
diff changeset
723 curses_library = readline_termcap_library
62049
8825a7e6a5f0 Use compiler rather than compiler_obj. Thanks Michael Foord for noticing.
Stefan Krah <stefan@bytereef.org>
parents: 62046
diff changeset
724 elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
725 curses_library = 'ncursesw'
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
726 elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
727 curses_library = 'ncurses'
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
728 elif self.compiler.find_library_file(lib_dirs, 'curses'):
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
729 curses_library = 'curses'
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
730
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
731 if host_platform == 'darwin':
58820
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
732 os_release = int(os.uname()[2].split('.')[0])
59459
39d7047807d5 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58820
diff changeset
733 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
39d7047807d5 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58820
diff changeset
734 if dep_target and dep_target.split('.') < ['10', '5']:
39d7047807d5 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58820
diff changeset
735 os_release = 8
58820
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
736 if os_release < 9:
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
737 # MacOSX 10.4 has a broken readline. Don't try to build
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
738 # the readline module unless the user has installed a fixed
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
739 # readline package
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
740 if find_file('readline/rlconf.h', inc_dirs, []) is None:
f108f6275855 Backport the patch that enables linking the readline
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58602
diff changeset
741 do_readline = False
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
742 if do_readline:
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
743 if host_platform == 'darwin' and os_release < 9:
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
744 # In every directory on the search path search for a dynamic
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
745 # library and then a static library, instead of first looking
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
746 # for dynamic libraries on the entiry path.
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
747 # This way a staticly linked custom readline gets picked up
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
748 # before the (possibly broken) dynamic library in /usr/lib.
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
749 readline_extra_link_args = ('-Wl,-search_paths_first',)
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
750 else:
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
751 readline_extra_link_args = ()
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
752
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
753 readline_libs = ['readline']
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
754 if readline_termcap_library:
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
755 pass # Issue 7384: Already linked against curses or tinfo.
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
756 elif curses_library:
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
757 readline_libs.append(curses_library)
19319
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
758 elif self.compiler.find_library_file(lib_dirs +
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
759 ['/usr/lib/termcap'],
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
760 'termcap'):
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
761 readline_libs.append('termcap')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
762 exts.append( Extension('readline', ['readline.c'],
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
763 library_dirs=['/usr/lib/termcap'],
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
764 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
765 libraries=readline_libs) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
766 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
767 missing.append('readline')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
768
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
769 # crypt module.
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
770
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
771 if self.compiler.find_library_file(lib_dirs, 'crypt'):
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
772 libs = ['crypt']
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
773 else:
61258
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
774 libs = []
f6785bce54b5 In a number of places code still revers
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60821
diff changeset
775 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
776
28341
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
777 # CSV files
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
778 exts.append( Extension('_csv', ['_csv.c']) )
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
779
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
780 # socket(2)
82776
0f5e1e642dc3 issue #9090 : Take the same approach for socketmodule as daytimemodule
Kristján Valur Jónsson <sweskman@gmail.com>
parents: 82343
diff changeset
781 exts.append( Extension('_socket', ['socketmodule.c', 'timemodule.c'],
0f5e1e642dc3 issue #9090 : Take the same approach for socketmodule as daytimemodule
Kristján Valur Jónsson <sweskman@gmail.com>
parents: 82343
diff changeset
782 depends=['socketmodule.h'],
0f5e1e642dc3 issue #9090 : Take the same approach for socketmodule as daytimemodule
Kristján Valur Jónsson <sweskman@gmail.com>
parents: 82343
diff changeset
783 libraries=math_libs) )
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
784 # 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
785 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
786 '/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
787 '/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
788 ]
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
789 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
790 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
791 )
29043
8e79dc3731bf Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents: 29013
diff changeset
792 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
793 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
794 ['/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
795 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
796 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
797 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
798 ['/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
799 '/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
800 ] )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
801
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
802 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
803 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
804 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
805 include_dirs = ssl_incs,
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
806 library_dirs = ssl_libs,
23811
e3e019bc4e1e Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents: 23777
diff changeset
807 libraries = ['ssl', 'crypto'],
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
808 depends = ['socketmodule.h']), )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
809 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
810 missing.append('_ssl')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
811
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
812 # 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
813 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
814 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
815 '^\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
816
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
817 # look for the openssl version header on the compiler search path.
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
818 opensslv_h = find_file('openssl/opensslv.h', [],
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
819 inc_dirs + search_for_ssl_incs_in)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
820 if opensslv_h:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
821 name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
822 if host_platform == 'darwin' and is_macosx_sdk_path(name):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
823 name = os.path.join(macosx_sdk_root(), name[1:])
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
824 try:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
825 incfile = open(name, 'r')
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
826 for line in incfile:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
827 m = openssl_ver_re.match(line)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
828 if m:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
829 openssl_ver = eval(m.group(1))
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
830 except IOError, msg:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
831 print "IOError while reading opensshv.h:", msg
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
832 pass
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
833
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
834 min_openssl_ver = 0x00907000
58109
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
835 have_any_openssl = ssl_incs is not None and ssl_libs is not None
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
836 have_usable_openssl = (have_any_openssl and
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
837 openssl_ver >= min_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
838
58109
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
839 if have_any_openssl:
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
840 if have_usable_openssl:
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
841 # The _hashlib module wraps optimized implementations
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
842 # of hash functions from the OpenSSL library.
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
843 exts.append( Extension('_hashlib', ['_hashopenssl.c'],
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
844 include_dirs = ssl_incs,
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
845 library_dirs = ssl_libs,
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
846 libraries = ['ssl', 'crypto']) )
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
847 else:
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
848 print ("warning: openssl 0x%08x is too old for _hashlib" %
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
849 openssl_ver)
fe117e5d13a1 make setup.py similar to py3k's when reporting on _hashlib as missing or not.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58100
diff changeset
850 missing.append('_hashlib')
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
851 if COMPILED_WITH_PYDEBUG or not have_usable_openssl:
35375
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
852 # The _sha module implements the SHA1 hash algorithm.
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
853 exts.append( Extension('_sha', ['shamodule.c']) )
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
854 # The _md5 module implements the RSA Data Security, Inc. MD5
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
855 # Message-Digest Algorithm, described in RFC 1321. The
37436
115428bb1d3f - Patch #360466: Replace the MD5 implementation from RSA Data Security Inc
Matthias Klose <doko@ubuntu.com>
parents: 37413
diff changeset
856 # necessary files md5.c and md5.h are included here.
38617
f00518bb5b43 add depends = ['md5.h'] to the _md5 module extension for correctness sake.
Gregory P. Smith <greg@mad-scientist.com>
parents: 38582
diff changeset
857 exts.append( Extension('_md5',
f00518bb5b43 add depends = ['md5.h'] to the _md5 module extension for correctness sake.
Gregory P. Smith <greg@mad-scientist.com>
parents: 38582
diff changeset
858 sources = ['md5module.c', 'md5.c'],
f00518bb5b43 add depends = ['md5.h'] to the _md5 module extension for correctness sake.
Gregory P. Smith <greg@mad-scientist.com>
parents: 38582
diff changeset
859 depends = ['md5.h']) )
35375
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
860
58100
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
861 min_sha2_openssl_ver = 0x00908000
926118417979 Always compile the all versions of the hashlib algorithm modules when Python
Gregory P. Smith <greg@mad-scientist.com>
parents: 58067
diff changeset
862 if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_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
863 # 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
864 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
865 exts.append( Extension('_sha512', ['sha512module.c']) )
35375
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
866
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
867 # Modules that provide persistent dictionary-like semantics. You will
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
868 # probably want to arrange for at least one of them to be available on
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
869 # your machine, though none are defined by default because of library
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
870 # dependencies. The Python module anydbm.py provides an
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
871 # implementation independent wrapper for these; dumbdbm.py provides
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
872 # similar functionality (but slower of course) implemented in Python.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
873
43478
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
874 # Sleepycat^WOracle Berkeley DB interface.
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
875 # http://www.oracle.com/database/berkeley-db/db/index.html
23867
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
876 #
43478
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
877 # This requires the Sleepycat^WOracle DB code. The supported versions
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
878 # are set below. Visit the URL above to download
37691
eac83feeb11f raise the minimum supported BerkeleyDB version to 3.3 and add notes to
Gregory P. Smith <greg@mad-scientist.com>
parents: 37605
diff changeset
879 # a release. Most open source OSes come with one or more
eac83feeb11f raise the minimum supported BerkeleyDB version to 3.3 and add notes to
Gregory P. Smith <greg@mad-scientist.com>
parents: 37605
diff changeset
880 # 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
881
82777
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
882 max_db_ver = (5, 3)
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
883 min_db_ver = (4, 3)
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
884 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
885
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
886 def allow_db_ver(db_ver):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
887 """Returns a boolean if the given BerkeleyDB version is acceptable.
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
888
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
889 Args:
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
890 db_ver: A tuple of the version to verify.
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
891 """
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
892 if not (min_db_ver <= db_ver <= max_db_ver):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
893 return False
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
894 # Use this function to filter out known bad configurations.
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
895 if (4, 6) == db_ver[:2]:
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
896 # BerkeleyDB 4.6.x is not stable on many architectures.
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
897 arch = platform_machine()
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
898 if arch not in ('i386', 'i486', 'i586', 'i686',
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
899 'x86_64', 'ia64'):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
900 return False
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
901 return True
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
902
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
903 def gen_db_minor_ver_nums(major):
82777
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
904 if major == 5:
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
905 for x in range(max_db_ver[1]+1):
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
906 if allow_db_ver((5, x)):
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
907 yield x
83fd64c97296 - Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting
doko@ubuntu.com
parents: 82776
diff changeset
908 elif major == 4:
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
909 for x in range(max_db_ver[1]+1):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
910 if allow_db_ver((4, x)):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
911 yield x
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
912 elif major == 3:
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
913 for x in (3,):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
914 if allow_db_ver((3, x)):
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
915 yield x
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
916 else:
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
917 raise ValueError("unknown major BerkeleyDB version", major)
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
918
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
919 # 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
920 # 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
921 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
922 '/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
923 '/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
924 '/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
925 '/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
926 '/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
927 '/opt/sfw/include/db3',
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
928 # Fink defaults (http://fink.sourceforge.net/)
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
929 '/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
930 '/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
931 ]
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
932 # 4.x minor number specific paths
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
933 for x in gen_db_minor_ver_nums(4):
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
934 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
935 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
936 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
937 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
938 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
939 db_inc_paths.append('/opt/db-4.%d/include' % x)
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
940 # MacPorts default (http://www.macports.org/)
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
941 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
942 # 3.x minor number specific paths
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
943 for x in gen_db_minor_ver_nums(3):
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
944 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
945 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
946 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
947 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
948 db_inc_paths.append('/opt/db-3.%d/include' % x)
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
949
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
950 if cross_compiling:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
951 db_inc_paths = []
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
952
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
953 # Add some common subdirectories for Sleepycat DB to the list,
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
954 # based on the standard include directories. This way DB3/4 gets
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
955 # picked up when it is installed in a non-standard prefix and
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
956 # the user has added that prefix into inc_dirs.
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
957 std_variants = []
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
958 for dn in inc_dirs:
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
959 std_variants.append(os.path.join(dn, 'db3'))
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
960 std_variants.append(os.path.join(dn, 'db4'))
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
961 for x in gen_db_minor_ver_nums(4):
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
962 std_variants.append(os.path.join(dn, "db4%d"%x))
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
963 std_variants.append(os.path.join(dn, "db4.%d"%x))
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
964 for x in gen_db_minor_ver_nums(3):
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
965 std_variants.append(os.path.join(dn, "db3%d"%x))
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
966 std_variants.append(os.path.join(dn, "db3.%d"%x))
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
967
38967
a21e420a597c Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 38946
diff changeset
968 db_inc_paths = std_variants + db_inc_paths
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
969 db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)]
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
970
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
971 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
972
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
973 if host_platform == 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
974 sysroot = macosx_sdk_root()
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
975
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
976 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
977 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
978 # 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
979 # 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
980 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
981 f = os.path.join(d, "db.h")
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
982
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
983 if host_platform == 'darwin' and is_macosx_sdk_path(d):
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
984 f = os.path.join(sysroot, d[1:], "db.h")
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
985
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
986 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
987 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
988 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
989 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
990 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
991 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
992 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
993 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
994 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
995
43478
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
996 # Avoid 4.6 prior to 4.6.21 due to a BerkeleyDB bug
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
997 if db_ver == (4, 6):
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
998 m = re.search(r"#define\WDB_VERSION_PATCH\W(\d+)", f)
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
999 db_patch = int(m.group(1))
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
1000 if db_patch < 21:
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
1001 print "db.h:", db_ver, "patch", db_patch,
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
1002 print "being ignored (4.6.x must be >= 4.6.21)"
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
1003 continue
acdac41f7109 Backport 58344: allow BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module
Gregory P. Smith <greg@mad-scientist.com>
parents: 43210
diff changeset
1004
58357
ca00acc9c304 Merged revisions 77466 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57997
diff changeset
1005 if ( (db_ver not in db_ver_inc_map) and
47351
502e72f28e9e Disable the use of BerkeleyDB 4.6 on platforms that appear to have
Gregory P. Smith <greg@mad-scientist.com>
parents: 47333
diff changeset
1006 allow_db_ver(db_ver) ):
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1007 # save the include directory with the db.h version
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
1008 # (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
1009 db_ver_inc_map[db_ver] = d
40207
98e900499043 Check db_setup_debug for a few print statements; change sqlite_setup_debug to False
Andrew M. Kuchling <amk@amk.ca>
parents: 39422
diff changeset
1010 if db_setup_debug:
98e900499043 Check db_setup_debug for a few print statements; change sqlite_setup_debug to False
Andrew M. Kuchling <amk@amk.ca>
parents: 39422
diff changeset
1011 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
1012 else:
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1013 # we already found a header for this library version
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1014 if db_setup_debug: print "db.h: ignoring", d
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1015 else:
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1016 # ignore this header, it didn't contain a version number
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
1017 if db_setup_debug:
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
1018 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
1019
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1020 db_found_vers = db_ver_inc_map.keys()
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1021 db_found_vers.sort()
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1022
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1023 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
1024 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
1025 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
1026
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1027 # 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
1028 db_dirs_to_check = [
41003
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
1029 db_incdir.replace("include", 'lib64'),
fe9a9d39a351 Teach setup.py how to find Berkeley DB on Macs using MacPorts.
Skip Montanaro <skip@pobox.com>
parents: 40989
diff changeset
1030 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
1031 ]
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1032
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1033 if host_platform != 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1034 db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1035
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1036 else:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1037 # Same as other branch, but takes OSX SDK into account
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1038 tmp = []
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1039 for dn in db_dirs_to_check:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1040 if is_macosx_sdk_path(dn):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1041 if os.path.isdir(os.path.join(sysroot, dn[1:])):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1042 tmp.append(dn)
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1043 else:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1044 if os.path.isdir(dn):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1045 tmp.append(dn)
62542
d3c75c2f46be Merged revisions 82272 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 62353
diff changeset
1046 db_dirs_to_check = tmp
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1047
68503
ee5350f1d0c2 #11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68256
diff changeset
1048 # Look for a version specific db-X.Y before an ambiguous dbX
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1049 # 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
1050 # 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
1051 # 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
1052 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
1053 ('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
1054 ('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
1055 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
1056 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
1057 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
1058 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
1059 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
1060 else:
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1061 if db_setup_debug: print "db lib: ", dblib, "not found"
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1062
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1063 except db_found:
47379
922e5a24cc82 Turn off debugging output for building bsddb.
Brett Cannon <bcannon@gmail.com>
parents: 47351
diff changeset
1064 if db_setup_debug:
922e5a24cc82 Turn off debugging output for building bsddb.
Brett Cannon <bcannon@gmail.com>
parents: 47351
diff changeset
1065 print "bsddb using BerkeleyDB lib:", db_ver, dblib
922e5a24cc82 Turn off debugging output for building bsddb.
Brett Cannon <bcannon@gmail.com>
parents: 47351
diff changeset
1066 print "bsddb 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
1067 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
1068 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
1069 # 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
1070 # 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
1071 # 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
1072 # 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
1073 # 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
1074 # 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
1075 exts.append(Extension('_bsddb', ['_bsddb.c'],
43504
33021e403f3c Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
Gregory P. Smith <greg@mad-scientist.com>
parents: 43477
diff changeset
1076 depends = ['bsddb.h'],
26548
67912d83799f Search in standard library and include dirs for Sleepycat stuff.
Martin v. Löwis <martin@v.loewis.de>
parents: 26443
diff changeset
1077 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
1078 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
1079 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
1080 libraries=dblibs))
23867
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
1081 else:
34158
3626db433104 rewrote the bsddb module BerkeleyDB library and include file locating
Gregory P. Smith <greg@mad-scientist.com>
parents: 34156
diff changeset
1082 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
1083 db_incs = None
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
1084 dblibs = []
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
1085 dblib_dir = None
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1086 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
1087
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1088 # The sqlite interface
40207
98e900499043 Check db_setup_debug for a few print statements; change sqlite_setup_debug to False
Andrew M. Kuchling <amk@amk.ca>
parents: 39422
diff changeset
1089 sqlite_setup_debug = False # verbose debug prints from this script?
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1090
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1091 # We hunt for #define SQLITE_VERSION "n.n.n"
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1092 # We need to find >= sqlite version 3.0.8
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1093 sqlite_incdir = sqlite_libdir = None
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1094 sqlite_inc_paths = [ '/usr/include',
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1095 '/usr/include/sqlite',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1096 '/usr/include/sqlite3',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1097 '/usr/local/include',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1098 '/usr/local/include/sqlite',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1099 '/usr/local/include/sqlite3',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1100 ]
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1101 if cross_compiling:
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1102 sqlite_inc_paths = []
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1103 MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1104 MIN_SQLITE_VERSION = ".".join([str(x)
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1105 for x in MIN_SQLITE_VERSION_NUMBER])
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1106
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1107 # Scan the default include directories before the SQLite specific
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1108 # ones. This allows one to override the copy of sqlite on OSX,
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1109 # where /usr/include contains an old version of sqlite.
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1110 if host_platform == 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1111 sysroot = macosx_sdk_root()
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1112
78442
ef6c6d8adcf5 Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78330
diff changeset
1113 for d_ in inc_dirs + sqlite_inc_paths:
ef6c6d8adcf5 Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78330
diff changeset
1114 d = d_
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1115 if host_platform == 'darwin' and is_macosx_sdk_path(d):
78442
ef6c6d8adcf5 Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78330
diff changeset
1116 d = os.path.join(sysroot, d[1:])
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1117
78442
ef6c6d8adcf5 Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78330
diff changeset
1118 f = os.path.join(d, "sqlite3.h")
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1119 if os.path.exists(f):
37381
91e9fb5cfe14 backport r243 from the pysqlite2 svn repository - lowers the required version
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37362
diff changeset
1120 if sqlite_setup_debug: print "sqlite: found %s"%f
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1121 incf = open(f).read()
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1122 m = re.search(
82343
8b177aea9ddd Issue #5033: Fix building of the sqlite3 extension module
Petri Lehtinen <petri@digip.org>
parents: 82095
diff changeset
1123 r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"([\d\.]*)"', incf)
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1124 if m:
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1125 sqlite_version = m.group(1)
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1126 sqlite_version_tuple = tuple([int(x)
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1127 for x in sqlite_version.split(".")])
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1128 if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER:
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1129 # we win!
40207
98e900499043 Check db_setup_debug for a few print statements; change sqlite_setup_debug to False
Andrew M. Kuchling <amk@amk.ca>
parents: 39422
diff changeset
1130 if sqlite_setup_debug:
98e900499043 Check db_setup_debug for a few print statements; change sqlite_setup_debug to False
Andrew M. Kuchling <amk@amk.ca>
parents: 39422
diff changeset
1131 print "%s/sqlite3.h: version %s"%(d, sqlite_version)
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1132 sqlite_incdir = d
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1133 break
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1134 else:
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1135 if sqlite_setup_debug:
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1136 print "%s: version %d is too old, need >= %s"%(d,
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1137 sqlite_version, MIN_SQLITE_VERSION)
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1138 elif sqlite_setup_debug:
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1139 print "sqlite: %s had no SQLITE_VERSION"%(f,)
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1140
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1141 if sqlite_incdir:
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1142 sqlite_dirs_to_check = [
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1143 os.path.join(sqlite_incdir, '..', 'lib64'),
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1144 os.path.join(sqlite_incdir, '..', 'lib'),
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1145 os.path.join(sqlite_incdir, '..', '..', 'lib64'),
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1146 os.path.join(sqlite_incdir, '..', '..', 'lib'),
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1147 ]
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1148 sqlite_libfile = self.compiler.find_library_file(
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1149 sqlite_dirs_to_check + lib_dirs, 'sqlite3')
49431
2e794757bdc8 Merged revisions 66766-66767,66771-66772,66774,66776,66783-66787,66790,66793,66797 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49346
diff changeset
1150 if sqlite_libfile:
2e794757bdc8 Merged revisions 66766-66767,66771-66772,66774,66776,66783-66787,66790,66793,66797 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49346
diff changeset
1151 sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1152
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1153 if sqlite_incdir and sqlite_libdir:
37938
7da4af95ebad Updated the sqlite3 module to the external pysqlite 2.2.2 version.
Gerhard Häring <gh@ghaering.de>
parents: 37691
diff changeset
1154 sqlite_srcs = ['_sqlite/cache.c',
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1155 '_sqlite/connection.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1156 '_sqlite/cursor.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1157 '_sqlite/microprotocols.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1158 '_sqlite/module.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1159 '_sqlite/prepare_protocol.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1160 '_sqlite/row.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1161 '_sqlite/statement.c',
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1162 '_sqlite/util.c', ]
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1163
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1164 sqlite_defines = []
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1165 if host_platform != "win32":
37495
d3969aeba777 upgrade to final version of pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37492
diff changeset
1166 sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1167 else:
37495
d3969aeba777 upgrade to final version of pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37492
diff changeset
1168 sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
d3969aeba777 upgrade to final version of pysqlite 2.2.0
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37492
diff changeset
1169
59362
04d3ae52ff73 Merged code from pysqlite 2.6.0.
Gerhard Häring <gh@ghaering.de>
parents: 59344
diff changeset
1170 # Comment this out if you want the sqlite3 module to be able to load extensions.
04d3ae52ff73 Merged code from pysqlite 2.6.0.
Gerhard Häring <gh@ghaering.de>
parents: 59344
diff changeset
1171 sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1172
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1173 if host_platform == 'darwin':
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1174 # In every directory on the search path search for a dynamic
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1175 # library and then a static library, instead of first looking
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
1176 # for dynamic libraries on the entire path.
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
1177 # This way a statically linked custom sqlite gets picked up
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1178 # before the dynamic library in /usr/lib.
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1179 sqlite_extra_link_args = ('-Wl,-search_paths_first',)
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1180 else:
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1181 sqlite_extra_link_args = ()
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1182
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1183 exts.append(Extension('_sqlite3', sqlite_srcs,
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1184 define_macros=sqlite_defines,
37406
85b26f4fa2a5 cleaned up setup.py code for sqlite3, based on patch from Gerhard Haering.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37381
diff changeset
1185 include_dirs=["Modules/_sqlite",
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1186 sqlite_incdir],
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1187 library_dirs=sqlite_libdir,
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1188 runtime_library_dirs=sqlite_libdir,
38348
8d28e63e8f21 - Search the sqlite specific search directories
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38262
diff changeset
1189 extra_link_args=sqlite_extra_link_args,
37362
e546274d6503 merged the sqlite-integration branch.
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37313
diff changeset
1190 libraries=["sqlite3",]))
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1191 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1192 missing.append('_sqlite3')
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1193
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1194 # Look for Berkeley db 1.85. Note that it is built as a different
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1195 # module name so it can be included even when later versions are
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1196 # available. A very restrictive search is performed to avoid
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1197 # accidentally building this module with a later version of the
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1198 # underlying db library. May BSD-ish Unixes incorporate db 1.85
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1199 # symbols into libc and place the include file in /usr/include.
42770
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1200 #
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1201 # If the better bsddb library can be built (db_incs is defined)
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1202 # we do not build this one. Otherwise this build will pick up
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1203 # the more recent berkeleydb's db.h file first in the include path
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1204 # when attempting to compile and it will fail.
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1205 f = "/usr/include/db.h"
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1206
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1207 if host_platform == 'darwin':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1208 if is_macosx_sdk_path(f):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1209 sysroot = macosx_sdk_root()
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1210 f = os.path.join(sysroot, f[1:])
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1211
42770
d3baab209626 On systems with both the ancient bsddb 1.85 library and a recent BerkeleyDB 4.x
Gregory P. Smith <greg@mad-scientist.com>
parents: 40845
diff changeset
1212 if os.path.exists(f) and not db_incs:
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1213 data = open(f).read()
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1214 m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1215 if m is not None:
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1216 # bingo - old version used hash file format version 2
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1217 ### XXX this should be fixed to not be platform-dependent
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1218 ### but I don't have direct access to an osf1 platform and
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1219 ### seemed to be muffing the search somehow
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1220 libraries = host_platform == "osf1" and ['db'] or None
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1221 if libraries is not None:
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1222 exts.append(Extension('bsddb185', ['bsddbmodule.c'],
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1223 libraries=libraries))
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1224 else:
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1225 exts.append(Extension('bsddb185', ['bsddbmodule.c']))
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1226 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1227 missing.append('bsddb185')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1228 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1229 missing.append('bsddb185')
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1230
58067
c35075f2a8f3 allow --with-dbmliborder to specify that no dbm modules will be built #6491
Benjamin Peterson <benjamin@python.org>
parents: 58064
diff changeset
1231 dbm_order = ['gdbm']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1232 # The standard Unix dbm module:
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1233 if host_platform not in ['cygwin']:
53605
ae7f82bbf16c - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53602
diff changeset
1234 config_args = [arg.strip("'")
ae7f82bbf16c - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53602
diff changeset
1235 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
58067
c35075f2a8f3 allow --with-dbmliborder to specify that no dbm modules will be built #6491
Benjamin Peterson <benjamin@python.org>
parents: 58064
diff changeset
1236 dbm_args = [arg for arg in config_args
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1237 if arg.startswith('--with-dbmliborder=')]
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1238 if dbm_args:
58067
c35075f2a8f3 allow --with-dbmliborder to specify that no dbm modules will be built #6491
Benjamin Peterson <benjamin@python.org>
parents: 58064
diff changeset
1239 dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":")
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1240 else:
53605
ae7f82bbf16c - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53602
diff changeset
1241 dbm_order = "ndbm:gdbm:bdb".split(":")
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1242 dbmext = None
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1243 for cand in dbm_order:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1244 if cand == "ndbm":
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1245 if find_file("ndbm.h", inc_dirs, []) is not None:
77483
4d62f788aa19 Issue #15044: Handle Fedora 17's approach to ndbm compatibility (backport from 3.x)
Nick Coghlan <ncoghlan@gmail.com>
parents: 76265
diff changeset
1246 # Some systems have -lndbm, others have -lgdbm_compat,
4d62f788aa19 Issue #15044: Handle Fedora 17's approach to ndbm compatibility (backport from 3.x)
Nick Coghlan <ncoghlan@gmail.com>
parents: 76265
diff changeset
1247 # others don't have either
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1248 if self.compiler.find_library_file(lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1249 'ndbm'):
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1250 ndbm_libs = ['ndbm']
77483
4d62f788aa19 Issue #15044: Handle Fedora 17's approach to ndbm compatibility (backport from 3.x)
Nick Coghlan <ncoghlan@gmail.com>
parents: 76265
diff changeset
1251 elif self.compiler.find_library_file(lib_dirs,
4d62f788aa19 Issue #15044: Handle Fedora 17's approach to ndbm compatibility (backport from 3.x)
Nick Coghlan <ncoghlan@gmail.com>
parents: 76265
diff changeset
1252 'gdbm_compat'):
4d62f788aa19 Issue #15044: Handle Fedora 17's approach to ndbm compatibility (backport from 3.x)
Nick Coghlan <ncoghlan@gmail.com>
parents: 76265
diff changeset
1253 ndbm_libs = ['gdbm_compat']
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1254 else:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1255 ndbm_libs = []
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1256 print "building dbm using ndbm"
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1257 dbmext = Extension('dbm', ['dbmmodule.c'],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1258 define_macros=[
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1259 ('HAVE_NDBM_H',None),
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1260 ],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1261 libraries=ndbm_libs)
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1262 break
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1263
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1264 elif cand == "gdbm":
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1265 if self.compiler.find_library_file(lib_dirs, 'gdbm'):
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1266 gdbm_libs = ['gdbm']
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1267 if self.compiler.find_library_file(lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1268 'gdbm_compat'):
53602
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1269 gdbm_libs.append('gdbm_compat')
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1270 if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1271 print "building dbm using gdbm"
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1272 dbmext = Extension(
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1273 'dbm', ['dbmmodule.c'],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1274 define_macros=[
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1275 ('HAVE_GDBM_NDBM_H', None),
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1276 ],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1277 libraries = gdbm_libs)
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1278 break
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1279 if find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1280 print "building dbm using gdbm"
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1281 dbmext = Extension(
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1282 'dbm', ['dbmmodule.c'],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1283 define_macros=[
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1284 ('HAVE_GDBM_DASH_NDBM_H', None),
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1285 ],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1286 libraries = gdbm_libs)
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1287 break
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1288 elif cand == "bdb":
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1289 if db_incs is not None:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1290 print "building dbm using bdb"
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1291 dbmext = Extension('dbm', ['dbmmodule.c'],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1292 library_dirs=dblib_dir,
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1293 runtime_library_dirs=dblib_dir,
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1294 include_dirs=db_incs,
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1295 define_macros=[
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1296 ('HAVE_BERKDB_H', None),
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1297 ('DB_DBM_HSEARCH', None),
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1298 ],
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1299 libraries=dblibs)
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1300 break
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1301 if dbmext is not None:
2ef2cb5773fe - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 52696
diff changeset
1302 exts.append(dbmext)
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1303 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1304 missing.append('dbm')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1305
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1306 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
58067
c35075f2a8f3 allow --with-dbmliborder to specify that no dbm modules will be built #6491
Benjamin Peterson <benjamin@python.org>
parents: 58064
diff changeset
1307 if ('gdbm' in dbm_order and
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1308 self.compiler.find_library_file(lib_dirs, 'gdbm')):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1309 exts.append( Extension('gdbm', ['gdbmmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1310 libraries = ['gdbm'] ) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1311 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1312 missing.append('gdbm')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1313
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1314 # Unix-only modules
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1315 if host_platform not in ['win32']:
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1316 # Steen Lumholt's termios module
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1317 exts.append( Extension('termios', ['termios.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1318 # Jeremy Hylton's rlimit interface
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1319 if host_platform not in ['atheos']:
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
1320 exts.append( Extension('resource', ['resource.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1321 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1322 missing.append('resource')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1323
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
1324 # Sun yellow pages. Some systems have the functions in libc.
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1325 if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and
57997
244b979d544c Merged revisions 77130 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57995
diff changeset
1326 find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
16804
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1327 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
1328 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
1329 else:
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1330 libs = []
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1331 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
1332 libraries = libs) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1333 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1334 missing.append('nis')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1335 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1336 missing.extend(['nis', 'resource', 'termios'])
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1337
31468
de2ed800fa50 a couple other sunos4 support items removed
Skip Montanaro <skip@pobox.com>
parents: 31436
diff changeset
1338 # 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
1339 # provided by the ncurses library.
39390
b7eab1c18e9d [Patch #1464056] Ensure that we use the panelw library when linking with ncursesw.
Andrew M. Kuchling <amk@amk.ca>
parents: 39374
diff changeset
1340 panel_library = 'panel'
62353
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1341 if curses_library.startswith('ncurses'):
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1342 if curses_library == 'ncursesw':
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1343 # Bug 1464056: If _curses.so links with ncursesw,
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1344 # _curses_panel.so must link with panelw.
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1345 panel_library = 'panelw'
0030a7470666 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62051
diff changeset
1346 curses_libs = [curses_library]
36479
d496c0764ad6 Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents: 36459
diff changeset
1347 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
1348 libraries = curses_libs) )
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1349 elif curses_library == 'curses' and host_platform != 'darwin':
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1350 # 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
1351 # the _curses module.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1352 if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1353 curses_libs = ['curses', 'terminfo']
28473
0f558eede6c5 SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents: 28356
diff changeset
1354 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
1355 curses_libs = ['curses', 'termcap']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1356 else:
28473
0f558eede6c5 SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents: 28356
diff changeset
1357 curses_libs = ['curses']
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1358
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1359 exts.append( Extension('_curses', ['_cursesmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1360 libraries = curses_libs) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1361 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1362 missing.append('_curses')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1363
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1364 # 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
1365 if (module_enabled(exts, '_curses') and
39390
b7eab1c18e9d [Patch #1464056] Ensure that we use the panelw library when linking with ncursesw.
Andrew M. Kuchling <amk@amk.ca>
parents: 39374
diff changeset
1366 self.compiler.find_library_file(lib_dirs, panel_library)):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1367 exts.append( Extension('_curses_panel', ['_curses_panel.c'],
39390
b7eab1c18e9d [Patch #1464056] Ensure that we use the panelw library when linking with ncursesw.
Andrew M. Kuchling <amk@amk.ca>
parents: 39374
diff changeset
1368 libraries = [panel_library] + curses_libs) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1369 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1370 missing.append('_curses_panel')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1371
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
1372 # 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
1373 # 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
1374 # 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
1375 #
825948c21f0d Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents: 24605
diff changeset
1376 # 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
1377 # 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
1378 # 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
1379 # 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
1380 # 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
1381 #
825948c21f0d Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents: 24605
diff changeset
1382 # 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
1383 # 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
1384 zlib_inc = find_file('zlib.h', [], inc_dirs)
46038
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1385 have_zlib = False
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
1386 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
1387 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
1388 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
1389 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
1390 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
1391 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
1392 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
1393 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
1394 break
24605
fd4575b56a4d Update the URL for getting zlib, and update the minimal required
Guido van Rossum <guido@python.org>
parents: 24579
diff changeset
1395 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
1396 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
1397 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
1398 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
1399 if (self.compiler.find_library_file(lib_dirs, 'z')):
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1400 if host_platform == "darwin":
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1401 zlib_extra_link_args = ('-Wl,-search_paths_first',)
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1402 else:
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1403 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
1404 exts.append( Extension('zlib', ['zlibmodule.c'],
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1405 libraries = ['z'],
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1406 extra_link_args = zlib_extra_link_args))
46038
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1407 have_zlib = True
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1408 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1409 missing.append('zlib')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1410 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1411 missing.append('zlib')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1412 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1413 missing.append('zlib')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1414
46038
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1415 # Helper module for various ascii-encoders. Uses zlib for an optimized
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1416 # crc32 if we have it. Otherwise binascii uses its own.
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1417 if have_zlib:
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1418 extra_compile_args = ['-DUSE_ZLIB_CRC32']
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1419 libraries = ['z']
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1420 extra_link_args = zlib_extra_link_args
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1421 else:
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1422 extra_compile_args = []
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1423 libraries = []
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1424 extra_link_args = []
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1425 exts.append( Extension('binascii', ['binascii.c'],
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1426 extra_compile_args = extra_compile_args,
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1427 libraries = libraries,
5ca928402e54 Have the binascii module use zlib's optimized crc32() function when available
Gregory P. Smith <greg@mad-scientist.com>
parents: 46024
diff changeset
1428 extra_link_args = extra_link_args) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1429
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1430 # Gustavo Niemeyer's bz2 module.
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1431 if (self.compiler.find_library_file(lib_dirs, 'bz2')):
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1432 if host_platform == "darwin":
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1433 bz2_extra_link_args = ('-Wl,-search_paths_first',)
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1434 else:
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1435 bz2_extra_link_args = ()
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1436 exts.append( Extension('bz2', ['bz2module.c'],
38946
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1437 libraries = ['bz2'],
7c8990cccf9b Use staticly build copies of zlib and bzip2 to build the OSX installer, that
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38617
diff changeset
1438 extra_link_args = bz2_extra_link_args) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1439 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1440 missing.append('bz2')
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1441
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1442 # Interface to the Expat XML parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1443 #
58040
7d6bff722195 update expat comment
Benjamin Peterson <benjamin@python.org>
parents: 58024
diff changeset
1444 # Expat was written by James Clark and is now maintained by a group of
7d6bff722195 update expat comment
Benjamin Peterson <benjamin@python.org>
parents: 58024
diff changeset
1445 # developers on SourceForge; see www.libexpat.org for more information.
7d6bff722195 update expat comment
Benjamin Peterson <benjamin@python.org>
parents: 58024
diff changeset
1446 # The pyexpat module was written by Paul Prescod after a prototype by
7d6bff722195 update expat comment
Benjamin Peterson <benjamin@python.org>
parents: 58024
diff changeset
1447 # Jack Jansen. The Expat source is included in Modules/expat/. Usage
7d6bff722195 update expat comment
Benjamin Peterson <benjamin@python.org>
parents: 58024
diff changeset
1448 # of a system shared libexpat.so is possible with --with-system-expat
65823
6fa48fa2a865 Merged revisions 86040 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 65558
diff changeset
1449 # configure option.
23889
41ab532d4f60 Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents: 23867
diff changeset
1450 #
41ab532d4f60 Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents: 23867
diff changeset
1451 # 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
1452 #
58024
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1453 if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1454 expat_inc = []
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1455 define_macros = []
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1456 expat_lib = ['expat']
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1457 expat_sources = []
82095
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1458 expat_depends = []
58024
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1459 else:
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1460 expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1461 define_macros = [
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1462 ('HAVE_EXPAT_CONFIG_H', '1'),
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1463 ]
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1464 expat_lib = []
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1465 expat_sources = ['expat/xmlparse.c',
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1466 'expat/xmlrole.c',
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1467 'expat/xmltok.c']
82095
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1468 expat_depends = ['expat/ascii.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1469 'expat/asciitab.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1470 'expat/expat.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1471 'expat/expat_config.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1472 'expat/expat_external.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1473 'expat/internal.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1474 'expat/latin1tab.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1475 'expat/utf8tab.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1476 'expat/xmlrole.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1477 'expat/xmltok.h',
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1478 'expat/xmltok_impl.h'
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1479 ]
38040
36c7a4422e30 Patch 1471883: --enable-universalsdk on Mac OS X
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38013
diff changeset
1480
30731
f0da0cad5cd5 Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents: 30485
diff changeset
1481 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
1482 define_macros = define_macros,
58024
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1483 include_dirs = expat_inc,
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1484 libraries = expat_lib,
82095
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1485 sources = ['pyexpat.c'] + expat_sources,
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1486 depends = expat_depends,
30731
f0da0cad5cd5 Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents: 30485
diff changeset
1487 ))
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1488
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1489 # 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
1490 # 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
1491
37234
34f20ab44cef Find a source file in srcdir to allow to build outside of srcdir.
Hye-Shik Chang <hyeshik@gmail.com>
parents: 37021
diff changeset
1492 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
1493 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
1494 exts.append(Extension('_elementtree',
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1495 define_macros = define_macros,
58024
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1496 include_dirs = expat_inc,
8fee2ab53e71 add a --with-system-expat option to build pyexpat against the system's lib #7609
Benjamin Peterson <benjamin@python.org>
parents: 57994
diff changeset
1497 libraries = expat_lib,
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1498 sources = ['_elementtree.c'],
82095
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1499 depends = ['pyexpat.c'] + expat_sources +
bf43e8c30a83 add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81859
diff changeset
1500 expat_depends,
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1501 ))
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1502 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1503 missing.append('_elementtree')
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1504
31386
887ce39f95f2 Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents: 31353
diff changeset
1505 # Hye-Shik Chang's CJKCodecs modules.
34706
d687a8a09a72 Build with --disable-unicode again. Fixes #1158607.
Martin v. Löwis <martin@v.loewis.de>
parents: 34636
diff changeset
1506 if have_unicode:
d687a8a09a72 Build with --disable-unicode again. Fixes #1158607.
Martin v. Löwis <martin@v.loewis.de>
parents: 34636
diff changeset
1507 exts.append(Extension('_multibytecodec',
d687a8a09a72 Build with --disable-unicode again. Fixes #1158607.
Martin v. Löwis <martin@v.loewis.de>
parents: 34636
diff changeset
1508 ['cjkcodecs/multibytecodec.c']))
d687a8a09a72 Build with --disable-unicode again. Fixes #1158607.
Martin v. Löwis <martin@v.loewis.de>
parents: 34636
diff changeset
1509 for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'):
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1510 exts.append(Extension('_codecs_%s' % loc,
34706
d687a8a09a72 Build with --disable-unicode again. Fixes #1158607.
Martin v. Löwis <martin@v.loewis.de>
parents: 34636
diff changeset
1511 ['cjkcodecs/_codecs_%s.c' % loc]))
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1512 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1513 missing.append('_multibytecodec')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1514 for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'):
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1515 missing.append('_codecs_%s' % loc)
31386
887ce39f95f2 Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents: 31353
diff changeset
1516
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1517 # 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
1518 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
1519 # 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
1520 dl_inc = find_file('dlfcn.h', [], inc_dirs)
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1521 if (dl_inc is not None) and (host_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
1522 exts.append( Extension('dl', ['dlmodule.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1523 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1524 missing.append('dl')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1525 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1526 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
1527
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1528 # Thomas Heller's _ctypes module
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1529 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
1530
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1531 # Richard Oudkerk's multiprocessing module
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1532 if host_platform == 'win32': # Windows
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1533 macros = dict()
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1534 libraries = ['ws2_32']
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1535
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1536 elif host_platform == 'darwin': # Mac OSX
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1537 macros = dict()
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1538 libraries = []
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1539
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1540 elif host_platform == 'cygwin': # Cygwin
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1541 macros = dict()
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1542 libraries = []
47845
b85770459591 Give information for compililation of _multiprocessing.SemLock on FreeBSD:
Hye-Shik Chang <hyeshik@gmail.com>
parents: 47577
diff changeset
1543
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1544 elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
47845
b85770459591 Give information for compililation of _multiprocessing.SemLock on FreeBSD:
Hye-Shik Chang <hyeshik@gmail.com>
parents: 47577
diff changeset
1545 # FreeBSD's P1003.1b semaphore support is very experimental
b85770459591 Give information for compililation of _multiprocessing.SemLock on FreeBSD:
Hye-Shik Chang <hyeshik@gmail.com>
parents: 47577
diff changeset
1546 # and has many known problems. (as of June 2008)
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1547 macros = dict()
47845
b85770459591 Give information for compililation of _multiprocessing.SemLock on FreeBSD:
Hye-Shik Chang <hyeshik@gmail.com>
parents: 47577
diff changeset
1548 libraries = []
b85770459591 Give information for compililation of _multiprocessing.SemLock on FreeBSD:
Hye-Shik Chang <hyeshik@gmail.com>
parents: 47577
diff changeset
1549
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1550 elif host_platform.startswith('openbsd'):
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1551 macros = dict()
49346
b4964df64384 issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller
Jesse Noller <jnoller@gmail.com>
parents: 47845
diff changeset
1552 libraries = []
b4964df64384 issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller
Jesse Noller <jnoller@gmail.com>
parents: 47845
diff changeset
1553
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1554 elif host_platform.startswith('netbsd'):
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1555 macros = dict()
52550
6ddbdfdb7a86 Merged revisions 70849 via svnmerge from
Jesse Noller <jnoller@gmail.com>
parents: 52010
diff changeset
1556 libraries = []
6ddbdfdb7a86 Merged revisions 70849 via svnmerge from
Jesse Noller <jnoller@gmail.com>
parents: 52010
diff changeset
1557
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1558 else: # Linux and other unices
52696
d343e802b276 issue5545: Switch to Autoconf for multiprocessing; special thanks to Martin Lowis for help
Jesse Noller <jnoller@gmail.com>
parents: 52549
diff changeset
1559 macros = dict()
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1560 libraries = ['rt']
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1561
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1562 if host_platform == 'win32':
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1563 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1564 '_multiprocessing/semaphore.c',
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1565 '_multiprocessing/pipe_connection.c',
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1566 '_multiprocessing/socket_connection.c',
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1567 '_multiprocessing/win32_functions.c'
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1568 ]
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1569
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1570 else:
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1571 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1572 '_multiprocessing/socket_connection.c'
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1573 ]
57383
2e3ec3bb4be7 Issue #7272: Add configure test to detect whether sem_open works
Mark Dickinson <dickinsm@gmail.com>
parents: 56414
diff changeset
1574 if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
57482
33986648630b Issue #7272, continued: don't re-use existing HAVE_BROKEN_POSIX_SEMAPHORES
Mark Dickinson <dickinsm@gmail.com>
parents: 57383
diff changeset
1575 sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1576 multiprocessing_srcs.append('_multiprocessing/semaphore.c')
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1577
58602
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1578 if sysconfig.get_config_var('WITH_THREAD'):
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1579 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1580 define_macros=macros.items(),
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1581 include_dirs=["Modules/_multiprocessing"]))
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1582 else:
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1583 missing.append('_multiprocessing')
fc5ec7e04177 Merged revisions 68874 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58357
diff changeset
1584
47577
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1585 # End multiprocessing
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1586
4511ecd25634 add the multiprocessing package to fulfill PEP 371
Benjamin Peterson <benjamin@python.org>
parents: 47473
diff changeset
1587
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1588 # Platform-specific libraries
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1589 if host_platform == 'linux2':
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1590 # Linux-specific modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1591 exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1592 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1593 missing.append('linuxaudiodev')
27149
5ed820670af3 Add reminder that ossaudiodev can/should also be built on FreeBSD.
Greg Ward <gward@python.net>
parents: 27148
diff changeset
1594
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1595 if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
60821
8a5b2d06298d - Build the ossaudio extension on GNU/kFreeBSD.
Matthias Klose <doko@ubuntu.com>
parents: 60819
diff changeset
1596 'freebsd7', 'freebsd8')
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1597 or host_platform.startswith("gnukfreebsd")):
27865
65494469ad3e Re-enable compiling ossaudiodev now that it seems to work again.
Guido van Rossum <guido@python.org>
parents: 27820
diff changeset
1598 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1599 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1600 missing.append('ossaudiodev')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1601
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1602 if host_platform == 'sunos5':
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1603 # SunOS specific modules
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1604 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1605 else:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1606 missing.append('sunaudiodev')
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1607
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1608 if host_platform == 'darwin':
56415
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1609 # _scproxy
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1610 exts.append(Extension("_scproxy", [os.path.join(srcdir, "Mac/Modules/_scproxy.c")],
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1611 extra_link_args= [
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1612 '-framework', 'SystemConfiguration',
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1613 '-framework', 'CoreFoundation'
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1614 ]))
b78521ae7a62 Merged revisions 75281 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 56127
diff changeset
1615
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1616
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1617 if host_platform == 'darwin' and ("--disable-toolbox-glue" not in
37313
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1618 sysconfig.get_config_var("CONFIG_ARGS")):
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1619
59459
39d7047807d5 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58820
diff changeset
1620 if int(os.uname()[2].split('.')[0]) >= 8:
37313
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1621 # We're on Mac OS X 10.4 or later, the compiler should
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1622 # support '-Wno-deprecated-declarations'. This will
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1623 # surpress deprecation warnings for the Carbon extensions,
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1624 # these extensions wrap the Carbon APIs and even those
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1625 # parts that are deprecated.
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1626 carbon_extra_compile_args = ['-Wno-deprecated-declarations']
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1627 else:
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1628 carbon_extra_compile_args = []
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1629
26396
e3fae7b6c207 Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents: 26351
diff changeset
1630 # Mac OS X specific modules.
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1631 def macSrcExists(name1, name2=''):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1632 if not name1:
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1633 return None
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1634 names = (name1,)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1635 if name2:
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1636 names = (name1, name2)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1637 path = os.path.join(srcdir, 'Mac', 'Modules', *names)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1638 return os.path.exists(path)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1639
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1640 def addMacExtension(name, kwds, extra_srcs=[]):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1641 dirname = ''
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1642 if name[0] == '_':
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1643 dirname = name[1:].lower()
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1644 cname = name + '.c'
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1645 cmodulename = name + 'module.c'
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1646 # Check for NNN.c, NNNmodule.c, _nnn/NNN.c, _nnn/NNNmodule.c
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1647 if macSrcExists(cname):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1648 srcs = [cname]
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1649 elif macSrcExists(cmodulename):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1650 srcs = [cmodulename]
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1651 elif macSrcExists(dirname, cname):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1652 # XXX(nnorwitz): If all the names ended with module, we
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1653 # wouldn't need this condition. ibcarbon is the only one.
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1654 srcs = [os.path.join(dirname, cname)]
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1655 elif macSrcExists(dirname, cmodulename):
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1656 srcs = [os.path.join(dirname, cmodulename)]
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1657 else:
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1658 raise RuntimeError("%s not found" % name)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1659
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1660 # Here's the whole point: add the extension with sources
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1661 exts.append(Extension(name, srcs + extra_srcs, **kwds))
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1662
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1663 # Core Foundation
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1664 core_kwds = {'extra_compile_args': carbon_extra_compile_args,
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1665 'extra_link_args': ['-framework', 'CoreFoundation'],
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1666 }
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1667 addMacExtension('_CF', core_kwds, ['cf/pycfbridge.c'])
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1668 addMacExtension('autoGIL', core_kwds)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1669
56127
2717d85aba2e Merged revisions 74962 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55967
diff changeset
1670
2717d85aba2e Merged revisions 74962 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55967
diff changeset
1671
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1672 # Carbon
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1673 carbon_kwds = {'extra_compile_args': carbon_extra_compile_args,
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1674 'extra_link_args': ['-framework', 'Carbon'],
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1675 }
37492
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1676 CARBON_EXTS = ['ColorPicker', 'gestalt', 'MacOS', 'Nav',
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1677 'OSATerminology', 'icglue',
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1678 # All these are in subdirs
37492
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1679 '_AE', '_AH', '_App', '_CarbonEvt', '_Cm', '_Ctl',
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1680 '_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm',
37492
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1681 '_Help', '_Icn', '_IBCarbon', '_List',
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1682 '_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs',
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1683 '_Scrap', '_Snd', '_TE',
37492
09990661226d whitespace normalisation
Anthony Baxter <anthonybaxter@gmail.com>
parents: 37458
diff changeset
1684 ]
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1685 for name in CARBON_EXTS:
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1686 addMacExtension(name, carbon_kwds)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1687
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1688 # Workaround for a bug in the version of gcc shipped with Xcode 3.
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1689 # The _Win extension should build just like the other Carbon extensions, but
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1690 # this actually results in a hard crash of the linker.
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1691 #
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1692 if '-arch ppc64' in cflags and '-arch ppc' in cflags:
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1693 win_kwds = {'extra_compile_args': carbon_extra_compile_args + ['-arch', 'i386', '-arch', 'ppc'],
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1694 'extra_link_args': ['-framework', 'Carbon', '-arch', 'i386', '-arch', 'ppc'],
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1695 }
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1696 addMacExtension('_Win', win_kwds)
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1697 else:
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1698 addMacExtension('_Win', carbon_kwds)
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1699
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1700
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1701 # Application Services & QuickTime
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1702 app_kwds = {'extra_compile_args': carbon_extra_compile_args,
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1703 'extra_link_args': ['-framework','ApplicationServices'],
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1704 }
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1705 addMacExtension('_Launch', app_kwds)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1706 addMacExtension('_CG', app_kwds)
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1707
26396
e3fae7b6c207 Don't disable building Mac-specific modules for a non-framework build:
Just van Rossum <just@letterror.com>
parents: 26351
diff changeset
1708 exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
37313
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1709 extra_compile_args=carbon_extra_compile_args,
228e25c93a97 Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 37234
diff changeset
1710 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
1711 '-framework', 'Carbon']) )
37413
7826049acb4b Remove some duplicated code for handling Mac modules. No functional change (intended). Also stoped setting srcdir twice.
Neal Norwitz <nnorwitz@gmail.com>
parents: 37406
diff changeset
1712
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1713
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1714 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
1715
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1716 # 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
1717 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
1718
41025
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1719 if '_tkinter' not in [e.name for e in self.extensions]:
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1720 missing.append('_tkinter')
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1721
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1722 return missing
06992e6b205a patch 1673619 - identify extension modules which cannot be built
Skip Montanaro <skip@pobox.com>
parents: 41003
diff changeset
1723
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1724 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
1725 # 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
1726 # 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
1727 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
1728 framework_dirs = [
52010
c8a8ec87ff1f Merged revisions 70172 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51521
diff changeset
1729 '/Library/Frameworks',
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1730 '/System/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
1731 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
1732 ]
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1733
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1734 sysroot = macosx_sdk_root()
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1735
36156
c71ca1cd363b typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents: 36144
diff changeset
1736 # 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
1737 # bundles.
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1738 # 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
1739 for F in framework_dirs:
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1740 # both Tcl.framework and Tk.framework should be present
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1741
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1742
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1743 for fw in 'Tcl', 'Tk':
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1744 if is_macosx_sdk_path(F):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1745 if not exists(join(sysroot, F[1:], fw + '.framework')):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1746 break
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1747 else:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1748 if not exists(join(F, fw + '.framework')):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1749 break
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1750 else:
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1751 # 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
1752 # building
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1753 break
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1754 else:
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1755 # 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
1756 # 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
1757 return 0
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1758
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1759 # 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
1760 # 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
1761 # 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
1762 #
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1763 include_dirs = [
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1764 join(F, fw + '.framework', H)
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1765 for fw in 'Tcl', 'Tk'
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1766 for H in 'Headers', 'Versions/Current/PrivateHeaders'
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1767 ]
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1768
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1769 # 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
1770 # 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
1771 # 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
1772 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
1773 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
1774
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1775 # All existing framework builds of Tcl/Tk don't support 64-bit
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1776 # architectures.
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1777 cflags = sysconfig.get_config_vars('CFLAGS')[0]
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1778 archs = re.findall('-arch\s+(\w+)', cflags)
62051
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1779
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1780 if is_macosx_sdk_path(F):
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1781 fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(os.path.join(sysroot, F[1:]),))
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1782 else:
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1783 fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(F,))
16fbdf10d100 Merged revisions 81662 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59459
diff changeset
1784
55967
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1785 detected_archs = []
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1786 for ln in fp:
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1787 a = ln.split()[-1]
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1788 if a in archs:
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1789 detected_archs.append(ln.split()[-1])
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1790 fp.close()
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1791
55967
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1792 for a in detected_archs:
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1793 frameworks.append('-arch')
4cccf3ce15a0 Merged revisions 74798 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52550
diff changeset
1794 frameworks.append(a)
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1795
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1796 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
1797 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
1798 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
1799 libraries = [],
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1800 extra_compile_args = frameworks[2:],
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1801 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
1802 )
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1803 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
1804 return 1
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1805
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1806
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1807 def detect_tkinter(self, inc_dirs, lib_dirs):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1808 # 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
1809
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1810 # 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
1811 # 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
1812 # Darwin - either AquaTk, if it is found, or X11 based Tk.
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1813 if (host_platform == 'darwin' and
36156
c71ca1cd363b typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents: 36144
diff changeset
1814 self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1815 return
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1816
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1817 # 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
1818 # 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
1819 # 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
1820 tcllib = tklib = tcl_includes = tk_includes = None
55658
1227e7cc1d9b Issue #6244: Allow detect_tkinter to look for Tcl/Tk 8.6.
Guilherme Polo <ggpolo@gmail.com>
parents: 55126
diff changeset
1821 for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
1227e7cc1d9b Issue #6244: Allow detect_tkinter to look for Tcl/Tk 8.6.
Guilherme Polo <ggpolo@gmail.com>
parents: 55126
diff changeset
1822 '8.2', '82', '8.1', '81', '8.0', '80']:
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1823 tklib = self.compiler.find_library_file(lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1824 'tk' + version)
59344
3574c5fe207c reverted the usage of compiler_obj in Python's setup.py
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
1825 tcllib = self.compiler.find_library_file(lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1826 'tcl' + version)
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1827 if tklib and tcllib:
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1828 # Exit the loop when we've found the Tcl/Tk libraries
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1829 break
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1830
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1831 # 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
1832 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
1833 # 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
1834 # 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
1835 dotversion = version
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1836 if '.' not in dotversion and "bsd" in host_platform.lower():
31741
4eb458c3941d [Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate
Andrew M. Kuchling <amk@amk.ca>
parents: 31468
diff changeset
1837 # 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
1838 # 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
1839 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
1840 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
1841 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
1842 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
1843 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
1844 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
1845 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
1846 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
1847 tk_includes = find_file('tk.h', inc_dirs, tk_include_sub)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1848
28947
8df897f14fb8 Change 'and' to 'or' in _tkinter test.
Martin v. Löwis <martin@v.loewis.de>
parents: 28940
diff changeset
1849 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
1850 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
1851 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
1852 return
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1853
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1854 # OK... everything seems to be present for Tcl/Tk.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1855
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1856 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
1857 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
1858 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
1859 include_dirs.append(dir)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1860
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1861 # Check for various platform-specific directories
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1862 if host_platform == 'sunos5':
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1863 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
1864 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
1865 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
1866 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
1867 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
1868 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
1869 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
1870 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
1871 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
1872 else:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1873 # 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
1874 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
1875 added_lib_dirs.append('/usr/X11/lib')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1876
27695
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1877 # If Cygwin, then verify that X is installed before proceeding
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1878 if host_platform == 'cygwin':
27695
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1879 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1880 if x11_inc is None:
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1881 return
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1882
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1883 # Check for BLT extension
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
1884 if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1885 'BLT8.0'):
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1886 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
1887 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
1888 elif self.compiler.find_library_file(lib_dirs + added_lib_dirs,
55126
b46abc2f2a1f Fixed #6377: distutils compiler switch ignored (and added a deprecation warning if compiler is not used as supposed = a string option)
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54717
diff changeset
1889 'BLT'):
26626
e41ee2b8e73d Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents: 26616
diff changeset
1890 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
1891 libs.append('BLT')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1892
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1893 # 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
1894 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
1895 libs.append('tcl'+ version)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1896
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1897 if host_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
1898 libs.append('ld')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1899
18819
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
1900 # Finally, link with the X11 libraries (not appropriate on cygwin)
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1901 if host_platform != "cygwin":
18819
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
1902 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
1903
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1904 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
1905 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
1906 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
1907 libraries = libs,
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1908 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
1909 )
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1910 self.extensions.append(ext)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1911
27820
fbc45beaf034 Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents: 27695
diff changeset
1912 ## # 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
1913 ## ext = Extension('xx', ['xxmodule.c'])
fbc45beaf034 Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents: 27695
diff changeset
1914 ## self.extensions.append(ext)
fbc45beaf034 Add compilation instructions for xxmodule.c.
Guido van Rossum <guido@python.org>
parents: 27695
diff changeset
1915
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1916 # XXX handle these, but how to detect?
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1917 # *** 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
1918 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1919 # *** 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
1920 # -DWITH_TOGL togl.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1921 # *** Uncomment these for TOGL extension only:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1922 # -lGL -lGLU -lXext -lXmu \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1923
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1924 def configure_ctypes_darwin(self, ext):
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1925 # Darwin (OS X) uses preconfigured files, in
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1926 # the Modules/_ctypes/libffi_osx directory.
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
1927 srcdir = sysconfig.get_config_var('srcdir')
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1928 ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1929 '_ctypes', 'libffi_osx'))
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1930 sources = [os.path.join(ffi_srcdir, p)
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1931 for p in ['ffi.c',
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47449
diff changeset
1932 'x86/darwin64.S',
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1933 'x86/x86-darwin.S',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1934 'x86/x86-ffi_darwin.c',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1935 'x86/x86-ffi64.c',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1936 'powerpc/ppc-darwin.S',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1937 'powerpc/ppc-darwin_closure.S',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1938 'powerpc/ppc-ffi_darwin.c',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1939 'powerpc/ppc64-darwin_closure.S',
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1940 ]]
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1941
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1942 # Add .S (preprocessed assembly) to C compiler source extensions.
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1943 self.compiler.src_extensions.append('.S')
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1944
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1945 include_dirs = [os.path.join(ffi_srcdir, 'include'),
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1946 os.path.join(ffi_srcdir, 'powerpc')]
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1947 ext.include_dirs.extend(include_dirs)
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1948 ext.sources.extend(sources)
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1949 return True
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1950
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
1951 def configure_ctypes(self, ext):
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1952 if not self.use_system_libffi:
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1953 if host_platform == 'darwin':
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1954 return self.configure_ctypes_darwin(ext)
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
1955
51346
90a4c666f77a Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50992
diff changeset
1956 srcdir = sysconfig.get_config_var('srcdir')
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1957 ffi_builddir = os.path.join(self.build_temp, 'libffi')
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1958 ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1959 '_ctypes', 'libffi'))
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1960 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
1961
38013
4da0f7621325 Rerun the libffi configuration if any of the files used for that
Thomas Heller <theller@ctypes.org>
parents: 37938
diff changeset
1962 from distutils.dep_util import newer_group
4da0f7621325 Rerun the libffi configuration if any of the files used for that
Thomas Heller <theller@ctypes.org>
parents: 37938
diff changeset
1963
4da0f7621325 Rerun the libffi configuration if any of the files used for that
Thomas Heller <theller@ctypes.org>
parents: 37938
diff changeset
1964 config_sources = [os.path.join(ffi_srcdir, fname)
40845
0972c2176af9 Backport 53776: Ignore directory time stamps
Martin v. Löwis <martin@v.loewis.de>
parents: 40546
diff changeset
1965 for fname in os.listdir(ffi_srcdir)
0972c2176af9 Backport 53776: Ignore directory time stamps
Martin v. Löwis <martin@v.loewis.de>
parents: 40546
diff changeset
1966 if os.path.isfile(os.path.join(ffi_srcdir, fname))]
38013
4da0f7621325 Rerun the libffi configuration if any of the files used for that
Thomas Heller <theller@ctypes.org>
parents: 37938
diff changeset
1967 if self.force or newer_group(config_sources,
4da0f7621325 Rerun the libffi configuration if any of the files used for that
Thomas Heller <theller@ctypes.org>
parents: 37938
diff changeset
1968 ffi_configfile):
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1969 from distutils.dir_util import mkpath
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1970 mkpath(ffi_builddir)
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1971 config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
1972 if (('--host=' in arg) or ('--build=' in arg))]
78863
962e8b2a39f3 Issue #15591: run ctypes' configure in quiet mode when setup.py runs silently
Christian Heimes <christian@cheimes.de>
parents: 78442
diff changeset
1973 if not self.verbose:
962e8b2a39f3 Issue #15591: run ctypes' configure in quiet mode when setup.py runs silently
Christian Heimes <christian@cheimes.de>
parents: 78442
diff changeset
1974 config_args.append("-q")
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1975
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1976 # Pass empty CFLAGS because we'll just append the resulting
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1977 # CFLAGS to Python's; -g or -O2 is to be avoided.
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1978 cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1979 % (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
1980
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1981 res = os.system(cmd)
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1982 if res or not os.path.exists(ffi_configfile):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1983 print "Failed to configure _ctypes module"
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1984 return False
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1985
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1986 fficonfig = {}
58294
31250c34833a Use `with`
Antoine Pitrou <solipsis@pitrou.net>
parents: 58293
diff changeset
1987 with open(ffi_configfile) as f:
31250c34833a Use `with`
Antoine Pitrou <solipsis@pitrou.net>
parents: 58293
diff changeset
1988 exec f in fficonfig
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1989
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1990 # Add .S (preprocessed assembly) to C compiler source extensions.
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1991 self.compiler.src_extensions.append('.S')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1992
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1993 include_dirs = [os.path.join(ffi_builddir, 'include'),
58357
ca00acc9c304 Merged revisions 77466 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57997
diff changeset
1994 ffi_builddir,
ca00acc9c304 Merged revisions 77466 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57997
diff changeset
1995 os.path.join(ffi_srcdir, 'src')]
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
1996 extra_compile_args = fficonfig['ffi_cflags'].split()
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
1997
58357
ca00acc9c304 Merged revisions 77466 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57997
diff changeset
1998 ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
ca00acc9c304 Merged revisions 77466 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 57997
diff changeset
1999 fficonfig['ffi_sources'])
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2000 ext.include_dirs.extend(include_dirs)
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2001 ext.extra_compile_args.extend(extra_compile_args)
37537
5bc2b4e3ffc1 Don't try to build ctypes when configuration of libffi fails.
Thomas Heller <theller@ctypes.org>
parents: 37536
diff changeset
2002 return True
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
2003
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2004 def detect_ctypes(self, inc_dirs, lib_dirs):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2005 self.use_system_libffi = False
37536
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
2006 include_dirs = []
9bed30df7a4a Configure Modules/_ctypes/libffi just before building the _ctypes extension.
Thomas Heller <theller@ctypes.org>
parents: 37495
diff changeset
2007 extra_compile_args = []
39374
465a078d2ca6 Fix #1530448 - fix ctypes build failure on solaris 10.
Thomas Heller <theller@ctypes.org>
parents: 38967
diff changeset
2008 extra_link_args = []
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2009 sources = ['_ctypes/_ctypes.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2010 '_ctypes/callbacks.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2011 '_ctypes/callproc.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2012 '_ctypes/stgdict.c',
63831
e13ea83e2edb Fis issue5504: ctypes does now work with systems where mmap can't be
Thomas Heller <theller@ctypes.org>
parents: 63053
diff changeset
2013 '_ctypes/cfield.c']
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2014 depends = ['_ctypes/ctypes.h']
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2015
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
2016 if host_platform == 'darwin':
64778
d1771b4cd0cb Merged revisions 84535 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64521
diff changeset
2017 sources.append('_ctypes/malloc_closure.c')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2018 sources.append('_ctypes/darwin/dlfcn_simple.c')
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
2019 extra_compile_args.append('-DMACOSX')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2020 include_dirs.append('_ctypes/darwin')
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2021 # XXX Is this still needed?
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2022 ## 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
2023
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
2024 elif host_platform == 'sunos5':
39422
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2025 # XXX This shouldn't be necessary; it appears that some
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2026 # of the assembler code is non-PIC (i.e. it has relocations
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2027 # when it shouldn't. The proper fix would be to rewrite
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2028 # the assembler code to be PIC.
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2029 # This only works with GCC; the Sun compiler likely refuses
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2030 # this option. If you want to compile ctypes with the Sun
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2031 # compiler, please research a proper solution, instead of
ddea4d37c83c Add some commentary on -mimpure-text.
Martin v. Löwis <martin@v.loewis.de>
parents: 39390
diff changeset
2032 # finding some -z option for the Sun compiler.
39374
465a078d2ca6 Fix #1530448 - fix ctypes build failure on solaris 10.
Thomas Heller <theller@ctypes.org>
parents: 38967
diff changeset
2033 extra_link_args.append('-mimpure-text')
465a078d2ca6 Fix #1530448 - fix ctypes build failure on solaris 10.
Thomas Heller <theller@ctypes.org>
parents: 38967
diff changeset
2034
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
2035 elif host_platform.startswith('hp-ux'):
47200
22d2fb761ac1 On HPUX, -fPIC must be used for linking. _ctypes now builds on HP-UX
Thomas Heller <theller@ctypes.org>
parents: 46805
diff changeset
2036 extra_link_args.append('-fPIC')
22d2fb761ac1 On HPUX, -fPIC must be used for linking. _ctypes now builds on HP-UX
Thomas Heller <theller@ctypes.org>
parents: 46805
diff changeset
2037
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2038 ext = Extension('_ctypes',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2039 include_dirs=include_dirs,
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2040 extra_compile_args=extra_compile_args,
39374
465a078d2ca6 Fix #1530448 - fix ctypes build failure on solaris 10.
Thomas Heller <theller@ctypes.org>
parents: 38967
diff changeset
2041 extra_link_args=extra_link_args,
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2042 libraries=[],
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2043 sources=sources,
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2044 depends=depends)
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2045 ext_test = Extension('_ctypes_test',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2046 sources=['_ctypes/_ctypes_test.c'])
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2047 self.extensions.extend([ext, ext_test])
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
2048
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2049 if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2050 return
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2051
81859
8ee6d96a1019 - Issue #17086: Backport the patches from the 3.3 branch to cross-build
doko@python.org
parents: 81768
diff changeset
2052 if host_platform == 'darwin':
45655
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
2053 # OS X 10.5 comes with libffi.dylib; the include files are
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
2054 # in /usr/include/ffi
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
2055 inc_dirs.append('/usr/include/ffi')
d387b01dbc1c Merged changes from libffi3-branch.
Thomas Heller <theller@ctypes.org>
parents: 45439
diff changeset
2056
58064
f02881332342 use pkg-config to find the libffi headers when --with-system-ffi is used #6943
Benjamin Peterson <benjamin@python.org>
parents: 58040
diff changeset
2057 ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
60819
9ba03783ece3 setup.py: search ffi.h in include dirs, if LIBFFI_INCLUDEDIR is empty.
Matthias Klose <doko@ubuntu.com>
parents: 59902
diff changeset
2058 if not ffi_inc or ffi_inc[0] == '':
58064
f02881332342 use pkg-config to find the libffi headers when --with-system-ffi is used #6943
Benjamin Peterson <benjamin@python.org>
parents: 58040
diff changeset
2059 ffi_inc = find_file('ffi.h', [], inc_dirs)
37605
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2060 if ffi_inc is not None:
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2061 ffi_h = ffi_inc[0] + '/ffi.h'
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2062 fp = open(ffi_h)
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2063 while 1:
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2064 line = fp.readline()
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2065 if not line:
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2066 ffi_inc = None
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2067 break
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2068 if line.startswith('#define LIBFFI_H'):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2069 break
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2070 ffi_lib = None
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2071 if ffi_inc is not None:
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2072 for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2073 if (self.compiler.find_library_file(lib_dirs, lib_name)):
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2074 ffi_lib = lib_name
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2075 break
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2076
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2077 if ffi_inc and ffi_lib:
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2078 ext.include_dirs.extend(ffi_inc)
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2079 ext.libraries.append(ffi_lib)
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2080 self.use_system_libffi = True
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2081
e070c316eb45 Patch #1464444: Add --with-system-ffi.
Martin v. Löwis <martin@v.loewis.de>
parents: 37553
diff changeset
2082
17886
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
2083 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
2084 # 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
2085 # 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
2086 # installation:
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
2087 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
2088 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
2089 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
2090
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2091 class PyBuildInstallLib(install_lib):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2092 # 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
2093 # 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
2094 # 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
2095 # 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
2096
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2097 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
2098
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2099 def install(self):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2100 outfiles = install_lib.install(self)
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2101 self.set_file_modes(outfiles, 0644, 0755)
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2102 self.set_dir_modes(self.install_dir, 0755)
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2103 return outfiles
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2104
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2105 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
2106 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
2107 if not files: return
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2108
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2109 for filename in files:
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2110 if os.path.islink(filename): continue
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2111 mode = defaultMode
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2112 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
2113 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
2114 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
2115
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2116 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
2117 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
2118 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
2119
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2120 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
2121 if os.path.islink(dirname): return
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2122 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
2123 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
2124
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2125 def is_chmod_supported(self):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2126 return hasattr(os, 'chmod')
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2127
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2128 SUMMARY = """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2129 Python is an interpreted, interactive, object-oriented programming
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2130 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
2131
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2132 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
2133 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
2134 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
2135 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
2136 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
2137 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
2138 programmable interface.
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2139
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2140 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
2141 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
2142 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
2143 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
2144 yourself.
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2145 """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2146
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2147 CLASSIFIERS = """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2148 Development Status :: 6 - Mature
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2149 License :: OSI Approved :: Python Software Foundation License
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2150 Natural Language :: English
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2151 Programming Language :: C
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2152 Programming Language :: Python
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2153 Topic :: Software Development
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2154 """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2155
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2156 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
2157 # 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
2158 import warnings
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
2159 warnings.filterwarnings("ignore",category=DeprecationWarning)
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2160 setup(# PyPI Metadata (PEP 301)
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2161 name = "Python",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2162 version = sys.version.split()[0],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2163 url = "http://www.python.org/%s" % sys.version[:3],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2164 maintainer = "Guido van Rossum and the Python community",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2165 maintainer_email = "python-dev@python.org",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2166 description = "A high-level object-oriented programming language",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2167 long_description = SUMMARY.strip(),
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2168 license = "PSF license",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2169 classifiers = filter(None, CLASSIFIERS.split("\n")),
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2170 platforms = ["Many"],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2171
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2172 # Build info
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2173 cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall,
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2174 'install_lib':PyBuildInstallLib},
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2175 # The struct module is defined here, because build_ext won't be
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2176 # called unless there's at least one extension module defined.
38262
6b79fffbbe1f patch #1493701: performance enhancements for struct module
Bob Ippolito <bob@redivi.com>
parents: 38261
diff changeset
2177 ext_modules=[Extension('_struct', ['_struct.c'])],
16844
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
2178
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
2179 # Scripts to install
32416
950cf69c69b6 Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents: 32400
diff changeset
2180 scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
46052
2d0e08917a2e Install 2to3 script.
Martin v. Löwis <martin@v.loewis.de>
parents: 46038
diff changeset
2181 'Tools/scripts/2to3',
32416
950cf69c69b6 Install Barry's smtpd.py daemon.
Skip Montanaro <skip@pobox.com>
parents: 32400
diff changeset
2182 'Lib/smtpd.py']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2183 )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
2184
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2185 # --install-platlib
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2186 if __name__ == '__main__':
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2187 main()