annotate setup.py @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents 9d07b3eb34e3
children
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
84157
4a1161eaed99 Issue # 17177: Stop using imp in setup.py
Brett Cannon <brett@python.org>
parents: 82992
diff changeset
4 import sys, os, importlib.machinery, re, optparse
44999
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
5 from glob import glob
58558
5aa90248a99f Merged revisions 77704,77752 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58295
diff changeset
6 import sysconfig
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
7
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
8 from distutils import log
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
9 from distutils import text_file
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
10 from distutils.errors import *
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
11 from distutils.core import Extension, setup
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
12 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
13 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
14 from distutils.command.install_lib import install_lib
67169
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
15 from distutils.command.build_scripts import build_scripts
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
16 from distutils.spawn import find_executable
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
17
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
18 cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
19
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
20 def get_platform():
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
21 # cross build
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
22 if "_PYTHON_HOST_PLATFORM" in os.environ:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
23 return os.environ["_PYTHON_HOST_PLATFORM"]
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
24 # Get value of sys.platform
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
25 if sys.platform.startswith('osf1'):
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
26 return 'osf1'
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
27 return sys.platform
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
28 host_platform = get_platform()
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
29
58108
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
30 # Were we compiled --with-pydebug or with #define Py_DEBUG?
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
31 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
58108
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
32
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
33 # 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
34 disabled_module_list = []
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
35
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
36 def add_dir_to_list(dirlist, dir):
66432
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
37 """Add the directory 'dir' to the list 'dirlist' (after any relative
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
38 directories) if:
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
39
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
40 1) 'dir' is not already in 'dirlist'
66432
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
41 2) 'dir' actually exists, and is a directory.
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
42 """
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
43 if dir is None or not os.path.isdir(dir) or dir in dirlist:
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
44 return
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
45 for i, path in enumerate(dirlist):
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
46 if not os.path.isabs(path):
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
47 dirlist.insert(i + 1, dir)
66516
8737fb17f444 Roumen Petrov's fix for when all paths are absolute. (Issue 10520)
Barry Warsaw <barry@python.org>
parents: 66432
diff changeset
48 return
8737fb17f444 Roumen Petrov's fix for when all paths are absolute. (Issue 10520)
Barry Warsaw <barry@python.org>
parents: 66432
diff changeset
49 dirlist.insert(0, dir)
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
50
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
51 def macosx_sdk_root():
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
52 """
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
53 Return the directory of the current OSX SDK,
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
54 or '/' if no SDK was specified.
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
55 """
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
56 cflags = sysconfig.get_config_var('CFLAGS')
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
57 m = re.search(r'-isysroot\s+(\S+)', cflags)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
58 if m is None:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
59 sysroot = '/'
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
60 else:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
61 sysroot = m.group(1)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
62 return sysroot
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
63
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
64 def is_macosx_sdk_path(path):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
65 """
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
66 Returns True if 'path' can be located in an OSX SDK
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
67 """
78331
eb0af7f6ea6d Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77481
diff changeset
68 return ( (path.startswith('/usr/') and not path.startswith('/usr/local'))
eb0af7f6ea6d Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77481
diff changeset
69 or path.startswith('/System/')
eb0af7f6ea6d Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
Ned Deily <nad@acm.org>
parents: 77481
diff changeset
70 or path.startswith('/Library/') )
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
71
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
72 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
73 """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
74 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
75 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
76
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
77 '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
78 '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
79 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
80 '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
81 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
82 """
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
83 if host_platform == 'darwin':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
84 # Honor the MacOSX SDK setting when one was specified.
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
85 # An SDK is a directory with the same structure as a real
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
86 # system, but with only header files and libraries.
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
87 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
88
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
89 # 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
90 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
91 f = os.path.join(dir, filename)
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
92
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
93 if host_platform == 'darwin' and is_macosx_sdk_path(dir):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
94 f = os.path.join(sysroot, dir[1:], filename)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
95
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
96 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
97
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
98 # 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
99 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
100 f = os.path.join(dir, filename)
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
101
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
102 if host_platform == 'darwin' and is_macosx_sdk_path(dir):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
103 f = os.path.join(sysroot, dir[1:], filename)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
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 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
106 return [dir]
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
107
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
108 # Not found anywhere
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
109 return None
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
110
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
111 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
112 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
113 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
114 return None
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
115
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
116 if host_platform == 'darwin':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
117 sysroot = macosx_sdk_root()
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
118
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
119 # 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
120 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
121 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
122 # 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
123 p = p.rstrip(os.sep)
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
124
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
125 if host_platform == 'darwin' and is_macosx_sdk_path(p):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
126 if os.path.join(sysroot, p[1:]) == dirname:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
127 return [ ]
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
128
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
129 if p == dirname:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
130 return [ ]
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
131
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
132 # 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
133 # 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
134 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
135 # 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
136 p = p.rstrip(os.sep)
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
137
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
138 if host_platform == 'darwin' and is_macosx_sdk_path(p):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
139 if os.path.join(sysroot, p[1:]) == dirname:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
140 return [ p ]
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
141
26443
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
142 if p == dirname:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
143 return [p]
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
144 else:
c1258b1a36c6 [Patch #641685] setup.py contained code for finding libraries, instead
Andrew M. Kuchling <amk@amk.ca>
parents: 26396
diff changeset
145 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
146
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
147 def module_enabled(extlist, modname):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
148 """Returns whether the module 'modname' is present in the list
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
149 of extensions 'extlist'."""
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
150 extlist = [ext for ext in extlist if ext.name == modname]
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
151 return len(extlist)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
152
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
153 def find_module_file(module, dirlist):
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
154 """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
155 return the unadorned filename"""
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
156 list = find_file(module, [], dirlist)
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
157 if not list:
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
158 return module
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
159 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
160 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
161 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
162
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
163 class PyBuildExt(build_ext):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
164
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
165 def __init__(self, dist):
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
166 build_ext.__init__(self, dist)
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
167 self.failed = []
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
168
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
169 def build_extensions(self):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
170
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
171 # Detect which modules should be compiled
82869
8f91014c8f00 - Issue #16754: Fix the incorrect shared library extension on linux. Introduce
doko@ubuntu.com
parents: 82344
diff changeset
172 missing = self.detect_modules()
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
173
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
174 # Remove modules that are present on the disabled list
44742
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
175 extensions = [ext for ext in self.extensions
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
176 if ext.name not in disabled_module_list]
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
177 # move ctypes to the end, it depends on other modules
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
178 ext_map = dict((ext.name, i) for i, ext in enumerate(extensions))
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
179 if "_ctypes" in ext_map:
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
180 ctypes = extensions.pop(ext_map["_ctypes"])
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
181 extensions.append(ctypes)
14d4104976fc Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44160
diff changeset
182 self.extensions = extensions
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
183
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
184 # Fix up the autodetected modules, prefixing all the source files
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
185 # with Modules/.
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
186 srcdir = sysconfig.get_config_var('srcdir')
25790
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
187 if not srcdir:
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
188 # Maybe running on Windows but not using CYGWIN?
83828583d917 [SF bug 620364]
Guido van Rossum <guido@python.org>
parents: 25415
diff changeset
189 raise ValueError("No source directory; cannot proceed.")
51359
e6a14688580e Distutils apparently requires an absolute path so provide one.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 51349
diff changeset
190 srcdir = os.path.abspath(srcdir)
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
191 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
192
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
193 # 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
194 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
195 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
196
44999
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
197 # Python header files
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
198 headers = [sysconfig.get_config_h_filename()]
75348
1c77eadba9dc Issue #14152: Restore the Include/*.h dependencies for extension builds.
Stefan Krah <skrah@bytereef.org>
parents: 69186
diff changeset
199 headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
44999
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
200
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
201 for ext in self.extensions[:]:
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
202 ext.sources = [ find_module_file(filename, moddirlist)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
203 for filename in ext.sources ]
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
204 if ext.depends is not None:
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
205 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
206 for filename in ext.depends]
44999
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
207 else:
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
208 ext.depends = []
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
209 # re-compile extensions if a header file has been changed
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
210 ext.depends.extend(headers)
7c02182e2979 Merged revisions 60284-60349 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44742
diff changeset
211
16038
b6863ba88989 GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents: 16013
diff changeset
212 # 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
213 # 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
214 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
215 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
216
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
217 # Parse Modules/Setup and Modules/Setup.local to figure out which
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
218 # modules are turned on in the file.
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
219 remove_modules = []
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
220 for filename in ('Modules/Setup', 'Modules/Setup.local'):
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
221 input = text_file.TextFile(filename, join_lines=1)
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
222 while 1:
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
223 line = input.readline()
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
224 if not line: break
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
225 line = line.split()
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
226 remove_modules.append(line[0])
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
227 input.close()
36162
1e595b6c924e Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 36156
diff changeset
228
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
229 for ext in self.extensions[:]:
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
230 if ext.name in remove_modules:
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
231 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
232
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
233 # 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
234 # 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
235 # 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
236 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
237 args = {}
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
238 # 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
239 # compilers
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
240 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
241 (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
242 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
243 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
244
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
245 build_ext.build_extensions(self)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
246
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
247 longest = max([len(e.name) for e in self.extensions])
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
248 if self.failed:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
249 longest = max(longest, max([len(name) for name in self.failed]))
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
250
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
251 def print_three_column(lst):
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
252 lst.sort(key=str.lower)
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
253 # guarantee zip() doesn't drop anything
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
254 while len(lst) % 3:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
255 lst.append("")
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
256 for e, f, g in zip(lst[::3], lst[1::3], lst[2::3]):
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
257 print("%-*s %-*s %-*s" % (longest, e, longest, f,
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
258 longest, g))
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
259
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
260 if missing:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
261 print()
84584
e13ff9fdfaf9 Issue #17845: Clarify the message setup.py prints upon successfully
Brett Cannon <brett@python.org>
parents: 84157
diff changeset
262 print("Python build finished successfully!")
e13ff9fdfaf9 Issue #17845: Clarify the message setup.py prints upon successfully
Brett Cannon <brett@python.org>
parents: 84157
diff changeset
263 print("The necessary bits to build these optional modules were not "
e13ff9fdfaf9 Issue #17845: Clarify the message setup.py prints upon successfully
Brett Cannon <brett@python.org>
parents: 84157
diff changeset
264 "found:")
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
265 print_three_column(missing)
42775
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
266 print("To find the necessary bits, look in setup.py in"
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
267 " detect_modules() for the module's name.")
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
268 print()
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
269
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
270 if self.failed:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
271 failed = self.failed[:]
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
272 print()
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
273 print("Failed to build these modules:")
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
274 print_three_column(failed)
42775
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
275 print()
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
276
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
277 def build_extension(self, ext):
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
278
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
279 if ext.name == '_ctypes':
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
280 if not self.configure_ctypes(ext):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
281 return
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
282
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
283 try:
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
284 build_ext.build_extension(self, ext)
40587
6b18a095c2e7 SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents: 40582
diff changeset
285 except (CCompilerError, DistutilsError) as why:
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
286 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
287 (ext.name, sys.exc_info()[1]))
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
288 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
289 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
290 # 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
291 # 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
292 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
293 self.announce(
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
294 '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
295 ext.name)
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
296 return
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
297
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
298 if host_platform == 'darwin' and (
48490
8e9e65383afb sys.maxint -> sys.maxsize
Benjamin Peterson <benjamin@python.org>
parents: 48485
diff changeset
299 sys.maxsize > 2**32 and '-arch' in ext.extra_link_args):
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
300 # Don't bother doing an import check when an extension was
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
301 # build with an explicit '-arch' flag on OSX. That's currently
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
302 # only used to build 32-bit only extensions in a 4-way
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
303 # universal build and loading 32-bit code into a 64-bit
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
304 # process will fail.
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
305 self.announce(
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
306 'WARNING: skipping import check for "%s"' %
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
307 ext.name)
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
308 return
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
309
23513
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
310 # 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
311 # modules have been imported
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
312 if host_platform == 'cygwin':
23513
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
313 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
314 % ext.name)
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
315 return
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
316 ext_filename = os.path.join(
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
317 self.build_lib,
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
318 self.get_ext_filename(self.get_ext_fullname(ext.name)))
48514
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
319
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
320 # If the build directory didn't exist when setup.py was
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
321 # started, sys.path_importer_cache has a negative result
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
322 # cached. Clear that cache before trying to import.
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
323 sys.path_importer_cache.clear()
79f84bc2b149 Fix bug 3375 - _multiprocessing.so build problems on OS X.
Guido van Rossum <guido@python.org>
parents: 48490
diff changeset
324
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
325 # Don't try to load extensions for cross builds
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
326 if cross_compiling:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
327 return
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
328
84157
4a1161eaed99 Issue # 17177: Stop using imp in setup.py
Brett Cannon <brett@python.org>
parents: 82992
diff changeset
329 loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename)
17890
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
330 try:
84157
4a1161eaed99 Issue # 17177: Stop using imp in setup.py
Brett Cannon <brett@python.org>
parents: 82992
diff changeset
331 loader.load_module()
40587
6b18a095c2e7 SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents: 40582
diff changeset
332 except ImportError as why:
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
333 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
334 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
335 ' 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
336 assert not self.inplace
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
337 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
338 newname = basename + "_failed" + tail
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
339 if os.path.exists(newname):
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
340 os.remove(newname)
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
341 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
342
28111
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
343 # 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
344 # 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
345 # _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
346 # use here.
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
347 # 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
348 # 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
349 try:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
350 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
351 os.remove(filename)
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
352 except AttributeError:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
353 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
354 except:
7a2f683395e7 Just pointed out the code was better written with
Neal Norwitz <nnorwitz@gmail.com>
parents: 28109
diff changeset
355 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
356 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
357 '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
358 level=3)
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
359 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
360
69174
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
361 def add_multiarch_paths(self):
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
362 # Debian/Ubuntu multiarch support.
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
363 # https://wiki.ubuntu.com/MultiarchSpec
79081
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
364 cc = sysconfig.get_config_var('CC')
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
365 tmpfile = os.path.join(self.build_temp, 'multiarch')
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
366 if not os.path.exists(self.build_temp):
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
367 os.makedirs(self.build_temp)
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
368 ret = os.system(
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
369 '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
370 multiarch_path_component = ''
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
371 try:
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
372 if ret >> 8 == 0:
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
373 with open(tmpfile) as fp:
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
374 multiarch_path_component = fp.readline().strip()
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
375 finally:
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
376 os.unlink(tmpfile)
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
377
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
378 if multiarch_path_component != '':
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
379 add_dir_to_list(self.compiler.library_dirs,
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
380 '/usr/lib/' + multiarch_path_component)
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
381 add_dir_to_list(self.compiler.include_dirs,
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
382 '/usr/include/' + multiarch_path_component)
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
383 return
78aba41a8105 - Issue #11715: Fix multiarch detection without having Debian development
doko@ubuntu.com
parents: 78861
diff changeset
384
69185
c8738114b962 Refinement by Stefan Krah (see issue 11715, msg133194) to exit early if the
Barry Warsaw <barry@python.org>
parents: 69174
diff changeset
385 if not find_executable('dpkg-architecture'):
c8738114b962 Refinement by Stefan Krah (see issue 11715, msg133194) to exit early if the
Barry Warsaw <barry@python.org>
parents: 69174
diff changeset
386 return
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
387 opt = ''
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
388 if cross_compiling:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
389 opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')
69174
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
390 tmpfile = os.path.join(self.build_temp, 'multiarch')
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
391 if not os.path.exists(self.build_temp):
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
392 os.makedirs(self.build_temp)
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
393 ret = os.system(
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
394 'dpkg-architecture %s -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
395 (opt, tmpfile))
69174
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
396 try:
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
397 if ret >> 8 == 0:
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
398 with open(tmpfile) as fp:
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
399 multiarch_path_component = fp.readline().strip()
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
400 add_dir_to_list(self.compiler.library_dirs,
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
401 '/usr/lib/' + multiarch_path_component)
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
402 add_dir_to_list(self.compiler.include_dirs,
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
403 '/usr/include/' + multiarch_path_component)
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
404 finally:
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
405 os.unlink(tmpfile)
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
406
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
407 def add_gcc_paths(self):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
408 gcc = sysconfig.get_config_var('CC')
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
409 tmpfile = os.path.join(self.build_temp, 'gccpaths')
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
410 if not os.path.exists(self.build_temp):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
411 os.makedirs(self.build_temp)
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
412 ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
413 is_gcc = False
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
414 in_incdirs = False
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
415 inc_dirs = []
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
416 lib_dirs = []
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
417 try:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
418 if ret >> 8 == 0:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
419 with open(tmpfile) as fp:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
420 for line in fp.readlines():
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
421 if line.startswith("gcc version"):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
422 is_gcc = True
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
423 elif line.startswith("#include <...>"):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
424 in_incdirs = True
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
425 elif line.startswith("End of search list"):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
426 in_incdirs = False
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
427 elif is_gcc and line.startswith("LIBRARY_PATH"):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
428 for d in line.strip().split("=")[1].split(":"):
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
429 d = os.path.normpath(d)
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
430 if '/gcc/' not in d:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
431 add_dir_to_list(self.compiler.library_dirs,
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
432 d)
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
433 elif is_gcc and in_incdirs and '/gcc/' not in line:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
434 add_dir_to_list(self.compiler.include_dirs,
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
435 line.strip())
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
436 finally:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
437 os.unlink(tmpfile)
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
438
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
439 def detect_modules(self):
66432
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
440 # Ensure that /usr/local is always used, but the local build
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
441 # directories (i.e. '.' and 'Include') must be first. See issue
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
442 # 10520.
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
443 if not cross_compiling:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
444 add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
445 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
77895
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
446 # only change this for cross builds for 3.3, issues on Mageia
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
447 if cross_compiling:
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
448 self.add_gcc_paths()
69174
7582a78f573b Issue 11715: Build extension modules on multiarch Debian and Ubuntu by
Barry Warsaw <barry@python.org>
parents: 68585
diff changeset
449 self.add_multiarch_paths()
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
450
34124
4e38ecd1912e setup.py now uses the library directories specified in LDFLAGS (``-L``
Brett Cannon <bcannon@gmail.com>
parents: 33986
diff changeset
451 # 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
452 # 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
453 # 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
454 # 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
455 # 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
456 # 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
457 for env_var, arg_name, dir_list in (
49458
d2140de76479 merge from trunk
Skip Montanaro <skip@pobox.com>
parents: 49446
diff changeset
458 ('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
459 ('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
460 ('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
461 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
462 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
463 # To prevent optparse from raising an exception about any
49458
d2140de76479 merge from trunk
Skip Montanaro <skip@pobox.com>
parents: 49446
diff changeset
464 # 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
465 # 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
466 # 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
467 #
5dc274e15822 Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents: 34186
diff changeset
468 # 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
469 # 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
470 # 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
471 # used for a library directory.
42775
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
472 env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1],
d7517c306791 Merged revisions 57221-57391 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42653
diff changeset
473 ' ', 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
474 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
475 # 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
476 # allowed
5dc274e15822 Strip out double dashes and dashes for options not used during parsing of
Brett Cannon <bcannon@gmail.com>
parents: 34186
diff changeset
477 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
478 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
479 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
480 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
481 if options.dirs:
45134
bdcf40d1b38e Merged revisions 60481,60485,60489-60520,60523-60527,60530-60533,60535-60538,60540-60551 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45044
diff changeset
482 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
483 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
484
77154
294f8aeb4d4b Implemented PEP 405 (Python virtual environments).
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 76999
diff changeset
485 if os.path.normpath(sys.base_prefix) != '/usr' \
65559
5cf1e6e61c6c Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65191
diff changeset
486 and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
5cf1e6e61c6c Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65191
diff changeset
487 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
5cf1e6e61c6c Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65191
diff changeset
488 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
5cf1e6e61c6c Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65191
diff changeset
489 # building a framework with different architectures than
5cf1e6e61c6c Merged revisions 85744 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65191
diff changeset
490 # the one that is currently installed (issue #7473)
24477
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
491 add_dir_to_list(self.compiler.library_dirs,
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
492 sysconfig.get_config_var("LIBDIR"))
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
493 add_dir_to_list(self.compiler.include_dirs,
b38754f1cb61 Fix for
Michael W. Hudson <mwh@python.net>
parents: 24143
diff changeset
494 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
495
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
496 # 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
497 # 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
498 # be assumed that no additional -I,-L directives are needed.
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
499 if not cross_compiling:
77895
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
500 lib_dirs = self.compiler.library_dirs + [
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
501 '/lib64', '/usr/lib64',
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
502 '/lib', '/usr/lib',
77895
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
503 ]
7955d769fdf5 - Issue #14330: Don't derive the include and library search dirs
doko@ubuntu.com
parents: 77893
diff changeset
504 inc_dirs = self.compiler.include_dirs + ['/usr/include']
80828
9f1f27c5e5b2 Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are
Christian Heimes <christian@cheimes.de>
parents: 79744
diff changeset
505 else:
80830
9e63d99bff64 Just to be sure, initialize with a copy of the compiler's lib and inc dirs.
Christian Heimes <christian@cheimes.de>
parents: 80828
diff changeset
506 lib_dirs = self.compiler.library_dirs[:]
9e63d99bff64 Just to be sure, initialize with a copy of the compiler's lib and inc dirs.
Christian Heimes <christian@cheimes.de>
parents: 80828
diff changeset
507 inc_dirs = self.compiler.include_dirs[:]
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
508 exts = []
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
509 missing = []
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
510
34911
87719ae9288c Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents: 34717
diff changeset
511 config_h = sysconfig.get_config_h_filename()
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
512 with open(config_h) as file:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
513 config_h_vars = sysconfig.parse_config_h(file)
34911
87719ae9288c Fix building of spwd; was incorrectly checking for the needed HAVE_* values to
Brett Cannon <bcannon@gmail.com>
parents: 34717
diff changeset
514
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
515 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
516
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
517 # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
518 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
519 lib_dirs += ['/usr/ccs/lib']
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
520
76263
807f331f973d Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75348
diff changeset
521 # HP-UX11iv3 keeps files in lib/hpux folders.
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
522 if host_platform == 'hp-ux11':
76263
807f331f973d Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75348
diff changeset
523 lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
807f331f973d Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
Charles-François Natali <neologix@free.fr>
parents: 75348
diff changeset
524
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
525 if host_platform == 'darwin':
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
526 # This should work on any unixy platform ;-)
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
527 # If the user has bothered specifying additional -I and -L flags
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
528 # in OPT and LDFLAGS we might as well use them here.
66432
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
529 #
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
530 # NOTE: using shlex.split would technically be more correct, but
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
531 # also gives a bootstrap problem. Let's hope nobody uses
395ac6e319a8 Put /usr/local paths after the relative paths in library_dirs and
Barry Warsaw <barry@python.org>
parents: 65827
diff changeset
532 # directories with whitespace in the name to store libraries.
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
533 cflags, ldflags = sysconfig.get_config_vars(
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
534 'CFLAGS', 'LDFLAGS')
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
535 for item in cflags.split():
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
536 if item.startswith('-I'):
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
537 inc_dirs.append(item[2:])
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
538
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
539 for item in ldflags.split():
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
540 if item.startswith('-L'):
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
541 lib_dirs.append(item[2:])
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
542
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
543 # 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
544 math_libs = ['m']
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
545 if host_platform == 'darwin':
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
546 math_libs = []
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
547
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
548 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
549
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
550 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
551 # The following modules are all pretty straightforward, and compile
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
552 # on pretty much any POSIXish platform.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
553 #
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
554
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
555 # array objects
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
556 exts.append( Extension('array', ['arraymodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
557 # complex math library functions
57866
9751ddcc1882 Merged revisions 76978 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 57762
diff changeset
558 exts.append( Extension('cmath', ['cmathmodule.c', '_math.c'],
9751ddcc1882 Merged revisions 76978 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 57762
diff changeset
559 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
560 libraries=math_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
561 # math library functions, e.g. sin()
57758
b45ca11b9a3e Merged revisions 76861 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 57490
diff changeset
562 exts.append( Extension('math', ['mathmodule.c', '_math.c'],
57762
b1896620c296 Merged revisions 76865 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 57758
diff changeset
563 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
564 libraries=math_libs) )
73126
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
565
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
566 # time libraries: librt may be needed for clock_gettime()
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
567 time_libs = []
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
568 lib = sysconfig.get_config_var('TIMEMODULE_LIB')
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
569 if lib:
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
570 time_libs.append(lib)
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
571
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
572 # time operations and variables
75590
1e9cc1a03365 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
Victor Stinner <vstinner@wyplay.com>
parents: 75349
diff changeset
573 exts.append( Extension('time', ['timemodule.c'],
73126
35e4b7c4bafa Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73000
diff changeset
574 libraries=time_libs) )
75590
1e9cc1a03365 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
Victor Stinner <vstinner@wyplay.com>
parents: 75349
diff changeset
575 exts.append( Extension('_datetime', ['_datetimemodule.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
576 # random number generator implemented in C
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
577 exts.append( Extension("_random", ["_randommodule.c"]) )
31353
ed20259a1ea5 SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents: 31090
diff changeset
578 # bisect
ed20259a1ea5 SF Patch #864863: Bisect C implementation
Raymond Hettinger <python@rcn.com>
parents: 31090
diff changeset
579 exts.append( Extension("_bisect", ["_bisectmodule.c"]) )
30875
2acd28bd4d0f Convert heapq.py to a C implementation.
Raymond Hettinger <python@rcn.com>
parents: 30770
diff changeset
580 # heapq
31931
63b68cb2b442 * Restore the pure python version of heapq.py.
Raymond Hettinger <python@rcn.com>
parents: 31742
diff changeset
581 exts.append( Extension("_heapq", ["_heapqmodule.c"]) )
47645
0ae50aa7d97c Restore _pickle module accelerator module.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 47634
diff changeset
582 # C-optimized pickle replacement
0ae50aa7d97c Restore _pickle module accelerator module.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 47634
diff changeset
583 exts.append( Extension("_pickle", ["_pickle.c"]) )
41253
f29f1a8b7869 Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
Collin Winter <collinw@gmail.com>
parents: 41064
diff changeset
584 # atexit
f29f1a8b7869 Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
Collin Winter <collinw@gmail.com>
parents: 41064
diff changeset
585 exts.append( Extension("atexit", ["atexitmodule.c"]) )
46737
9f45979558a9 Merged revisions 62734,62736,62748,62769 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46694
diff changeset
586 # _json speedups
9f45979558a9 Merged revisions 62734,62736,62748,62769 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46694
diff changeset
587 exts.append( Extension("_json", ["_json.c"]) )
16416
7d39d9dcf2d6 Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents: 16415
diff changeset
588 # Python C API test module
51520
94d9d525401c Merged revisions 69500 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 51359
diff changeset
589 exts.append( Extension('_testcapi', ['_testcapimodule.c'],
94d9d525401c Merged revisions 69500 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 51359
diff changeset
590 depends=['testcapi_long.h']) )
75254
3f9b3b6f7ff0 - Issue #10181: New memoryview implementation fixes multiple ownership
Stefan Krah <skrah@bytereef.org>
parents: 73794
diff changeset
591 # Python PEP-3118 (buffer protocol) test module
3f9b3b6f7ff0 - Issue #10181: New memoryview implementation fixes multiple ownership
Stefan Krah <skrah@bytereef.org>
parents: 73794
diff changeset
592 exts.append( Extension('_testbuffer', ['_testbuffer.c']) )
80842
6eefe4d537b3 Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents: 80831
diff changeset
593 # Test loading multiple modules from one compiled file (http://bugs.python.org/issue16421)
6eefe4d537b3 Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents: 80831
diff changeset
594 exts.append( Extension('_testimportmultiple', ['_testimportmultiple.c']) )
43527
2b746f28b399 remove hotshot profiler from Py3k
Fred Drake <fdrake@acm.org>
parents: 43480
diff changeset
595 # profiler (_lsprof is for cProfile.py)
36459
3abf33264146 Added the cProfile module.
Armin Rigo <arigo@tunes.org>
parents: 36396
diff changeset
596 exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
597 # static Unicode character database
41818
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
598 exts.append( Extension('unicodedata', ['unicodedata.c']) )
87465
5fe72b9ed48e Issue #19722: Added opcode.stack_effect(), which accurately
Larry Hastings <larry@hastings.org>
parents: 86619
diff changeset
599 # _opcode module
5fe72b9ed48e Issue #19722: Added opcode.stack_effect(), which accurately
Larry Hastings <larry@hastings.org>
parents: 86619
diff changeset
600 exts.append( Extension('_opcode', ['_opcode.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
601
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
602 # Modules with some UNIX dependencies -- on by default:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
603 # (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
604 # supported...)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
605
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
606 # fcntl(2) and ioctl(2)
64522
c2199175ada8 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 63905
diff changeset
607 libs = []
c2199175ada8 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 63905
diff changeset
608 if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
c2199175ada8 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 63905
diff changeset
609 # May be necessary on AIX for flock function
c2199175ada8 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 63905
diff changeset
610 libs = ['bsd']
c2199175ada8 Merged revisions 84584 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 63905
diff changeset
611 exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
612 # pwd(3)
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
613 exts.append( Extension('pwd', ['pwdmodule.c']) )
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
614 # grp(3)
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
615 exts.append( Extension('grp', ['grpmodule.c']) )
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
616 # spwd, shadow passwords
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
617 if (config_h_vars.get('HAVE_GETSPNAM', False) or
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
618 config_h_vars.get('HAVE_GETSPENT', False)):
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
619 exts.append( Extension('spwd', ['spwdmodule.c']) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
620 else:
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
621 missing.append('spwd')
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
622
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
623 # select(2); not on ancient System V
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
624 exts.append( Extension('select', ['selectmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
625
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
626 # Fred Drake's interface to the Python parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
627 exts.append( Extension('parser', ['parsermodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
628
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
629 # Memory-mapped files (also works on Win32).
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
630 exts.append( Extension('mmap', ['mmapmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
631
33370
af65004f622f Remove mpz, rotor, xreadlines modules
Andrew M. Kuchling <amk@amk.ca>
parents: 33294
diff changeset
632 # Lance Ellinghaus's syslog module
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
633 # syslog daemon interface
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
634 exts.append( Extension('syslog', ['syslogmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
635
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
636 #
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
637 # 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
638 # libraries, are platform-specific, or present other surprises.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
639 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
640
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
641 # Multimedia modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
642 # These don't work for 64-bit platforms!!!
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
643 # These represent audio samples or images as strings:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
644
32763
8ad5a1620092 Move comment that goes along with audioop
Neal Norwitz <nnorwitz@gmail.com>
parents: 32762
diff changeset
645 # Operations on audio samples
32797
ea54fdb86530 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 32765
diff changeset
646 # 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
647 # 64-bit platforms.
76ad814bc67c Patch #993173: Enable audioop on 64-bit platforms.
Martin v. Löwis <martin@v.loewis.de>
parents: 32735
diff changeset
648 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
649
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
650 # 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
651 do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
652 readline_termcap_library = ""
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
653 curses_library = ""
77879
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
654 # Cannot use os.popen here in py3k.
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
655 tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
656 if not os.path.exists(self.build_temp):
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
657 os.makedirs(self.build_temp)
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
658 # Determine if readline is already linked against curses or tinfo.
77879
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
659 if do_readline:
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
660 if cross_compiling:
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
661 ret = os.system("%s -d %s | grep '(NEEDED)' > %s" \
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
662 % (sysconfig.get_config_var('READELF'),
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
663 do_readline, tmpfile))
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
664 elif find_executable('ldd'):
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
665 ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
666 else:
e6e99d449bdc - Issue #3754: Use readelf instead of ldd for the cross build readline check
doko@ubuntu.com
parents: 77867
diff changeset
667 ret = 256
63052
fa8f38834287 Merged revisions 82927 via svnmerge from
Stefan Krah <stefan@bytereef.org>
parents: 62543
diff changeset
668 if ret >> 8 == 0:
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
669 with open(tmpfile) as fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
670 for ln in fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
671 if 'curses' in ln:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
672 readline_termcap_library = re.sub(
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
673 r'.*lib(n?cursesw?)\.so.*', r'\1', ln
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
674 ).rstrip()
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
675 break
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
676 # termcap interface split out from ncurses
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
677 if 'tinfo' in ln:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
678 readline_termcap_library = 'tinfo'
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
679 break
77893
900cf4e7a62f - fix the OS X build failure, only try to remove the temporary file if it exists
doko@ubuntu.com
parents: 77892
diff changeset
680 if os.path.exists(tmpfile):
900cf4e7a62f - fix the OS X build failure, only try to remove the temporary file if it exists
doko@ubuntu.com
parents: 77892
diff changeset
681 os.unlink(tmpfile)
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
682 # Issue 7384: If readline is already linked against curses,
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
683 # use the same library for the readline and curses modules.
62178
a360e114866b Issue #7384: If the system readline library is linked against ncurses,
Stefan Krah <stefan@bytereef.org>
parents: 62050
diff changeset
684 if 'curses' in readline_termcap_library:
a360e114866b Issue #7384: If the system readline library is linked against ncurses,
Stefan Krah <stefan@bytereef.org>
parents: 62050
diff changeset
685 curses_library = readline_termcap_library
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
686 elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
687 curses_library = 'ncursesw'
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
688 elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
689 curses_library = 'ncurses'
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
690 elif self.compiler.find_library_file(lib_dirs, 'curses'):
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
691 curses_library = 'curses'
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
692
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
693 if host_platform == 'darwin':
56135
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
694 os_release = int(os.uname()[2].split('.')[0])
59460
445f801ca2d0 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59372
diff changeset
695 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
445f801ca2d0 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59372
diff changeset
696 if dep_target and dep_target.split('.') < ['10', '5']:
445f801ca2d0 Merged revisions 78784 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59372
diff changeset
697 os_release = 8
56135
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
698 if os_release < 9:
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
699 # MacOSX 10.4 has a broken readline. Don't try to build
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
700 # the readline module unless the user has installed a fixed
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
701 # readline package
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
702 if find_file('readline/rlconf.h', inc_dirs, []) is None:
1c50dc213312 Merged revisions 74970 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55970
diff changeset
703 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
704 if do_readline:
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
705 if host_platform == 'darwin' and os_release < 9:
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
706 # In every directory on the search path search for a dynamic
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
707 # library and then a static library, instead of first looking
43239
c6b1123e0e6c fix typo
Fred Drake <fdrake@acm.org>
parents: 43212
diff changeset
708 # for dynamic libraries on the entire path.
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
709 # This way a staticly linked custom readline gets picked up
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
710 # before the (possibly broken) dynamic library in /usr/lib.
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
711 readline_extra_link_args = ('-Wl,-search_paths_first',)
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
712 else:
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
713 readline_extra_link_args = ()
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
714
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
715 readline_libs = ['readline']
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
716 if readline_termcap_library:
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
717 pass # Issue 7384: Already linked against curses or tinfo.
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
718 elif curses_library:
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
719 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
720 elif self.compiler.find_library_file(lib_dirs +
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
721 ['/usr/lib/termcap'],
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
722 '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
723 readline_libs.append('termcap')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
724 exts.append( Extension('readline', ['readline.c'],
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
725 library_dirs=['/usr/lib/termcap'],
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
726 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
727 libraries=readline_libs) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
728 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
729 missing.append('readline')
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
730
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
731 # crypt module.
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
732
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
733 if self.compiler.find_library_file(lib_dirs, 'crypt'):
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
734 libs = ['crypt']
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
735 else:
61259
1f7506f23771 Remove traces of MacOS9 support.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60822
diff changeset
736 libs = []
68097
372b2ef0ff37 Issue #10924: Adding salt and Modular Crypt Format to crypt library.
Sean Reifscheider <jafo@tummy.com>
parents: 67169
diff changeset
737 exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
738
28341
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
739 # CSV files
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
740 exts.append( Extension('_csv', ['_csv.c']) )
797909492c38 build _csv extension module
Skip Montanaro <skip@pobox.com>
parents: 28208
diff changeset
741
59605
768722b2ae0a * Replaces the internals of the subprocess module from fork through exec on
Gregory P. Smith <greg@mad-scientist.com>
parents: 59460
diff changeset
742 # POSIX subprocess module helper.
768722b2ae0a * Replaces the internals of the subprocess module from fork through exec on
Gregory P. Smith <greg@mad-scientist.com>
parents: 59460
diff changeset
743 exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )
768722b2ae0a * Replaces the internals of the subprocess module from fork through exec on
Gregory P. Smith <greg@mad-scientist.com>
parents: 59460
diff changeset
744
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
745 # socket(2)
23811
e3e019bc4e1e Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents: 23777
diff changeset
746 exts.append( Extension('_socket', ['socketmodule.c'],
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
747 depends = ['socketmodule.h']) )
21959
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
748 # 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
749 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
750 '/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
751 '/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
752 ]
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
753 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
754 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
755 )
29043
8e79dc3731bf Only look for krb5.h if ssl.h was found.
Martin v. Löwis <martin@v.loewis.de>
parents: 29013
diff changeset
756 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
757 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
758 ['/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
759 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
760 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
761 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
762 ['/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
763 '/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
764 ] )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
765
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
766 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
767 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
768 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
769 include_dirs = ssl_incs,
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
770 library_dirs = ssl_libs,
23811
e3e019bc4e1e Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents: 23777
diff changeset
771 libraries = ['ssl', 'crypto'],
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
772 depends = ['socketmodule.h']), )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
773 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
774 missing.append('_ssl')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
775
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
776 # 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
777 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
778 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
779 '^\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
780
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
781 # look for the openssl version header on the compiler search path.
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
782 opensslv_h = find_file('openssl/opensslv.h', [],
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
783 inc_dirs + search_for_ssl_incs_in)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
784 if opensslv_h:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
785 name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
786 if host_platform == 'darwin' and is_macosx_sdk_path(name):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
787 name = os.path.join(macosx_sdk_root(), name[1:])
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
788 try:
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
789 with open(name, 'r') as incfile:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
790 for line in incfile:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
791 m = openssl_ver_re.match(line)
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
792 if m:
82992
02a89bd646ca Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch by Michele Orrù.
Antoine Pitrou <solipsis@pitrou.net>
parents: 82871
diff changeset
793 openssl_ver = int(m.group(1), 16)
02a89bd646ca Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch by Michele Orrù.
Antoine Pitrou <solipsis@pitrou.net>
parents: 82871
diff changeset
794 break
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
795 except IOError as msg:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
796 print("IOError while reading opensshv.h:", msg)
35396
12a9bb24b6d9 Add a check for the OpenSSL version number to conditionally compile
Gregory P. Smith <greg@mad-scientist.com>
parents: 35375
diff changeset
797
42653
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
798 #print('openssl_ver = 0x%08x' % openssl_ver)
58108
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
799 min_openssl_ver = 0x00907000
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
800 have_any_openssl = ssl_incs is not None and ssl_libs is not None
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
801 have_usable_openssl = (have_any_openssl and
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
802 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
803
58108
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
804 if have_any_openssl:
3856c764e1f5 Also fixes test_hashlib for the different extension module names in py3k.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58068
diff changeset
805 if have_usable_openssl:
42653
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
806 # The _hashlib module wraps optimized implementations
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
807 # of hash functions from the OpenSSL library.
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
808 exts.append( Extension('_hashlib', ['_hashopenssl.c'],
58132
06c968eb4b40 add missing hashlib.h deps.
Gregory P. Smith <greg@mad-scientist.com>
parents: 58110
diff changeset
809 depends = ['hashlib.h'],
42653
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
810 include_dirs = ssl_incs,
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
811 library_dirs = ssl_libs,
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
812 libraries = ['ssl', 'crypto']) )
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
813 else:
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
814 print("warning: openssl 0x%08x is too old for _hashlib" %
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
815 openssl_ver)
986776456791 Print warning when openssl is too old; it's pretty essential at this point.
Guido van Rossum <guido@python.org>
parents: 42645
diff changeset
816 missing.append('_hashlib')
35375
624918e1c1b2 [ sf.net patch # 1121611 ]
Gregory P. Smith <greg@mad-scientist.com>
parents: 35238
diff changeset
817
76999
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
818 # We always compile these even when OpenSSL is available (issue #14693).
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
819 # It's harmless and the object code is tiny (40-50 KB per module,
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
820 # only loaded when actually used).
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
821 exts.append( Extension('_sha256', ['sha256module.c'],
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
822 depends=['hashlib.h']) )
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
823 exts.append( Extension('_sha512', ['sha512module.c'],
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
824 depends=['hashlib.h']) )
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
825 exts.append( Extension('_md5', ['md5module.c'],
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
826 depends=['hashlib.h']) )
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
827 exts.append( Extension('_sha1', ['sha1module.c'],
0a1d7be10946 Issue #14693: Under non-Windows platforms, hashlib's fallback modules are always compiled, even if OpenSSL is present at build time.
Antoine Pitrou <solipsis@pitrou.net>
parents: 76405
diff changeset
828 depends=['hashlib.h']) )
43294
78f1c329c983 Adds stand alone _md5 and _sha1 modules for use by hashlib on systems
Gregory P. Smith <greg@mad-scientist.com>
parents: 43266
diff changeset
829
79502
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
830 # SHA-3 (Keccak) module
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
831 sha3_depends = ['hashlib.h']
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
832 keccak = os.path.join(os.getcwd(), srcdir, 'Modules', '_sha3',
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
833 'keccak')
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
834 for pattern in ('*.c', '*.h', '*.macros'):
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
835 sha3_depends.extend(glob(os.path.join(keccak, pattern)))
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
836 exts.append(Extension("_sha3", ["_sha3/sha3module.c"],
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
837 depends=sha3_depends))
11c9a894680e Issue #16113: integrade SHA-3 (Keccak) patch from http://hg.python.org/sandbox/cheimes
Christian Heimes <christian@cheimes.de>
parents: 79479
diff changeset
838
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
839 # Modules that provide persistent dictionary-like semantics. You will
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
840 # 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
841 # your machine, though none are defined by default because of library
47285
afbde360dd1a Create the dbm package from PEP 3108. #2881.
Georg Brandl <georg@python.org>
parents: 47230
diff changeset
842 # dependencies. The Python module dbm/__init__.py provides an
afbde360dd1a Create the dbm package from PEP 3108. #2881.
Georg Brandl <georg@python.org>
parents: 47230
diff changeset
843 # implementation independent wrapper for these; dbm/dumb.py provides
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
844 # similar functionality (but slower of course) implemented in Python.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
845
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
846 # Sleepycat^WOracle Berkeley DB interface.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
847 # http://www.oracle.com/database/berkeley-db/db/index.html
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
848 #
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
849 # This requires the Sleepycat^WOracle DB code. The supported versions
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
850 # are set below. Visit the URL above to download
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
851 # a release. Most open source OSes come with one or more
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
852 # versions of BerkeleyDB already installed.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
853
77911
7be082d80b8a - Issue #15235: Allow Berkley DB versions up to 5.3 to build the dbm module.
doko@ubuntu.com
parents: 77895
diff changeset
854 max_db_ver = (5, 3)
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
855 min_db_ver = (3, 3)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
856 db_setup_debug = False # verbose debug prints from this script?
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
857
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
858 def allow_db_ver(db_ver):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
859 """Returns a boolean if the given BerkeleyDB version is acceptable.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
860
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
861 Args:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
862 db_ver: A tuple of the version to verify.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
863 """
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
864 if not (min_db_ver <= db_ver <= max_db_ver):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
865 return False
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
866 return True
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
867
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
868 def gen_db_minor_ver_nums(major):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
869 if major == 4:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
870 for x in range(max_db_ver[1]+1):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
871 if allow_db_ver((4, x)):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
872 yield x
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
873 elif major == 3:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
874 for x in (3,):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
875 if allow_db_ver((3, x)):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
876 yield x
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
877 else:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
878 raise ValueError("unknown major BerkeleyDB version", major)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
879
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
880 # construct a list of paths to look for the header file in on
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
881 # top of the normal inc_dirs.
49000
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
882 db_inc_paths = [
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
883 '/usr/include/db4',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
884 '/usr/local/include/db4',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
885 '/opt/sfw/include/db4',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
886 '/usr/include/db3',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
887 '/usr/local/include/db3',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
888 '/opt/sfw/include/db3',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
889 # Fink defaults (http://fink.sourceforge.net/)
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
890 '/sw/include/db4',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
891 '/sw/include/db3',
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
892 ]
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
893 # 4.x minor number specific paths
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
894 for x in gen_db_minor_ver_nums(4):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
895 db_inc_paths.append('/usr/include/db4%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
896 db_inc_paths.append('/usr/include/db4.%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
897 db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
898 db_inc_paths.append('/usr/local/include/db4%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
899 db_inc_paths.append('/pkg/db-4.%d/include' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
900 db_inc_paths.append('/opt/db-4.%d/include' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
901 # MacPorts default (http://www.macports.org/)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
902 db_inc_paths.append('/opt/local/include/db4%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
903 # 3.x minor number specific paths
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
904 for x in gen_db_minor_ver_nums(3):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
905 db_inc_paths.append('/usr/include/db3%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
906 db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
907 db_inc_paths.append('/usr/local/include/db3%d' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
908 db_inc_paths.append('/pkg/db-3.%d/include' % x)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
909 db_inc_paths.append('/opt/db-3.%d/include' % x)
49000
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
910
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
911 if cross_compiling:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
912 db_inc_paths = []
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
913
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
914 # Add some common subdirectories for Sleepycat DB to the list,
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
915 # based on the standard include directories. This way DB3/4 gets
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
916 # picked up when it is installed in a non-standard prefix and
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
917 # the user has added that prefix into inc_dirs.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
918 std_variants = []
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
919 for dn in inc_dirs:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
920 std_variants.append(os.path.join(dn, 'db3'))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
921 std_variants.append(os.path.join(dn, 'db4'))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
922 for x in gen_db_minor_ver_nums(4):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
923 std_variants.append(os.path.join(dn, "db4%d"%x))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
924 std_variants.append(os.path.join(dn, "db4.%d"%x))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
925 for x in gen_db_minor_ver_nums(3):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
926 std_variants.append(os.path.join(dn, "db3%d"%x))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
927 std_variants.append(os.path.join(dn, "db3.%d"%x))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
928
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
929 db_inc_paths = std_variants + db_inc_paths
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
930 db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)]
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
931
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
932 db_ver_inc_map = {}
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
933
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
934 if host_platform == 'darwin':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
935 sysroot = macosx_sdk_root()
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
936
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
937 class db_found(Exception): pass
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
938 try:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
939 # See whether there is a Sleepycat header in the standard
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
940 # search path.
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
941 for d in inc_dirs + db_inc_paths:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
942 f = os.path.join(d, "db.h")
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
943 if host_platform == 'darwin' and is_macosx_sdk_path(d):
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
944 f = os.path.join(sysroot, d[1:], "db.h")
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
945
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
946 if db_setup_debug: print("db: looking for db.h in", f)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
947 if os.path.exists(f):
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
948 with open(f, 'rb') as file:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
949 f = file.read()
55573
5c8b2238a2f5 Merged revisions 74356-74357 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 55065
diff changeset
950 m = re.search(br"#define\WDB_VERSION_MAJOR\W(\d+)", f)
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
951 if m:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
952 db_major = int(m.group(1))
55573
5c8b2238a2f5 Merged revisions 74356-74357 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 55065
diff changeset
953 m = re.search(br"#define\WDB_VERSION_MINOR\W(\d+)", f)
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
954 db_minor = int(m.group(1))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
955 db_ver = (db_major, db_minor)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
956
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
957 # Avoid 4.6 prior to 4.6.21 due to a BerkeleyDB bug
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
958 if db_ver == (4, 6):
55573
5c8b2238a2f5 Merged revisions 74356-74357 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 55065
diff changeset
959 m = re.search(br"#define\WDB_VERSION_PATCH\W(\d+)", f)
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
960 db_patch = int(m.group(1))
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
961 if db_patch < 21:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
962 print("db.h:", db_ver, "patch", db_patch,
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
963 "being ignored (4.6.x must be >= 4.6.21)")
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
964 continue
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
965
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
966 if ( (db_ver not in db_ver_inc_map) and
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
967 allow_db_ver(db_ver) ):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
968 # save the include directory with the db.h version
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
969 # (first occurrence only)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
970 db_ver_inc_map[db_ver] = d
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
971 if db_setup_debug:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
972 print("db.h: found", db_ver, "in", d)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
973 else:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
974 # we already found a header for this library version
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
975 if db_setup_debug: print("db.h: ignoring", d)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
976 else:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
977 # ignore this header, it didn't contain a version number
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
978 if db_setup_debug:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
979 print("db.h: no version number version in", d)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
980
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
981 db_found_vers = list(db_ver_inc_map.keys())
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
982 db_found_vers.sort()
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
983
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
984 while db_found_vers:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
985 db_ver = db_found_vers.pop()
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
986 db_incdir = db_ver_inc_map[db_ver]
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
987
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
988 # check lib directories parallel to the location of the header
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
989 db_dirs_to_check = [
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
990 db_incdir.replace("include", 'lib64'),
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
991 db_incdir.replace("include", 'lib'),
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
992 ]
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
993
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
994 if host_platform != 'darwin':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
995 db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check))
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
996
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
997 else:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
998 # Same as other branch, but takes OSX SDK into account
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
999 tmp = []
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1000 for dn in db_dirs_to_check:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1001 if is_macosx_sdk_path(dn):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1002 if os.path.isdir(os.path.join(sysroot, dn[1:])):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1003 tmp.append(dn)
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1004 else:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1005 if os.path.isdir(dn):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1006 tmp.append(dn)
62543
02044573eeec Merged revisions 82273 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 62355
diff changeset
1007 db_dirs_to_check = tmp
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1008
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1009 db_dirs_to_check = tmp
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1010
68488
0991b40e895d #11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 66485
diff changeset
1011 # Look for a version specific db-X.Y before an ambiguous dbX
52952
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1012 # XXX should we -ever- look for a dbX name? Do any
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1013 # systems really not name their library by version and
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1014 # symlink to more general names?
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1015 for dblib in (('db-%d.%d' % db_ver),
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1016 ('db%d%d' % db_ver),
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1017 ('db%d' % db_ver[0])):
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1018 dblib_file = self.compiler.find_library_file(
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1019 db_dirs_to_check + lib_dirs, dblib )
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1020 if dblib_file:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1021 dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ]
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1022 raise db_found
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1023 else:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1024 if db_setup_debug: print("db lib: ", dblib, "not found")
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1025
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1026 except db_found:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1027 if db_setup_debug:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1028 print("bsddb using BerkeleyDB lib:", db_ver, dblib)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1029 print("bsddb lib dir:", dblib_dir, " inc dir:", db_incdir)
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1030 db_incs = [db_incdir]
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1031 dblibs = [dblib]
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1032 else:
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1033 if db_setup_debug: print("db: no appropriate library found")
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1034 db_incs = None
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1035 dblibs = []
94832455e37d - Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
Matthias Klose <doko@ubuntu.com>
parents: 52902
diff changeset
1036 dblib_dir = None
49000
9957a36fc167 db_incs is needed
Benjamin Peterson <benjamin@python.org>
parents: 48994
diff changeset
1037
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1038 # The sqlite interface
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39575
diff changeset
1039 sqlite_setup_debug = False # verbose debug prints from this script?
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1040
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1041 # We hunt for #define SQLITE_VERSION "n.n.n"
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1042 # We need to find >= sqlite version 3.0.8
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1043 sqlite_incdir = sqlite_libdir = None
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1044 sqlite_inc_paths = [ '/usr/include',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1045 '/usr/include/sqlite',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1046 '/usr/include/sqlite3',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1047 '/usr/local/include',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1048 '/usr/local/include/sqlite',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1049 '/usr/local/include/sqlite3',
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
1050 ]
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
1051 if cross_compiling:
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
1052 sqlite_inc_paths = []
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1053 MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1054 MIN_SQLITE_VERSION = ".".join([str(x)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1055 for x in MIN_SQLITE_VERSION_NUMBER])
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1056
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1057 # Scan the default include directories before the SQLite specific
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1058 # ones. This allows one to override the copy of sqlite on OSX,
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1059 # where /usr/include contains an old version of sqlite.
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1060 if host_platform == 'darwin':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1061 sysroot = macosx_sdk_root()
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1062
78443
ee0ac9a0461f Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78331
diff changeset
1063 for d_ in inc_dirs + sqlite_inc_paths:
ee0ac9a0461f Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78331
diff changeset
1064 d = d_
78445
6af33673e955 Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78444
diff changeset
1065 if host_platform == 'darwin' and is_macosx_sdk_path(d):
78443
ee0ac9a0461f Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78331
diff changeset
1066 d = os.path.join(sysroot, d[1:])
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1067
78443
ee0ac9a0461f Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
Ned Deily <nad@acm.org>
parents: 78331
diff changeset
1068 f = os.path.join(d, "sqlite3.h")
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1069 if os.path.exists(f):
40774
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1070 if sqlite_setup_debug: print("sqlite: found %s"%f)
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1071 with open(f) as file:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1072 incf = file.read()
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1073 m = re.search(
82344
73d5dd480558 Issue #5033: Fix building of the sqlite3 extension module
Petri Lehtinen <petri@digip.org>
parents: 82092
diff changeset
1074 r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"([\d\.]*)"', incf)
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1075 if m:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1076 sqlite_version = m.group(1)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1077 sqlite_version_tuple = tuple([int(x)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1078 for x in sqlite_version.split(".")])
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1079 if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1080 # we win!
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39575
diff changeset
1081 if sqlite_setup_debug:
40774
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1082 print("%s/sqlite3.h: version %s"%(d, sqlite_version))
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1083 sqlite_incdir = d
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1084 break
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1085 else:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1086 if sqlite_setup_debug:
40774
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1087 print("%s: version %d is too old, need >= %s"%(d,
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1088 sqlite_version, MIN_SQLITE_VERSION))
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1089 elif sqlite_setup_debug:
40774
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1090 print("sqlite: %s had no SQLITE_VERSION"%(f,))
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1091
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1092 if sqlite_incdir:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1093 sqlite_dirs_to_check = [
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1094 os.path.join(sqlite_incdir, '..', 'lib64'),
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1095 os.path.join(sqlite_incdir, '..', 'lib'),
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1096 os.path.join(sqlite_incdir, '..', '..', 'lib64'),
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1097 os.path.join(sqlite_incdir, '..', '..', 'lib'),
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1098 ]
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1099 sqlite_libfile = self.compiler.find_library_file(
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1100 sqlite_dirs_to_check + lib_dirs, 'sqlite3')
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 49458
diff changeset
1101 if sqlite_libfile:
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 49458
diff changeset
1102 sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1103
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1104 if sqlite_incdir and sqlite_libdir:
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1105 sqlite_srcs = ['_sqlite/cache.c',
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1106 '_sqlite/connection.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1107 '_sqlite/cursor.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1108 '_sqlite/microprotocols.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1109 '_sqlite/module.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1110 '_sqlite/prepare_protocol.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1111 '_sqlite/row.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1112 '_sqlite/statement.c',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1113 '_sqlite/util.c', ]
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1114
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1115 sqlite_defines = []
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1116 if host_platform != "win32":
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1117 sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1118 else:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1119 sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1120
65827
5bdc0d6c6939 add --enable-loadable-sqlite-extensions #10268
Benjamin Peterson <benjamin@python.org>
parents: 65822
diff changeset
1121 # Enable support for loadable extensions in the sqlite3 module
5bdc0d6c6939 add --enable-loadable-sqlite-extensions #10268
Benjamin Peterson <benjamin@python.org>
parents: 65822
diff changeset
1122 # if --enable-loadable-sqlite-extensions configure option is used.
5bdc0d6c6939 add --enable-loadable-sqlite-extensions #10268
Benjamin Peterson <benjamin@python.org>
parents: 65822
diff changeset
1123 if '--enable-loadable-sqlite-extensions' not in sysconfig.get_config_var("CONFIG_ARGS"):
5bdc0d6c6939 add --enable-loadable-sqlite-extensions #10268
Benjamin Peterson <benjamin@python.org>
parents: 65822
diff changeset
1124 sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1125
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1126 if host_platform == 'darwin':
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1127 # In every directory on the search path search for a dynamic
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1128 # library and then a static library, instead of first looking
68585
bf94b6a73fc8 #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68488
diff changeset
1129 # for dynamic libraries on the entire path.
bf94b6a73fc8 #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68488
diff changeset
1130 # This way a statically linked custom sqlite gets picked up
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1131 # before the dynamic library in /usr/lib.
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1132 sqlite_extra_link_args = ('-Wl,-search_paths_first',)
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1133 else:
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1134 sqlite_extra_link_args = ()
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1135
70694
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1136 include_dirs = ["Modules/_sqlite"]
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1137 # Only include the directory where sqlite was found if it does
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1138 # not already exist in set include directories, otherwise you
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1139 # can end up with a bad search path order.
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1140 if sqlite_incdir not in self.compiler.include_dirs:
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1141 include_dirs.append(sqlite_incdir)
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1142 exts.append(Extension('_sqlite3', sqlite_srcs,
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1143 define_macros=sqlite_defines,
70694
b313fc77fa11 When building sqlite3, the directory where sqlite.h was found was
Brett Cannon <brett@python.org>
parents: 70566
diff changeset
1144 include_dirs=include_dirs,
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1145 library_dirs=sqlite_libdir,
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1146 runtime_library_dirs=sqlite_libdir,
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1147 extra_link_args=sqlite_extra_link_args,
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1148 libraries=["sqlite3",]))
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1149 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1150 missing.append('_sqlite3')
29001
6c40b73c7045 build bsddb185 module in certain restricted circumstances
Skip Montanaro <skip@pobox.com>
parents: 28947
diff changeset
1151
76315
7fce7409b347 Be less verbose when building dbm.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 76264
diff changeset
1152 dbm_setup_debug = False # verbose debug prints from this script?
58069
4ffb93389256 Merged revisions 77216 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57999
diff changeset
1153 dbm_order = ['gdbm']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1154 # The standard Unix dbm module:
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1155 if host_platform not in ['cygwin']:
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1156 config_args = [arg.strip("'")
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1157 for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
58069
4ffb93389256 Merged revisions 77216 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57999
diff changeset
1158 dbm_args = [arg for arg in config_args
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1159 if arg.startswith('--with-dbmliborder=')]
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1160 if dbm_args:
58069
4ffb93389256 Merged revisions 77216 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57999
diff changeset
1161 dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":")
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1162 else:
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1163 dbm_order = "ndbm:gdbm:bdb".split(":")
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1164 dbmext = None
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1165 for cand in dbm_order:
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1166 if cand == "ndbm":
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1167 if find_file("ndbm.h", inc_dirs, []) is not None:
77481
e2be1f43beed Issue #15044: Handle Fedora 17's approach to ndbm compatibility
Nick Coghlan <ncoghlan@gmail.com>
parents: 76263
diff changeset
1168 # Some systems have -lndbm, others have -lgdbm_compat,
e2be1f43beed Issue #15044: Handle Fedora 17's approach to ndbm compatibility
Nick Coghlan <ncoghlan@gmail.com>
parents: 76263
diff changeset
1169 # others don't have either
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
1170 if self.compiler.find_library_file(lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1171 'ndbm'):
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1172 ndbm_libs = ['ndbm']
77481
e2be1f43beed Issue #15044: Handle Fedora 17's approach to ndbm compatibility
Nick Coghlan <ncoghlan@gmail.com>
parents: 76263
diff changeset
1173 elif self.compiler.find_library_file(lib_dirs,
e2be1f43beed Issue #15044: Handle Fedora 17's approach to ndbm compatibility
Nick Coghlan <ncoghlan@gmail.com>
parents: 76263
diff changeset
1174 'gdbm_compat'):
e2be1f43beed Issue #15044: Handle Fedora 17's approach to ndbm compatibility
Nick Coghlan <ncoghlan@gmail.com>
parents: 76263
diff changeset
1175 ndbm_libs = ['gdbm_compat']
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1176 else:
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1177 ndbm_libs = []
76315
7fce7409b347 Be less verbose when building dbm.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 76264
diff changeset
1178 if dbm_setup_debug: print("building dbm using ndbm")
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1179 dbmext = Extension('_dbm', ['_dbmmodule.c'],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1180 define_macros=[
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1181 ('HAVE_NDBM_H',None),
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1182 ],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1183 libraries=ndbm_libs)
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1184 break
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1185
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1186 elif cand == "gdbm":
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1187 if self.compiler.find_library_file(lib_dirs, 'gdbm'):
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1188 gdbm_libs = ['gdbm']
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
1189 if self.compiler.find_library_file(lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1190 'gdbm_compat'):
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1191 gdbm_libs.append('gdbm_compat')
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1192 if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
76315
7fce7409b347 Be less verbose when building dbm.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 76264
diff changeset
1193 if dbm_setup_debug: print("building dbm using gdbm")
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1194 dbmext = Extension(
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1195 '_dbm', ['_dbmmodule.c'],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1196 define_macros=[
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1197 ('HAVE_GDBM_NDBM_H', None),
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1198 ],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1199 libraries = gdbm_libs)
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1200 break
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1201 if find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
76315
7fce7409b347 Be less verbose when building dbm.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 76264
diff changeset
1202 if dbm_setup_debug: print("building dbm using gdbm")
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1203 dbmext = Extension(
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1204 '_dbm', ['_dbmmodule.c'],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1205 define_macros=[
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1206 ('HAVE_GDBM_DASH_NDBM_H', None),
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1207 ],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1208 libraries = gdbm_libs)
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1209 break
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1210 elif cand == "bdb":
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1211 if db_incs is not None:
76315
7fce7409b347 Be less verbose when building dbm.
Ross Lagerwall <rosslagerwall@gmail.com>
parents: 76264
diff changeset
1212 if dbm_setup_debug: print("building dbm using bdb")
53634
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1213 dbmext = Extension('_dbm', ['_dbmmodule.c'],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1214 library_dirs=dblib_dir,
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1215 runtime_library_dirs=dblib_dir,
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1216 include_dirs=db_incs,
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1217 define_macros=[
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1218 ('HAVE_BERKDB_H', None),
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1219 ('DB_DBM_HSEARCH', None),
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1220 ],
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1221 libraries=dblibs)
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1222 break
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1223 if dbmext is not None:
c4a1c4884056 - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
Matthias Klose <doko@ubuntu.com>
parents: 53440
diff changeset
1224 exts.append(dbmext)
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1225 else:
47285
afbde360dd1a Create the dbm package from PEP 3108. #2881.
Georg Brandl <georg@python.org>
parents: 47230
diff changeset
1226 missing.append('_dbm')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1227
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1228 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
58069
4ffb93389256 Merged revisions 77216 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57999
diff changeset
1229 if ('gdbm' in dbm_order and
4ffb93389256 Merged revisions 77216 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57999
diff changeset
1230 self.compiler.find_library_file(lib_dirs, 'gdbm')):
47285
afbde360dd1a Create the dbm package from PEP 3108. #2881.
Georg Brandl <georg@python.org>
parents: 47230
diff changeset
1231 exts.append( Extension('_gdbm', ['_gdbmmodule.c'],
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1232 libraries = ['gdbm'] ) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1233 else:
47285
afbde360dd1a Create the dbm package from PEP 3108. #2881.
Georg Brandl <georg@python.org>
parents: 47230
diff changeset
1234 missing.append('_gdbm')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1235
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1236 # Unix-only modules
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1237 if host_platform != 'win32':
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1238 # Steen Lumholt's termios module
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1239 exts.append( Extension('termios', ['termios.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1240 # Jeremy Hylton's rlimit interface
56726
14b55a4e8725 Remove AtheOS support, as per PEP 11 (which claims that all code was removed in Python 3.0).
Antoine Pitrou <solipsis@pitrou.net>
parents: 56135
diff changeset
1241 exts.append( Extension('resource', ['resource.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1242
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
1243 # Sun yellow pages. Some systems have the functions in libc.
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1244 if (host_platform not in ['cygwin', 'qnx6'] and
57998
d4ac3a8000c7 Merged revisions 77129,77132 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57491
diff changeset
1245 find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
57999
a7f6a53daa12 compiler_obj -> compiler
Benjamin Peterson <benjamin@python.org>
parents: 57998
diff changeset
1246 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
16804
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1247 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
1248 else:
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1249 libs = []
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
1250 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
1251 libraries = libs) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1252 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1253 missing.append('nis')
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1254 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1255 missing.extend(['nis', 'resource', 'termios'])
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1256
31468
de2ed800fa50 a couple other sunos4 support items removed
Skip Montanaro <skip@pobox.com>
parents: 31436
diff changeset
1257 # 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
1258 # provided by the ncurses library.
73782
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1259 curses_defines = []
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1260 curses_includes = []
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1261 panel_library = 'panel'
73782
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1262 if curses_library == 'ncursesw':
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1263 curses_defines.append(('HAVE_NCURSESW', '1'))
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1264 curses_includes.append('/usr/include/ncursesw')
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1265 # Bug 1464056: If _curses.so links with ncursesw,
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1266 # _curses_panel.so must link with panelw.
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1267 panel_library = 'panelw'
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1268 if host_platform == 'darwin':
77529
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1269 # On OS X, there is no separate /usr/lib/libncursesw nor
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1270 # libpanelw. If we are here, we found a locally-supplied
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1271 # version of libncursesw. There should be also be a
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1272 # libpanelw. _XOPEN_SOURCE defines are usually excluded
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1273 # for OS X but we need _XOPEN_SOURCE_EXTENDED here for
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1274 # ncurses wide char support
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1275 curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1276 elif host_platform == 'darwin' and curses_library == 'ncurses':
77529
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1277 # Building with the system-suppied combined libncurses/libpanel
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1278 curses_defines.append(('HAVE_NCURSESW', '1'))
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1279 curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
73782
5d42f22189be cleanup setup.py for curses options
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73763
diff changeset
1280
62355
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
1281 if curses_library.startswith('ncurses'):
e753562cc023 Issue #7384: If the system readline library is linked against
Stefan Krah <stefan@bytereef.org>
parents: 62054
diff changeset
1282 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
1283 exts.append( Extension('_curses', ['_cursesmodule.c'],
73763
919259054621 Issue #13415: Help to locate curses.h when _curses module is linked to ncursesw
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73126
diff changeset
1284 include_dirs=curses_includes,
71656
d98b5e0f0862 Fix build error in _curses module when not using libncursesw.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 70731
diff changeset
1285 define_macros=curses_defines,
36479
d496c0764ad6 Patch #428494: Prefer linking against ncursesw over ncurses library
Martin v. Löwis <martin@v.loewis.de>
parents: 36459
diff changeset
1286 libraries = curses_libs) )
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1287 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
1288 # 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
1289 # the _curses module.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1290 if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1291 curses_libs = ['curses', 'terminfo']
28473
0f558eede6c5 SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents: 28356
diff changeset
1292 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
1293 curses_libs = ['curses', 'termcap']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1294 else:
28473
0f558eede6c5 SF patch #712367, get build working on AIX
Neal Norwitz <nnorwitz@gmail.com>
parents: 28356
diff changeset
1295 curses_libs = ['curses']
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1296
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1297 exts.append( Extension('_curses', ['_cursesmodule.c'],
71656
d98b5e0f0862 Fix build error in _curses module when not using libncursesw.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 70731
diff changeset
1298 define_macros=curses_defines,
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1299 libraries = curses_libs) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1300 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1301 missing.append('_curses')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1302
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1303 # 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
1304 if (module_enabled(exts, '_curses') and
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1305 self.compiler.find_library_file(lib_dirs, panel_library)):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1306 exts.append( Extension('_curses_panel', ['_curses_panel.c'],
73763
919259054621 Issue #13415: Help to locate curses.h when _curses module is linked to ncursesw
Victor Stinner <victor.stinner@haypocalc.com>
parents: 73126
diff changeset
1307 include_dirs=curses_includes,
77529
2035c5ad4239 Issue #14225: Fix Unicode support for curses (#12567) on OS X:
Ned Deily <nad@acm.org>
parents: 77482
diff changeset
1308 define_macros=curses_defines,
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1309 libraries = [panel_library] + curses_libs) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1310 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1311 missing.append('_curses_panel')
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1312
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
1313 # 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
1314 # 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
1315 # 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
1316 #
825948c21f0d Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents: 24605
diff changeset
1317 # 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
1318 # 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
1319 # 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
1320 # 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
1321 # 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
1322 #
825948c21f0d Regress Guido's change of 2002/08/06 to check for the zlib version
Barry Warsaw <barry@python.org>
parents: 24605
diff changeset
1323 # 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
1324 # 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
1325 zlib_inc = find_file('zlib.h', [], inc_dirs)
46042
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1326 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
1327 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
1328 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
1329 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
1330 version_req = '"1.1.3"'
86463
2d8d5fea6194 Ensure setup.py looks for zlib.h in an OS X SDK.
Ned Deily <nad@acm.org>
parents: 84973
diff changeset
1331 if host_platform == 'darwin' and is_macosx_sdk_path(zlib_h):
2d8d5fea6194 Ensure setup.py looks for zlib.h in an OS X SDK.
Ned Deily <nad@acm.org>
parents: 84973
diff changeset
1332 zlib_h = os.path.join(macosx_sdk_root(), zlib_h[1:])
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1333 with open(zlib_h) as fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1334 while 1:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1335 line = fp.readline()
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1336 if not line:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1337 break
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1338 if line.startswith('#define ZLIB_VERSION'):
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1339 version = line.split()[2]
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1340 break
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
1341 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
1342 if (self.compiler.find_library_file(lib_dirs, 'z')):
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1343 if host_platform == "darwin":
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1344 zlib_extra_link_args = ('-Wl,-search_paths_first',)
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1345 else:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1346 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
1347 exts.append( Extension('zlib', ['zlibmodule.c'],
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1348 libraries = ['z'],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1349 extra_link_args = zlib_extra_link_args))
46042
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1350 have_zlib = True
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1351 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1352 missing.append('zlib')
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1353 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1354 missing.append('zlib')
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1355 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1356 missing.append('zlib')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1357
46042
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1358 # Helper module for various ascii-encoders. Uses zlib for an optimized
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1359 # crc32 if we have it. Otherwise binascii uses its own.
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1360 if have_zlib:
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1361 extra_compile_args = ['-DUSE_ZLIB_CRC32']
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1362 libraries = ['z']
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1363 extra_link_args = zlib_extra_link_args
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1364 else:
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1365 extra_compile_args = []
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1366 libraries = []
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1367 extra_link_args = []
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1368 exts.append( Extension('binascii', ['binascii.c'],
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1369 extra_compile_args = extra_compile_args,
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1370 libraries = libraries,
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1371 extra_link_args = extra_link_args) )
4a6b093b319b Merged revisions 61820-61823 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46034
diff changeset
1372
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1373 # Gustavo Niemeyer's bz2 module.
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1374 if (self.compiler.find_library_file(lib_dirs, 'bz2')):
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1375 if host_platform == "darwin":
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1376 bz2_extra_link_args = ('-Wl,-search_paths_first',)
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1377 else:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1378 bz2_extra_link_args = ()
69112
2cb07a46f4b5 Issue #5863: Rewrite BZ2File in pure Python, and allow it to accept
Antoine Pitrou <solipsis@pitrou.net>
parents: 68587
diff changeset
1379 exts.append( Extension('_bz2', ['_bz2module.c'],
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1380 libraries = ['bz2'],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1381 extra_link_args = bz2_extra_link_args) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1382 else:
69112
2cb07a46f4b5 Issue #5863: Rewrite BZ2File in pure Python, and allow it to accept
Antoine Pitrou <solipsis@pitrou.net>
parents: 68587
diff changeset
1383 missing.append('_bz2')
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1384
73794
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1385 # LZMA compression support.
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1386 if self.compiler.find_library_file(lib_dirs, 'lzma'):
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1387 exts.append( Extension('_lzma', ['_lzmamodule.c'],
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1388 libraries = ['lzma']) )
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1389 else:
74d182cf0187 Issue #6715: Add module for compression using the LZMA algorithm.
Nadeem Vawda <nadeem.vawda@gmail.com>
parents: 73782
diff changeset
1390 missing.append('_lzma')
26037
521e89c4ff44 Patch implementing bz2 module.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 25790
diff changeset
1391
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1392 # Interface to the Expat XML parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1393 #
58222
f2d54096dc8c Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58132
diff changeset
1394 # Expat was written by James Clark and is now maintained by a group of
f2d54096dc8c Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58132
diff changeset
1395 # developers on SourceForge; see www.libexpat.org for more information.
f2d54096dc8c Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58132
diff changeset
1396 # The pyexpat module was written by Paul Prescod after a prototype by
f2d54096dc8c Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58132
diff changeset
1397 # Jack Jansen. The Expat source is included in Modules/expat/. Usage
f2d54096dc8c Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58132
diff changeset
1398 # of a system shared libexpat.so is possible with --with-system-expat
65822
Benjamin Peterson <benjamin@python.org>
parents: 65724
diff changeset
1399 # configure option.
23889
41ab532d4f60 Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents: 23867
diff changeset
1400 #
41ab532d4f60 Update description of the Expat library.
Fred Drake <fdrake@acm.org>
parents: 23867
diff changeset
1401 # 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
1402 #
58025
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1403 if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1404 expat_inc = []
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1405 define_macros = []
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1406 expat_lib = ['expat']
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1407 expat_sources = []
82092
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1408 expat_depends = []
58025
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1409 else:
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1410 expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1411 define_macros = [
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1412 ('HAVE_EXPAT_CONFIG_H', '1'),
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1413 ]
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1414 expat_lib = []
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1415 expat_sources = ['expat/xmlparse.c',
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1416 'expat/xmlrole.c',
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1417 'expat/xmltok.c']
82092
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1418 expat_depends = ['expat/ascii.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1419 'expat/asciitab.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1420 'expat/expat.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1421 'expat/expat_config.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1422 'expat/expat_external.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1423 'expat/internal.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1424 'expat/latin1tab.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1425 'expat/utf8tab.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1426 'expat/xmlrole.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1427 'expat/xmltok.h',
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1428 'expat/xmltok_impl.h'
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1429 ]
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1430
30731
f0da0cad5cd5 Provide a bit more information to the compiler when building Expat.
Fred Drake <fdrake@acm.org>
parents: 30485
diff changeset
1431 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
1432 define_macros = define_macros,
58025
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1433 include_dirs = expat_inc,
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1434 libraries = expat_lib,
82092
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1435 sources = ['pyexpat.c'] + expat_sources,
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1436 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
1437 ))
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1438
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1439 # 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
1440 # 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
1441
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1442 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
1443 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
1444 exts.append(Extension('_elementtree',
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1445 define_macros = define_macros,
58025
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1446 include_dirs = expat_inc,
228bba2d1f3f Merged revisions 77169 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 57996
diff changeset
1447 libraries = expat_lib,
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1448 sources = ['_elementtree.c'],
82092
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1449 depends = ['pyexpat.c'] + expat_sources +
ce411fd690fd add proper dependencies on expat headers and sources
Christian Heimes <christian@cheimes.de>
parents: 81769
diff changeset
1450 expat_depends,
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1451 ))
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1452 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1453 missing.append('_elementtree')
36026
e01d8524b6f6 added cElementTree/_elementtree build stuff and wrapper module
Fredrik Lundh <fredrik@pythonware.com>
parents: 35737
diff changeset
1454
31386
887ce39f95f2 Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents: 31353
diff changeset
1455 # Hye-Shik Chang's CJKCodecs modules.
41818
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
1456 exts.append(Extension('_multibytecodec',
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
1457 ['cjkcodecs/multibytecodec.c']))
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
1458 for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'):
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
1459 exts.append(Extension('_codecs_%s' % loc,
bfc73d849e28 The unicode builtin is gone now. Fix setup.py so that
Walter Dörwald <walter@livinglogic.de>
parents: 41749
diff changeset
1460 ['cjkcodecs/_codecs_%s.c' % loc]))
31386
887ce39f95f2 Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents: 31353
diff changeset
1461
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
1462 # Stefan Krah's _decimal module
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
1463 exts.append(self._decimal_ext())
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
1464
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1465 # Thomas Heller's _ctypes module
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1466 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
1467
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1468 # Richard Oudkerk's multiprocessing module
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1469 if host_platform == 'win32': # Windows
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1470 macros = dict()
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1471 libraries = ['ws2_32']
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1472
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1473 elif host_platform == 'darwin': # Mac OSX
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1474 macros = dict()
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1475 libraries = []
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1476
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1477 elif host_platform == 'cygwin': # Cygwin
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1478 macros = dict()
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1479 libraries = []
48412
5f4a8980c1ac Merged revisions 64475,64544-64545,64550,64557-64558,64565,64570,64577,64582-64583,64585,64590,64592-64593,64625,64630,64638,64647,64655-64656,64663-64664 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 48379
diff changeset
1480
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1481 elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
48412
5f4a8980c1ac Merged revisions 64475,64544-64545,64550,64557-64558,64565,64570,64577,64582-64583,64585,64590,64592-64593,64625,64630,64638,64647,64655-64656,64663-64664 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 48379
diff changeset
1482 # FreeBSD's P1003.1b semaphore support is very experimental
5f4a8980c1ac Merged revisions 64475,64544-64545,64550,64557-64558,64565,64570,64577,64582-64583,64585,64590,64592-64593,64625,64630,64638,64647,64655-64656,64663-64664 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 48379
diff changeset
1483 # and has many known problems. (as of June 2008)
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1484 macros = dict()
48412
5f4a8980c1ac Merged revisions 64475,64544-64545,64550,64557-64558,64565,64570,64577,64582-64583,64585,64590,64592-64593,64625,64630,64638,64647,64655-64656,64663-64664 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 48379
diff changeset
1485 libraries = []
5f4a8980c1ac Merged revisions 64475,64544-64545,64550,64557-64558,64565,64570,64577,64582-64583,64585,64590,64592-64593,64625,64630,64638,64647,64655-64656,64663-64664 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 48379
diff changeset
1486
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1487 elif host_platform.startswith('openbsd'):
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1488 macros = dict()
49433
8f5a8ea5ba76 Merged revisions 66670,66681,66688,66696-66699 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49035
diff changeset
1489 libraries = []
8f5a8ea5ba76 Merged revisions 66670,66681,66688,66696-66699 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49035
diff changeset
1490
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1491 elif host_platform.startswith('netbsd'):
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1492 macros = dict()
52561
8f51dd09f3f2 Merged revisions 70849,70852 via svnmerge from
Jesse Noller <jnoller@gmail.com>
parents: 52011
diff changeset
1493 libraries = []
8f51dd09f3f2 Merged revisions 70849,70852 via svnmerge from
Jesse Noller <jnoller@gmail.com>
parents: 52011
diff changeset
1494
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1495 else: # Linux and other unices
52902
d3887dfe661f Merged revisions 70908,70939,71009,71022,71036 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 52561
diff changeset
1496 macros = dict()
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1497 libraries = ['rt']
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1498
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1499 if host_platform == 'win32':
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1500 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1501 '_multiprocessing/semaphore.c',
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1502 ]
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1503
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1504 else:
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1505 multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1506 ]
57491
3d77d7c16c90 Merged revisions 76566 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 55971
diff changeset
1507 if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
3d77d7c16c90 Merged revisions 76566 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents: 55971
diff changeset
1508 sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1509 multiprocessing_srcs.append('_multiprocessing/semaphore.c')
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1510
50993
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1511 if sysconfig.get_config_var('WITH_THREAD'):
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1512 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1513 define_macros=list(macros.items()),
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1514 include_dirs=["Modules/_multiprocessing"]))
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1515 else:
857d66341ff9 merge 68874 to py3kwq!
Jesse Noller <jnoller@gmail.com>
parents: 50404
diff changeset
1516 missing.append('_multiprocessing')
47595
5c6cdfcd6eae Merged revisions 64104,64117 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 47559
diff changeset
1517 # End multiprocessing
41064
6e1cf4d28af3 Check in Daniel Stutzbach's _fileio.c and test_fileio.py
Guido van Rossum <guido@python.org>
parents: 40893
diff changeset
1518
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1519 # Platform-specific libraries
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1520 if host_platform.startswith(('linux', 'freebsd', 'gnukfreebsd')):
27865
65494469ad3e Re-enable compiling ossaudiodev now that it seems to work again.
Guido van Rossum <guido@python.org>
parents: 27820
diff changeset
1521 exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1522 else:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1523 missing.append('ossaudiodev')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1524
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1525 if host_platform == 'darwin':
47376
aea3c5543d43 add the gestalt module back as _gestalt
Benjamin Peterson <benjamin@python.org>
parents: 47285
diff changeset
1526 exts.append(
60706
485c3f09a09b Merged revisions 80198 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58069
diff changeset
1527 Extension('_scproxy', ['_scproxy.c'],
485c3f09a09b Merged revisions 80198 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58069
diff changeset
1528 extra_link_args=[
485c3f09a09b Merged revisions 80198 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58069
diff changeset
1529 '-framework', 'SystemConfiguration',
485c3f09a09b Merged revisions 80198 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58069
diff changeset
1530 '-framework', 'CoreFoundation',
485c3f09a09b Merged revisions 80198 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 58069
diff changeset
1531 ]))
47376
aea3c5543d43 add the gestalt module back as _gestalt
Benjamin Peterson <benjamin@python.org>
parents: 47285
diff changeset
1532
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1533 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
1534
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1535 # 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
1536 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
1537
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1538 if '_tkinter' not in [e.name for e in self.extensions]:
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1539 missing.append('_tkinter')
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1540
84973
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1541 ## # Uncomment these lines if you want to play with xxmodule.c
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1542 ## ext = Extension('xx', ['xxmodule.c'])
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1543 ## self.extensions.append(ext)
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1544
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1545 if 'd' not in sys.abiflags:
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1546 ext = Extension('xxlimited', ['xxlimited.c'],
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1547 define_macros=[('Py_LIMITED_API', 1)])
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1548 self.extensions.append(ext)
e5607874e8ff Issue #18517: Move definition of "xxlimited" extension to detect_modules().
Ned Deily <nad@acm.org>
parents: 82870
diff changeset
1549
41554
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1550 return missing
06145fbc7ab9 Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41464
diff changeset
1551
86615
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1552 def detect_tkinter_explicitly(self):
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1553 # Build _tkinter using explicit locations for Tcl/Tk.
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1554 #
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1555 # This is enabled when both arguments are given to ./configure:
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1556 #
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1557 # --with-tcltk-includes="-I/path/to/tclincludes \
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1558 # -I/path/to/tkincludes"
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1559 # --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1560 # -L/path/to/tklibs -ltkm.n"
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1561 #
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1562 # These values can also be specified or overriden via make:
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1563 # make TCLTK_INCLUDES="..." TCLTK_LIBS="..."
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1564 #
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1565 # This can be useful for building and testing tkinter with multiple
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1566 # versions of Tcl/Tk. Note that a build of Tk depends on a particular
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1567 # build of Tcl so you need to specify both arguments and use care when
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1568 # overriding.
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1569
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1570 # The _TCLTK variables are created in the Makefile sharedmods target.
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1571 tcltk_includes = os.environ.get('_TCLTK_INCLUDES')
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1572 tcltk_libs = os.environ.get('_TCLTK_LIBS')
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1573 if not (tcltk_includes and tcltk_libs):
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1574 # Resume default configuration search.
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1575 return 0
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1576
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1577 extra_compile_args = tcltk_includes.split()
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1578 extra_link_args = tcltk_libs.split()
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1579 ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1580 define_macros=[('WITH_APPINIT', 1)],
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1581 extra_compile_args = extra_compile_args,
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1582 extra_link_args = extra_link_args,
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1583 )
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1584 self.extensions.append(ext)
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1585 return 1
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1586
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1587 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
1588 # 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
1589 # 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
1590 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
1591 framework_dirs = [
52011
41e407286610 Merged revisions 70172 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51991
diff changeset
1592 '/Library/Frameworks',
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1593 '/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
1594 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
1595 ]
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1596
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1597 sysroot = macosx_sdk_root()
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1598
36156
c71ca1cd363b typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents: 36144
diff changeset
1599 # 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
1600 # bundles.
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1601 # 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
1602 for F in framework_dirs:
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1603 # both Tcl.framework and Tk.framework should be present
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1604
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1605
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1606 for fw in 'Tcl', 'Tk':
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1607 if is_macosx_sdk_path(F):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1608 if not exists(join(sysroot, F[1:], fw + '.framework')):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1609 break
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1610 else:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1611 if not exists(join(F, fw + '.framework')):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1612 break
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1613 else:
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1614 # 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
1615 # building
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1616 break
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1617 else:
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1618 # 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
1619 # 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
1620 return 0
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1621
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1622 # 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
1623 # 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
1624 # 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
1625 #
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1626 include_dirs = [
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1627 join(F, fw + '.framework', H)
41464
060c79f6d919 Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents: 41253
diff changeset
1628 for fw in ('Tcl', 'Tk')
060c79f6d919 Hide list comp variables and support set comprehensions
Nick Coghlan <ncoghlan@gmail.com>
parents: 41253
diff changeset
1629 for H in ('Headers', 'Versions/Current/PrivateHeaders')
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1630 ]
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1631
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1632 # 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
1633 # 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
1634 # 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
1635 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
1636 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
1637
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1638 # All existing framework builds of Tcl/Tk don't support 64-bit
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1639 # architectures.
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1640 cflags = sysconfig.get_config_vars('CFLAGS')[0]
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1641 archs = re.findall('-arch\s+(\w+)', cflags)
55971
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1642
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1643 tmpfile = os.path.join(self.build_temp, 'tk.arch')
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1644 if not os.path.exists(self.build_temp):
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1645 os.makedirs(self.build_temp)
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1646
55971
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1647 # Note: cannot use os.popen or subprocess here, that
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1648 # requires extensions that are not available here.
62054
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1649 if is_macosx_sdk_path(F):
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1650 os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(os.path.join(sysroot, F[1:]), tmpfile))
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1651 else:
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1652 os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile))
25b4163ffe3f Merged revisions 81673 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60706
diff changeset
1653
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1654 with open(tmpfile) as fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1655 detected_archs = []
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1656 for ln in fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1657 a = ln.split()[-1]
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1658 if a in archs:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1659 detected_archs.append(ln.split()[-1])
55971
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1660 os.unlink(tmpfile)
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1661
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1662 for a in detected_archs:
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1663 frameworks.append('-arch')
4e7f6bc810b3 Merged revisions 74804 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 55573
diff changeset
1664 frameworks.append(a)
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1665
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1666 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
1667 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
1668 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
1669 libraries = [],
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1670 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
1671 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
1672 )
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1673 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
1674 return 1
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1675
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1676 def detect_tkinter(self, inc_dirs, lib_dirs):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1677 # 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
1678
86615
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1679 # Check whether --with-tcltk-includes and --with-tcltk-libs were
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1680 # configured or passed into the make target. If so, use these values
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1681 # to build tkinter and bypass the searches for Tcl and TK in standard
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1682 # locations.
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1683 if self.detect_tkinter_explicitly():
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1684 return
d7662958b27a Issue #1584: Provide options to override default search paths for Tcl and Tk
Ned Deily <nad@acm.org>
parents: 86463
diff changeset
1685
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1686 # 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
1687 # 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
1688 # Darwin - either AquaTk, if it is found, or X11 based Tk.
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1689 if (host_platform == 'darwin' and
36156
c71ca1cd363b typo, use parens for continued expr
Skip Montanaro <skip@pobox.com>
parents: 36144
diff changeset
1690 self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
27507
d9d57f5f98cd Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27396
diff changeset
1691 return
23957
03bba7282852 Patch #557719 by Tony Lownds, slightly massaged by me: streamline the
Jack Jansen <jack.jansen@cwi.nl>
parents: 23889
diff changeset
1692
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1693 # 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
1694 # 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
1695 # 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
1696 tcllib = tklib = tcl_includes = tk_includes = None
65191
6543fa4b1458 Merged revisions 74473,79974 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64522
diff changeset
1697 for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
6543fa4b1458 Merged revisions 74473,79974 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 64522
diff changeset
1698 '8.2', '82', '8.1', '81', '8.0', '80']:
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
1699 tklib = self.compiler.find_library_file(lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1700 'tk' + version)
63136
29a3eda89995 reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 63051
diff changeset
1701 tcllib = self.compiler.find_library_file(lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1702 'tcl' + version)
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
1703 if tklib and tcllib:
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1704 # 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
1705 break
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1706
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1707 # 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
1708 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
1709 # 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
1710 # 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
1711 dotversion = version
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1712 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
1713 # 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
1714 # 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
1715 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
1716 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
1717 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
1718 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
1719 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
1720 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
1721 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
1722 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
1723 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
1724
28947
8df897f14fb8 Change 'and' to 'or' in _tkinter test.
Martin v. Löwis <martin@v.loewis.de>
parents: 28940
diff changeset
1725 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
1726 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
1727 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
1728 return
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1729
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1730 # OK... everything seems to be present for Tcl/Tk.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1731
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1732 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
1733 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
1734 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
1735 include_dirs.append(dir)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1736
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1737 # Check for various platform-specific directories
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1738 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
1739 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
1740 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
1741 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
1742 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
1743 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
1744 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
1745 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
1746 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
1747 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
1748 else:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1749 # 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
1750 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
1751 added_lib_dirs.append('/usr/X11/lib')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1752
27695
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1753 # If Cygwin, then verify that X is installed before proceeding
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1754 if host_platform == 'cygwin':
27695
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1755 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1756 if x11_inc is None:
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1757 return
1a300f475332 This patch reverts the following:
Jason Tishler <jason@tishler.net>
parents: 27694
diff changeset
1758
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1759 # Check for BLT extension
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
1760 if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1761 'BLT8.0'):
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1762 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
1763 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
1764 elif self.compiler.find_library_file(lib_dirs + added_lib_dirs,
55128
c23a8f1cfab8 Merged revisions 73864 via svnmerge from
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 55075
diff changeset
1765 'BLT'):
26626
e41ee2b8e73d Patch #629126: Detect BLT by also looking for libBLT.
Martin v. Löwis <martin@v.loewis.de>
parents: 26616
diff changeset
1766 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
1767 libs.append('BLT')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1768
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1769 # 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
1770 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
1771 libs.append('tcl'+ version)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1772
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1773 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
1774 libs.append('ld')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1775
18819
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
1776 # Finally, link with the X11 libraries (not appropriate on cygwin)
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1777 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
1778 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
1779
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1780 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
1781 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
1782 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
1783 libraries = libs,
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1784 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
1785 )
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1786 self.extensions.append(ext)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1787
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
1788 # XXX handle these, but how to detect?
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1789 # *** 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
1790 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1791 # *** 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
1792 # -DWITH_TOGL togl.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1793 # *** Uncomment these for TOGL extension only:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
1794 # -lGL -lGLU -lXext -lXmu \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
1795
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1796 def configure_ctypes_darwin(self, ext):
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1797 # Darwin (OS X) uses preconfigured files, in
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1798 # the Modules/_ctypes/libffi_osx directory.
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
1799 srcdir = sysconfig.get_config_var('srcdir')
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1800 ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1801 '_ctypes', 'libffi_osx'))
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1802 sources = [os.path.join(ffi_srcdir, p)
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1803 for p in ['ffi.c',
48485
bd4841069c68 Merged revisions 63955 via svnmerge from
Georg Brandl <georg@python.org>
parents: 48412
diff changeset
1804 'x86/darwin64.S',
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1805 'x86/x86-darwin.S',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1806 'x86/x86-ffi_darwin.c',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1807 'x86/x86-ffi64.c',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1808 'powerpc/ppc-darwin.S',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1809 'powerpc/ppc-darwin_closure.S',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1810 'powerpc/ppc-ffi_darwin.c',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1811 'powerpc/ppc64-darwin_closure.S',
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1812 ]]
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1813
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1814 # Add .S (preprocessed assembly) to C compiler source extensions.
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1815 self.compiler.src_extensions.append('.S')
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1816
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1817 include_dirs = [os.path.join(ffi_srcdir, 'include'),
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1818 os.path.join(ffi_srcdir, 'powerpc')]
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1819 ext.include_dirs.extend(include_dirs)
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1820 ext.sources.extend(sources)
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1821 return True
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1822
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1823 def configure_ctypes(self, ext):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1824 if not self.use_system_libffi:
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1825 if host_platform == 'darwin':
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1826 return self.configure_ctypes_darwin(ext)
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1827
51349
76239798a608 Make setup.py work when building in a directory other than the
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 50993
diff changeset
1828 srcdir = sysconfig.get_config_var('srcdir')
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1829 ffi_builddir = os.path.join(self.build_temp, 'libffi')
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1830 ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1831 '_ctypes', 'libffi'))
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1832 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
1833
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1834 from distutils.dep_util import newer_group
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1835
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1836 config_sources = [os.path.join(ffi_srcdir, fname)
40893
32c4897b5d46 Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 40807
diff changeset
1837 for fname in os.listdir(ffi_srcdir)
32c4897b5d46 Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 40807
diff changeset
1838 if os.path.isfile(os.path.join(ffi_srcdir, fname))]
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1839 if self.force or newer_group(config_sources,
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
1840 ffi_configfile):
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1841 from distutils.dir_util import mkpath
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1842 mkpath(ffi_builddir)
77886
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
1843 config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
cfbe51e66749 - Issue #14330: For cross builds, don't use host python, use host search paths
doko@ubuntu.com
parents: 77881
diff changeset
1844 if (('--host=' in arg) or ('--build=' in arg))]
78861
048e13546a7c Issue #15591: run ctypes' configure in quiet mode when setup.py runs silently
Christian Heimes <christian@cheimes.de>
parents: 78443
diff changeset
1845 if not self.verbose:
048e13546a7c Issue #15591: run ctypes' configure in quiet mode when setup.py runs silently
Christian Heimes <christian@cheimes.de>
parents: 78443
diff changeset
1846 config_args.append("-q")
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1847
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1848 # Pass empty CFLAGS because we'll just append the resulting
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1849 # CFLAGS to Python's; -g or -O2 is to be avoided.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1850 cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1851 % (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
1852
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1853 res = os.system(cmd)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1854 if res or not os.path.exists(ffi_configfile):
40774
793e0323d4d6 Essential changes for print function changes.
Guido van Rossum <guido@python.org>
parents: 40645
diff changeset
1855 print("Failed to configure _ctypes module")
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1856 return False
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1857
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1858 fficonfig = {}
58295
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1859 with open(ffi_configfile) as f:
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1860 exec(f.read(), globals(), fficonfig)
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1861
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1862 # Add .S (preprocessed assembly) to C compiler source extensions.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1863 self.compiler.src_extensions.append('.S')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1864
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1865 include_dirs = [os.path.join(ffi_builddir, 'include'),
58295
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1866 ffi_builddir,
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1867 os.path.join(ffi_srcdir, 'src')]
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1868 extra_compile_args = fficonfig['ffi_cflags'].split()
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1869
58295
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1870 ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
15b0668f0dc5 Note: I'm merging these changes out of consistency, but they don't seem
Antoine Pitrou <solipsis@pitrou.net>
parents: 58222
diff changeset
1871 fficonfig['ffi_sources'])
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1872 ext.include_dirs.extend(include_dirs)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1873 ext.extra_compile_args.extend(extra_compile_args)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1874 return True
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1875
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1876 def detect_ctypes(self, inc_dirs, lib_dirs):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1877 self.use_system_libffi = False
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1878 include_dirs = []
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1879 extra_compile_args = []
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1880 extra_link_args = []
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1881 sources = ['_ctypes/_ctypes.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1882 '_ctypes/callbacks.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1883 '_ctypes/callproc.c',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1884 '_ctypes/stgdict.c',
63832
40d11b8139da Fix issue5504: ctypes does now work with systems where mmap can't be
Thomas Heller <theller@ctypes.org>
parents: 63184
diff changeset
1885 '_ctypes/cfield.c']
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1886 depends = ['_ctypes/ctypes.h']
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1887
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1888 if host_platform == 'darwin':
64470
7e0d866ca871 Fix for issue9662, patch by Łukasz Langa in issue5504.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 64426
diff changeset
1889 sources.append('_ctypes/malloc_closure.c')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1890 sources.append('_ctypes/darwin/dlfcn_simple.c')
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1891 extra_compile_args.append('-DMACOSX')
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1892 include_dirs.append('_ctypes/darwin')
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1893 # XXX Is this still needed?
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1894 ## 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
1895
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1896 elif host_platform == 'sunos5':
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1897 # XXX This shouldn't be necessary; it appears that some
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1898 # of the assembler code is non-PIC (i.e. it has relocations
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1899 # when it shouldn't. The proper fix would be to rewrite
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1900 # the assembler code to be PIC.
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1901 # This only works with GCC; the Sun compiler likely refuses
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1902 # this option. If you want to compile ctypes with the Sun
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1903 # compiler, please research a proper solution, instead of
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1904 # finding some -z option for the Sun compiler.
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1905 extra_link_args.append('-mimpure-text')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1906
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1907 elif host_platform.startswith('hp-ux'):
47230
a218d5cb258b Merged revisions 63395-63396,63511,63522-63523 via svnmerge from
Thomas Heller <theller@ctypes.org>
parents: 46970
diff changeset
1908 extra_link_args.append('-fPIC')
a218d5cb258b Merged revisions 63395-63396,63511,63522-63523 via svnmerge from
Thomas Heller <theller@ctypes.org>
parents: 46970
diff changeset
1909
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1910 ext = Extension('_ctypes',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1911 include_dirs=include_dirs,
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1912 extra_compile_args=extra_compile_args,
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1913 extra_link_args=extra_link_args,
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1914 libraries=[],
36898
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1915 sources=sources,
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1916 depends=depends)
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1917 ext_test = Extension('_ctypes_test',
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1918 sources=['_ctypes/_ctypes_test.c'])
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1919 self.extensions.extend([ext, ext_test])
27905ebaddab Changes to build the _ctypes extension module.
Thomas Heller <theller@ctypes.org>
parents: 36817
diff changeset
1920
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1921 if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1922 return
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1923
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
1924 if host_platform == 'darwin':
45659
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1925 # OS X 10.5 comes with libffi.dylib; the include files are
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1926 # in /usr/include/ffi
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1927 inc_dirs.append('/usr/include/ffi')
dd318c3f6cb7 Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45134
diff changeset
1928
58068
b0dd6c21dcbf Merged revisions 77212-77215 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58025
diff changeset
1929 ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
60820
8e4247411754 Merged revisions 80320 via svnmerge from
Matthias Klose <doko@ubuntu.com>
parents: 60705
diff changeset
1930 if not ffi_inc or ffi_inc[0] == '':
58068
b0dd6c21dcbf Merged revisions 77212-77215 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 58025
diff changeset
1931 ffi_inc = find_file('ffi.h', [], inc_dirs)
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1932 if ffi_inc is not None:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1933 ffi_h = ffi_inc[0] + '/ffi.h'
65724
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1934 with open(ffi_h) as fp:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1935 while 1:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1936 line = fp.readline()
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1937 if not line:
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1938 ffi_inc = None
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1939 break
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1940 if line.startswith('#define LIBFFI_H'):
a0626f9727e0 Make file handing in setup.py more robust by using context managers to properly
Brett Cannon <bcannon@gmail.com>
parents: 65557
diff changeset
1941 break
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1942 ffi_lib = None
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1943 if ffi_inc is not None:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1944 for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1945 if (self.compiler.find_library_file(lib_dirs, lib_name)):
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1946 ffi_lib = lib_name
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1947 break
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1948
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1949 if ffi_inc and ffi_lib:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1950 ext.include_dirs.extend(ffi_inc)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1951 ext.libraries.append(ffi_lib)
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1952 self.use_system_libffi = True
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
1953
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
1954 def _decimal_ext(self):
75909
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1955 extra_compile_args = []
78828
259450a161ef Compile _decimal without asserts and update benchmark results.
Stefan Krah <skrah@bytereef.org>
parents: 78462
diff changeset
1956 undef_macros = []
75909
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1957 if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1958 include_dirs = []
87517
cbd78679080b 1) Prepare libmpdec for the 2.4.0 release. None of the following changes affects
Stefan Krah <skrah@bytereef.org>
parents: 86615
diff changeset
1959 libraries = [':libmpdec.so.2']
75909
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1960 sources = ['_decimal/_decimal.c']
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1961 depends = ['_decimal/docstrings.h']
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1962 else:
76040
ac60138522fc Issue #14463: Prevent _decimal.so compile failures in OS X installer builds.
Ned Deily <nad@acm.org>
parents: 75909
diff changeset
1963 srcdir = sysconfig.get_config_var('srcdir')
ac60138522fc Issue #14463: Prevent _decimal.so compile failures in OS X installer builds.
Ned Deily <nad@acm.org>
parents: 75909
diff changeset
1964 include_dirs = [os.path.abspath(os.path.join(srcdir,
ac60138522fc Issue #14463: Prevent _decimal.so compile failures in OS X installer builds.
Ned Deily <nad@acm.org>
parents: 75909
diff changeset
1965 'Modules',
ac60138522fc Issue #14463: Prevent _decimal.so compile failures in OS X installer builds.
Ned Deily <nad@acm.org>
parents: 75909
diff changeset
1966 '_decimal',
ac60138522fc Issue #14463: Prevent _decimal.so compile failures in OS X installer builds.
Ned Deily <nad@acm.org>
parents: 75909
diff changeset
1967 'libmpdec'))]
75909
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1968 libraries = []
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1969 sources = [
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1970 '_decimal/_decimal.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1971 '_decimal/libmpdec/basearith.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1972 '_decimal/libmpdec/constants.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1973 '_decimal/libmpdec/context.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1974 '_decimal/libmpdec/convolute.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1975 '_decimal/libmpdec/crt.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1976 '_decimal/libmpdec/difradix2.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1977 '_decimal/libmpdec/fnt.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1978 '_decimal/libmpdec/fourstep.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1979 '_decimal/libmpdec/io.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1980 '_decimal/libmpdec/memory.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1981 '_decimal/libmpdec/mpdecimal.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1982 '_decimal/libmpdec/numbertheory.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1983 '_decimal/libmpdec/sixstep.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1984 '_decimal/libmpdec/transpose.c',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1985 ]
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1986 depends = [
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1987 '_decimal/docstrings.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1988 '_decimal/libmpdec/basearith.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1989 '_decimal/libmpdec/bits.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1990 '_decimal/libmpdec/constants.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1991 '_decimal/libmpdec/convolute.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1992 '_decimal/libmpdec/crt.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1993 '_decimal/libmpdec/difradix2.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1994 '_decimal/libmpdec/fnt.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1995 '_decimal/libmpdec/fourstep.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1996 '_decimal/libmpdec/io.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1997 '_decimal/libmpdec/memory.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1998 '_decimal/libmpdec/mpdecimal.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
1999 '_decimal/libmpdec/numbertheory.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2000 '_decimal/libmpdec/sixstep.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2001 '_decimal/libmpdec/transpose.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2002 '_decimal/libmpdec/typearith.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2003 '_decimal/libmpdec/umodarith.h',
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2004 ]
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2005
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2006 config = {
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2007 'x64': [('CONFIG_64','1'), ('ASM','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2008 'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2009 'ansi64': [('CONFIG_64','1'), ('ANSI','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2010 'ppro': [('CONFIG_32','1'), ('PPRO','1'), ('ASM','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2011 'ansi32': [('CONFIG_32','1'), ('ANSI','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2012 'ansi-legacy': [('CONFIG_32','1'), ('ANSI','1'),
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2013 ('LEGACY_COMPILER','1')],
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2014 'universal': [('UNIVERSAL','1')]
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2015 }
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2016
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2017 cc = sysconfig.get_config_var('CC')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2018 sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2019 machine = os.environ.get('PYTHON_DECIMAL_WITH_MACHINE')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2020
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2021 if machine:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2022 # Override automatic configuration to facilitate testing.
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2023 define_macros = config[machine]
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
2024 elif host_platform == 'darwin':
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2025 # Universal here means: build with the same options Python
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2026 # was built with.
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2027 define_macros = config['universal']
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2028 elif sizeof_size_t == 8:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2029 if sysconfig.get_config_var('HAVE_GCC_ASM_FOR_X64'):
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2030 define_macros = config['x64']
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2031 elif sysconfig.get_config_var('HAVE_GCC_UINT128_T'):
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2032 define_macros = config['uint128']
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2033 else:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2034 define_macros = config['ansi64']
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2035 elif sizeof_size_t == 4:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2036 ppro = sysconfig.get_config_var('HAVE_GCC_ASM_FOR_X87')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2037 if ppro and ('gcc' in cc or 'clang' in cc) and \
77867
56c574a1819a - Issue #3754, refactor sys.platform / get_platform bits, use a
doko@ubuntu.com
parents: 77665
diff changeset
2038 not 'sunos' in host_platform:
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2039 # solaris: problems with register allocation.
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2040 # icc >= 11.0 works as well.
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2041 define_macros = config['ppro']
79340
5cfe8af7abb2 Suppress unknown pragma warning (STDC FENV_ACCESS).
Stefan Krah <skrah@bytereef.org>
parents: 79082
diff changeset
2042 extra_compile_args.append('-Wno-unknown-pragmas')
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2043 else:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2044 define_macros = config['ansi32']
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2045 else:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2046 raise DistutilsError("_decimal: unsupported architecture")
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2047
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2048 # Workarounds for toolchain bugs:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2049 if sysconfig.get_config_var('HAVE_IPA_PURE_CONST_BUG'):
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2050 # Some versions of gcc miscompile inline asm:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2051 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2052 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2053 extra_compile_args.append('-fno-ipa-pure-const')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2054 if sysconfig.get_config_var('HAVE_GLIBC_MEMMOVE_BUG'):
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2055 # _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2056 # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2057 undef_macros.append('_FORTIFY_SOURCE')
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2058
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2059 # Faster version without thread local contexts:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2060 if not sysconfig.get_config_var('WITH_THREAD'):
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2061 define_macros.append(('WITHOUT_THREADS', 1))
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2062
81542
5a729c08872a Increase warning level for _decimal.so and libmpdec build when using gcc.
Stefan Krah <skrah@bytereef.org>
parents: 80830
diff changeset
2063 # Increase warning level for gcc:
5a729c08872a Increase warning level for _decimal.so and libmpdec build when using gcc.
Stefan Krah <skrah@bytereef.org>
parents: 80830
diff changeset
2064 if 'gcc' in cc:
82519
33208a574875 Issue #17361: Use cc from sysconfig for testing flags.
Stefan Krah <skrah@bytereef.org>
parents: 82345
diff changeset
2065 cmd = ("echo '' | %s -Wextra -Wno-missing-field-initializers -E - "
33208a574875 Issue #17361: Use cc from sysconfig for testing flags.
Stefan Krah <skrah@bytereef.org>
parents: 82345
diff changeset
2066 "> /dev/null 2>&1" % cc)
81554
d536f34759f5 Fix build with 3.x gcc versions.
Stefan Krah <skrah@bytereef.org>
parents: 81542
diff changeset
2067 ret = os.system(cmd)
d536f34759f5 Fix build with 3.x gcc versions.
Stefan Krah <skrah@bytereef.org>
parents: 81542
diff changeset
2068 if ret >> 8 == 0:
d536f34759f5 Fix build with 3.x gcc versions.
Stefan Krah <skrah@bytereef.org>
parents: 81542
diff changeset
2069 extra_compile_args.extend(['-Wextra',
d536f34759f5 Fix build with 3.x gcc versions.
Stefan Krah <skrah@bytereef.org>
parents: 81542
diff changeset
2070 '-Wno-missing-field-initializers'])
81542
5a729c08872a Increase warning level for _decimal.so and libmpdec build when using gcc.
Stefan Krah <skrah@bytereef.org>
parents: 80830
diff changeset
2071
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2072 # Uncomment for extra functionality:
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2073 #define_macros.append(('EXTRA_FUNCTIONALITY', 1))
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2074 ext = Extension (
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2075 '_decimal',
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2076 include_dirs=include_dirs,
75909
f6d646e30028 Issue #7652: Enable linking of _decimal.so against an installed libmpdec.
Stefan Krah <skrah@bytereef.org>
parents: 75850
diff changeset
2077 libraries=libraries,
75850
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2078 define_macros=define_macros,
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2079 undef_macros=undef_macros,
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2080 extra_compile_args=extra_compile_args,
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2081 sources=sources,
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2082 depends=depends
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2083 )
7355550d5357 Issue #7652: Integrate the decimal floating point libmpdec library to speed
Stefan Krah <skrah@bytereef.org>
parents: 75590
diff changeset
2084 return ext
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents: 36898
diff changeset
2085
17886
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
2086 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
2087 # 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
2088 # 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
2089 # installation:
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
2090 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
2091 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
2092 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
2093
70731
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2094 # Customize subcommands to not install an egg-info file for Python
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2095 sub_commands = [('install_lib', install.has_lib),
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2096 ('install_headers', install.has_headers),
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2097 ('install_scripts', install.has_scripts),
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2098 ('install_data', install.has_data)]
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2099
e3f6c10eb590 Stop creating a Python-X.Y.Z-pyX.Y.egg-info file on install (#10645)
Éric Araujo <merwok@netwok.org>
parents: 70694
diff changeset
2100
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2101 class PyBuildInstallLib(install_lib):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2102 # 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
2103 # 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
2104 # 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
2105 # 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
2106
82869
8f91014c8f00 - Issue #16754: Fix the incorrect shared library extension on linux. Introduce
doko@ubuntu.com
parents: 82344
diff changeset
2107 # this is works for EXT_SUFFIX too, which ends with SHLIB_SUFFIX
8f91014c8f00 - Issue #16754: Fix the incorrect shared library extension on linux. Introduce
doko@ubuntu.com
parents: 82344
diff changeset
2108 shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX")
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2109
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2110 def install(self):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2111 outfiles = install_lib.install(self)
42084
229c28cb9afb Merged revisions 55817-55961 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41969
diff changeset
2112 self.set_file_modes(outfiles, 0o644, 0o755)
229c28cb9afb Merged revisions 55817-55961 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 41969
diff changeset
2113 self.set_dir_modes(self.install_dir, 0o755)
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2114 return outfiles
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_file_modes(self, files, defaultMode, sharedLibMode):
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 if not files: return
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 for filename in files:
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2121 if os.path.islink(filename): continue
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2122 mode = defaultMode
82869
8f91014c8f00 - Issue #16754: Fix the incorrect shared library extension on linux. Introduce
doko@ubuntu.com
parents: 82344
diff changeset
2123 if filename.endswith(self.shlib_suffix): mode = sharedLibMode
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2124 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
2125 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
2126
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2127 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
2128 if not self.is_chmod_supported(): return
55065
56a276396e15 Merged revisions 73788 via svnmerge from
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54285
diff changeset
2129 for dirpath, dirnames, fnames in os.walk(dirname):
56a276396e15 Merged revisions 73788 via svnmerge from
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54285
diff changeset
2130 if os.path.islink(dirpath):
56a276396e15 Merged revisions 73788 via svnmerge from
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54285
diff changeset
2131 continue
56a276396e15 Merged revisions 73788 via svnmerge from
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54285
diff changeset
2132 log.info("changing mode of %s to %o", dirpath, mode)
56a276396e15 Merged revisions 73788 via svnmerge from
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 54285
diff changeset
2133 if not self.dry_run: os.chmod(dirpath, mode)
26687
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2134
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2135 def is_chmod_supported(self):
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2136 return hasattr(os, 'chmod')
6b390548c698 This is J. Lewis Muir's patch:
Michael W. Hudson <mwh@python.net>
parents: 26674
diff changeset
2137
67169
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2138 class PyBuildScripts(build_scripts):
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2139 def copy_scripts(self):
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2140 outfiles, updated_files = build_scripts.copy_scripts(self)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2141 fullversion = '-{0[0]}.{0[1]}'.format(sys.version_info)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2142 minoronly = '.{0[1]}'.format(sys.version_info)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2143 newoutfiles = []
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2144 newupdated_files = []
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2145 for filename in outfiles:
77154
294f8aeb4d4b Implemented PEP 405 (Python virtual environments).
Vinay Sajip <vinay_sajip@yahoo.co.uk>
parents: 76999
diff changeset
2146 if filename.endswith(('2to3', 'pyvenv')):
67169
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2147 newfilename = filename + fullversion
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2148 else:
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2149 newfilename = filename + minoronly
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2150 log.info('renaming {} to {}'.format(filename, newfilename))
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2151 os.rename(filename, newfilename)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2152 newoutfiles.append(newfilename)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2153 if filename in updated_files:
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2154 newupdated_files.append(newfilename)
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2155 return newoutfiles, newupdated_files
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2156
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2157 SUMMARY = """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2158 Python is an interpreted, interactive, object-oriented programming
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2159 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
2160
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2161 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
2162 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
2163 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
2164 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
2165 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
2166 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
2167 programmable interface.
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2168
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2169 The Python implementation is portable: it runs on many brands of UNIX,
79479
d853354e1470 #16135: Removal of OS/2 support (Remove OS2 and OS/2 references)
Jesus Cea <jcea@jcea.es>
parents: 79340
diff changeset
2170 on Windows, DOS, Mac, Amiga... If your favorite system isn't
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2171 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
2172 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
2173 yourself.
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2174 """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2175
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2176 CLASSIFIERS = """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2177 Development Status :: 6 - Mature
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2178 License :: OSI Approved :: Python Software Foundation License
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2179 Natural Language :: English
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2180 Programming Language :: C
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2181 Programming Language :: Python
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2182 Topic :: Software Development
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2183 """
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2184
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2185 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
2186 # 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
2187 import warnings
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
2188 warnings.filterwarnings("ignore",category=DeprecationWarning)
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2189 setup(# PyPI Metadata (PEP 301)
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2190 name = "Python",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2191 version = sys.version.split()[0],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2192 url = "http://www.python.org/%s" % sys.version[:3],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2193 maintainer = "Guido van Rossum and the Python community",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2194 maintainer_email = "python-dev@python.org",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2195 description = "A high-level object-oriented programming language",
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2196 long_description = SUMMARY.strip(),
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2197 license = "PSF license",
42142
a53e48be6df9 Merged revisions 56125-56153 via svnmerge from
Guido van Rossum <guido@python.org>
parents: 42084
diff changeset
2198 classifiers = [x for x in CLASSIFIERS.split("\n") if x],
27990
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2199 platforms = ["Many"],
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2200
0b3db0edb151 Add PEP 301 metadata.
Guido van Rossum <guido@python.org>
parents: 27989
diff changeset
2201 # Build info
67169
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2202 cmdclass = {'build_ext': PyBuildExt,
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2203 'build_scripts': PyBuildScripts,
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2204 'install': PyBuildInstall,
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2205 'install_lib': PyBuildInstallLib},
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2206 # 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
2207 # called unless there's at least one extension module defined.
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 37879
diff changeset
2208 ext_modules=[Extension('_struct', ['_struct.c'])],
16844
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
2209
67169
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2210 # If you change the scripts installed here, you also need to
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2211 # check the PyBuildScripts command above, and change the links
e0c52c0e8586 #10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
Georg Brandl <georg@python.org>
parents: 66724
diff changeset
2212 # created by the bininstall target in Makefile.pre.in
54285
997ef68bfa15 install 2to3, overwritting any old installations #5756
Benjamin Peterson <benjamin@python.org>
parents: 54280
diff changeset
2213 scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
77665
576b8b182039 Remove packaging from the standard library.
Éric Araujo <merwok@netwok.org>
parents: 77529
diff changeset
2214 "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2215 )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
2216
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2217 # --install-platlib
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2218 if __name__ == '__main__':
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
2219 main()