annotate setup.py @ 23867:45d676933882 legacy-trunk

This introduces stricter library/header file checking for the Berkeley DB library. Since multiple versions can be installed simultaneously, it's crucial that you only select libraries and header files which are compatible with each other. Version checking is done from highest version to lowest. Building using version 1 of Berkeley DB is disabled by default because of the hash file bugs people keep rediscovering. It can be enabled by uncommenting a few lines in setup.py. Closes patch 553108.
author Skip Montanaro <skip@pobox.com>
date Fri, 14 Jun 2002 20:30:31 +0000
parents 9f0009ca97b9
children 41ab532d4f60
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16287
4b72888c9e2f Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents: 16283
diff changeset
1 # Autodetecting setup.py script for building the Python extensions
4b72888c9e2f Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents: 16283
diff changeset
2 #
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
3
16287
4b72888c9e2f Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents: 16283
diff changeset
4 __version__ = "$Revision$"
4b72888c9e2f Remove unused import of 'string'
Andrew M. Kuchling <amk@amk.ca>
parents: 16283
diff changeset
5
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
6 import sys, os, getopt, imp
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
7 from distutils import sysconfig
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
8 from distutils import text_file
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
9 from distutils.errors import *
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
10 from distutils.core import Extension, setup
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
11 from distutils.command.build_ext import build_ext
17886
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
12 from distutils.command.install import install
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
13
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
14 # 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
15 disabled_module_list = []
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
16
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
17 def add_dir_to_list(dirlist, dir):
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
18 """Add the directory 'dir' to the list 'dirlist' (at the front) if
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
19 1) 'dir' is not already in 'dirlist'
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
20 2) 'dir' actually exists, and is a directory."""
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
21 if os.path.isdir(dir) and dir not in dirlist:
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
22 dirlist.insert(0, dir)
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
23
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
24 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
25 """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
26 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
27 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
28
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
29 '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
30 '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
31 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
32 '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
33 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
34 """
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
35
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
36 # 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
37 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
38 f = os.path.join(dir, filename)
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
39 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
40
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
41 # 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
42 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
43 f = os.path.join(dir, filename)
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
44 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
45 return [dir]
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
46
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
47 # Not found anywhere
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
48 return None
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
49
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
50 def find_library_file(compiler, libname, std_dirs, paths):
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
51 filename = compiler.library_filename(libname, lib_type='shared')
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
52 result = find_file(filename, std_dirs, paths)
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
53 if result is not None: return result
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
54
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
55 filename = compiler.library_filename(libname, lib_type='static')
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
56 result = find_file(filename, std_dirs, paths)
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
57 return result
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
58
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
59 def module_enabled(extlist, modname):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
60 """Returns whether the module 'modname' is present in the list
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
61 of extensions 'extlist'."""
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
62 extlist = [ext for ext in extlist if ext.name == modname]
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
63 return len(extlist)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
64
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
65 def find_module_file(module, dirlist):
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
66 """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
67 return the unadorned filename"""
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
68 list = find_file(module, [], dirlist)
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
69 if not list:
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
70 return module
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
71 if len(list) > 1:
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
72 self.announce("WARNING: multiple copies of %s found"%module)
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
73 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
74
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
75 class PyBuildExt(build_ext):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
76
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
77 def build_extensions(self):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
78
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
79 # Detect which modules should be compiled
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
80 self.detect_modules()
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
81
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
82 # Remove modules that are present on the disabled list
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
83 self.extensions = [ext for ext in self.extensions
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
84 if ext.name not in disabled_module_list]
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
85
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
86 # Fix up the autodetected modules, prefixing all the source files
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
87 # with Modules/ and adding Python's include directory to the path.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
88 (srcdir,) = sysconfig.get_config_vars('srcdir')
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
89
16225
e56dd2dd9960 Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 16201
diff changeset
90 # Figure out the location of the source code for extension modules
e56dd2dd9960 Patch from Andrew to properly set module source directory.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 16201
diff changeset
91 moddir = os.path.join(os.getcwd(), srcdir, 'Modules')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
92 moddir = os.path.normpath(moddir)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
93 srcdir, tail = os.path.split(moddir)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
94 srcdir = os.path.normpath(srcdir)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
95 moddir = os.path.normpath(moddir)
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
96
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
97 moddirlist = [moddir]
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
98 incdirlist = ['./Include']
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
99
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
100 # Platform-dependent module source and include directories
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
101 platform = self.get_platform()
21233
803ccbe3ee7c As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21039
diff changeset
102 if platform == 'darwin':
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
103 # Mac OS X also includes some mac-specific modules
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
104 macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules')
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
105 moddirlist.append(macmoddir)
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
106 incdirlist.append('./Mac/Include')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
107
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
108 alldirlist = moddirlist + incdirlist
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
109
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
110 # 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
111 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
112 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
113
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
114 for ext in self.extensions[:]:
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
115 ext.sources = [ find_module_file(filename, moddirlist)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
116 for filename in ext.sources ]
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
117 if ext.depends is not None:
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
118 ext.depends = [find_module_file(filename, alldirlist)
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
119 for filename in ext.depends]
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
120 ext.include_dirs.append( '.' ) # to get config.h
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
121 for incdir in incdirlist:
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
122 ext.include_dirs.append( os.path.join(srcdir, incdir) )
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
123
16038
b6863ba88989 GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents: 16013
diff changeset
124 # 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
125 # 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
126 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
127 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
128
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
129 # Parse Modules/Setup to figure out which modules are turned
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
130 # on in the file.
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
131 input = text_file.TextFile('Modules/Setup', join_lines=1)
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
132 remove_modules = []
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
133 while 1:
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
134 line = input.readline()
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
135 if not line: break
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
136 line = line.split()
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
137 remove_modules.append( line[0] )
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
138 input.close()
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
139
16750
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
140 for ext in self.extensions[:]:
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
141 if ext.name in remove_modules:
90e90c92198b Patch #103899: Don't compile modules configured in Setup. This seems much
Andrew M. Kuchling <amk@amk.ca>
parents: 16749
diff changeset
142 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
143
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
144 # 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
145 # 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
146 # 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
147 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
148 linker_so = os.environ.get('LDSHARED')
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
149 args = {}
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
150 # 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
151 # compilers
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
152 if compiler is not None:
19122
6729bf30d3ae Get OPT from the environment to build the CCSHARED command.
Martin v. Löwis <martin@v.loewis.de>
parents: 19049
diff changeset
153 (ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT')
6729bf30d3ae Get OPT from the environment to build the CCSHARED command.
Martin v. Löwis <martin@v.loewis.de>
parents: 19049
diff changeset
154 args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
155 if linker_so is not None:
20313
ea1910d2c781 Do not add -shared to linker_so. Any necessary options should already be
Martin v. Löwis <martin@v.loewis.de>
parents: 20234
diff changeset
156 args['linker_so'] = linker_so
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
157 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
158
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
159 build_ext.build_extensions(self)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
160
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
161 def build_extension(self, ext):
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
162
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
163 try:
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
164 build_ext.build_extension(self, ext)
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
165 except (CCompilerError, DistutilsError), why:
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
166 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
167 (ext.name, sys.exc_info()[1]))
17890
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
168 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
169 # 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
170 # 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
171 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
172 self.announce(
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
173 '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
174 ext.name)
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
175 return
23513
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
176 # 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
177 # modules have been imported
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
178 if self.get_platform() == 'cygwin':
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
179 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
180 % ext.name)
35f01bf34d60 Patch #491107: Cygwin setup.py import workaround patch
Jason Tishler <jason@tishler.net>
parents: 22805
diff changeset
181 return
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
182 ext_filename = os.path.join(
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
183 self.build_lib,
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
184 self.get_ext_filename(self.get_ext_fullname(ext.name)))
17890
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
185 try:
21788
05fabd8f4e7f Fix for
Michael W. Hudson <mwh@python.net>
parents: 21787
diff changeset
186 imp.load_dynamic(ext.name, ext_filename)
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
187 except ImportError, why:
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
188
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
189 if 1:
22104
cd0ce470c153 Changes to what we do to modules that don't import, as
Michael W. Hudson <mwh@python.net>
parents: 21959
diff changeset
190 self.announce('*** WARNING: renaming "%s" since importing it'
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
191 ' failed: %s' % (ext.name, why))
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
192 assert not self.inplace
22104
cd0ce470c153 Changes to what we do to modules that don't import, as
Michael W. Hudson <mwh@python.net>
parents: 21959
diff changeset
193 basename, tail = os.path.splitext(ext_filename)
cd0ce470c153 Changes to what we do to modules that don't import, as
Michael W. Hudson <mwh@python.net>
parents: 21959
diff changeset
194 newname = basename + "_failed" + tail
cd0ce470c153 Changes to what we do to modules that don't import, as
Michael W. Hudson <mwh@python.net>
parents: 21959
diff changeset
195 if os.path.exists(newname): os.remove(newname)
cd0ce470c153 Changes to what we do to modules that don't import, as
Michael W. Hudson <mwh@python.net>
parents: 21959
diff changeset
196 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
197
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
198 # XXX -- This relies on a Vile HACK in
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
199 # distutils.command.build_ext.build_extension(). The
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
200 # _built_objects attribute is stored there strictly for
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
201 # use here.
22545
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
202 # If there is a failure, _built_objects may not be there,
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
203 # so catch the AttributeError and move on.
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
204 try:
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
205 for filename in self._built_objects:
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
206 os.remove(filename)
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
207 except AttributeError:
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
208 self.announce('unable to remove files (ignored)')
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
209 else:
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
210 self.announce('*** WARNING: importing extension "%s" '
3957d155f8c5 Break SSL support out of _socket module and place it into a new
Marc-André Lemburg <mal@egenix.com>
parents: 21942
diff changeset
211 'failed: %s' % (ext.name, why))
21277
f702ff390e4d Visious hackery to solve a build-control problem related to our use of
Fred Drake <fdrake@acm.org>
parents: 21274
diff changeset
212
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
213 def get_platform (self):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
214 # Get value of sys.platform
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
215 platform = sys.platform
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
216 if platform[:6] =='cygwin':
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
217 platform = 'cygwin'
16471
ab02bc6a5ab2 BeOS doesn't have a libm.a, either; noted by Donn Cave
Andrew M. Kuchling <amk@amk.ca>
parents: 16468
diff changeset
218 elif platform[:4] =='beos':
ab02bc6a5ab2 BeOS doesn't have a libm.a, either; noted by Donn Cave
Andrew M. Kuchling <amk@amk.ca>
parents: 16468
diff changeset
219 platform = 'beos'
21233
803ccbe3ee7c As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21039
diff changeset
220 elif platform[:6] == 'darwin':
803ccbe3ee7c As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21039
diff changeset
221 platform = 'darwin'
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
222 elif platform[:6] == 'atheos':
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
223 platform = 'atheos'
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
224
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
225 return platform
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
226
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
227 def detect_modules(self):
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
228 # Ensure that /usr/local is always used
21742
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
229 add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
230 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
231
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
232 add_dir_to_list(self.compiler.library_dirs,
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
233 sysconfig.get_config_var("LIBDIR"))
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
234 add_dir_to_list(self.compiler.include_dirs,
9d5adff87f30 Apply a variant of patch
Michael W. Hudson <mwh@python.net>
parents: 21610
diff changeset
235 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
236
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
237 try:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
238 have_unicode = unicode
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
239 except NameError:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
240 have_unicode = 0
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
241
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
242 # 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
243 # 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
244 # be assumed that no additional -I,-L directives are needed.
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
245 lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
246 inc_dirs = self.compiler.include_dirs + ['/usr/include']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
247 exts = []
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
248
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
249 platform = self.get_platform()
21942
9d44e752d617 Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents: 21939
diff changeset
250 (srcdir,) = sysconfig.get_config_vars('srcdir')
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
251
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
252 # Check for AtheOS which has libraries in non-standard locations
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
253 if platform == 'atheos':
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
254 lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
255 lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
256 inc_dirs += ['/system/include', '/atheos/autolnk/include']
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
257 inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
258
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
259 # 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
260 math_libs = ['m']
21233
803ccbe3ee7c As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21039
diff changeset
261 if platform in ['darwin', 'beos']:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
262 math_libs = []
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
263
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
264 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
265
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
266 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
267 # The following modules are all pretty straightforward, and compile
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
268 # on pretty much any POSIXish platform.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
269 #
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
270
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
271 # Some modules that are normally always on:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
272 exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
273 exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
274
20397
9fe97548d952 Add entry for HotShot.
Fred Drake <fdrake@acm.org>
parents: 20313
diff changeset
275 exts.append( Extension('_hotshot', ['_hotshot.c']) )
16384
c898ceba2261 Add entries for the weakref module to the build control.
Fred Drake <fdrake@acm.org>
parents: 16287
diff changeset
276 exts.append( Extension('_weakref', ['_weakref.c']) )
15951
db26b43c924f Various clean-ups:
Andrew M. Kuchling <amk@amk.ca>
parents: 15940
diff changeset
277 exts.append( Extension('xreadlines', ['xreadlinesmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
278
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
279 # array objects
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
280 exts.append( Extension('array', ['arraymodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
281 # complex math library functions
16176
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
282 exts.append( Extension('cmath', ['cmathmodule.c'],
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
283 libraries=math_libs) )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
284
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
285 # math library functions, e.g. sin()
16176
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
286 exts.append( Extension('math', ['mathmodule.c'],
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
287 libraries=math_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
288 # fast string operations implemented in C
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
289 exts.append( Extension('strop', ['stropmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
290 # time operations and variables
16176
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
291 exts.append( Extension('time', ['timemodule.c'],
2dcbc1dfca9c Fix for MacOS X/Darwin: it doesn't need -lm, ever. (Noted by Steven Majewski)
Andrew M. Kuchling <amk@amk.ca>
parents: 16100
diff changeset
292 libraries=math_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
293 # operator.add() and similar goodies
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
294 exts.append( Extension('operator', ['operator.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
295 # access to the builtin codecs and codec registry
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
296 exts.append( Extension('_codecs', ['_codecsmodule.c']) )
16416
7d39d9dcf2d6 Whitespace correction...
Marc-André Lemburg <mal@egenix.com>
parents: 16415
diff changeset
297 # Python C API test module
16447
ac52d3727867 Renamed _testXXX to _testcapiXXX. Jack is my hero -- good call!
Tim Peters <tim.peters@gmail.com>
parents: 16422
diff changeset
298 exts.append( Extension('_testcapi', ['_testcapimodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
299 # static Unicode character database
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
300 if have_unicode:
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 19319
diff changeset
301 exts.append( Extension('unicodedata', ['unicodedata.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
302 # access to ISO C locale support
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
303 exts.append( Extension('_locale', ['_localemodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
304
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
305 # Modules with some UNIX dependencies -- on by default:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
306 # (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
307 # supported...)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
308
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
309 # fcntl(2) and ioctl(2)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
310 exts.append( Extension('fcntl', ['fcntlmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
311 # pwd(3)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
312 exts.append( Extension('pwd', ['pwdmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
313 # grp(3)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
314 exts.append( Extension('grp', ['grpmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
315 # posix (UNIX) errno values
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
316 exts.append( Extension('errno', ['errnomodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
317 # select(2); not on ancient System V
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
318 exts.append( Extension('select', ['selectmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
319
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
320 # The md5 module implements the RSA Data Security, Inc. MD5
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
321 # Message-Digest Algorithm, described in RFC 1321. The
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
322 # necessary files md5c.c and md5.h are included here.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
323 exts.append( Extension('md5', ['md5module.c', 'md5c.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
324
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
325 # The sha module implements the SHA checksum algorithm.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
326 # (NIST's Secure Hash Algorithm.)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
327 exts.append( Extension('sha', ['shamodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
328
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
329 # Helper module for various ascii-encoders
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
330 exts.append( Extension('binascii', ['binascii.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
331
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
332 # Fred Drake's interface to the Python parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
333 exts.append( Extension('parser', ['parsermodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
334
22805
f1af8ad11000 Removed old Digital Creations copyright/license notices (with
Guido van Rossum <guido@python.org>
parents: 22545
diff changeset
335 # cStringIO and cPickle
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
336 exts.append( Extension('cStringIO', ['cStringIO.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
337 exts.append( Extension('cPickle', ['cPickle.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
338
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
339 # Memory-mapped files (also works on Win32).
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
340 if platform not in ['atheos']:
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
341 exts.append( Extension('mmap', ['mmapmodule.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
342
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
343 # Lance Ellinghaus's modules:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
344 # enigma-inspired encryption
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
345 exts.append( Extension('rotor', ['rotormodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
346 # syslog daemon interface
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
347 exts.append( Extension('syslog', ['syslogmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
348
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
349 # George Neville-Neil's timing module:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
350 exts.append( Extension('timing', ['timingmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
351
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
352 #
15998
f390f43ac4b6 Patch from Barry: gets rid of two unused imports,
Andrew M. Kuchling <amk@amk.ca>
parents: 15996
diff changeset
353 # 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
354 # libraries, are platform-specific, or present other surprises.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
355 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
356
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
357 # Multimedia modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
358 # These don't work for 64-bit platforms!!!
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
359 # These represent audio samples or images as strings:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
360
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
361 # Disabled on 64-bit platforms
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
362 if sys.maxint != 9223372036854775807L:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
363 # Operations on audio samples
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
364 exts.append( Extension('audioop', ['audioop.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
365 # Operations on images
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
366 exts.append( Extension('imageop', ['imageop.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
367 # Read SGI RGB image files (but coded portably)
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
368 exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
369
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
370 # readline
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
371 if self.compiler.find_library_file(lib_dirs, 'readline'):
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
372 readline_libs = ['readline']
19319
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
373 if self.compiler.find_library_file(lib_dirs,
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
374 'ncurses'):
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
375 readline_libs.append('ncurses')
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
376 elif self.compiler.find_library_file(lib_dirs +
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
377 ['/usr/lib/termcap'],
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
378 'termcap'):
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
379 readline_libs.append('termcap')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
380 exts.append( Extension('readline', ['readline.c'],
16282
ea4a2f3b266e Fixed setup.py to allow:
Marc-André Lemburg <mal@egenix.com>
parents: 16225
diff changeset
381 library_dirs=['/usr/lib/termcap'],
16283
65c6a2998b1b Be extra careful with linking against libtermcap. This is now only done
Marc-André Lemburg <mal@egenix.com>
parents: 16282
diff changeset
382 libraries=readline_libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
383
19319
d370a58fb7fd Link readline module with ncurses in preference to termcap. [Bug ##441580]
Andrew M. Kuchling <amk@amk.ca>
parents: 19269
diff changeset
384 # crypt module.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
385
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
386 if self.compiler.find_library_file(lib_dirs, 'crypt'):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
387 libs = ['crypt']
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
388 else:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
389 libs = []
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
390 exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
391
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
392 # socket(2)
23811
e3e019bc4e1e Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents: 23777
diff changeset
393 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
394 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
395 # Detect SSL support for the socket module (via _ssl)
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
396 ssl_incs = find_file('openssl/ssl.h', inc_dirs,
16038
b6863ba88989 GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents: 16013
diff changeset
397 ['/usr/local/ssl/include',
b6863ba88989 GvR pointed out the correct way to check for statically built modules;
Andrew M. Kuchling <amk@amk.ca>
parents: 16013
diff changeset
398 '/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
399 ]
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
400 )
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
401 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
402 ['/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
403 '/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
404 ] )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
405
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
406 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
407 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
408 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
409 include_dirs = ssl_incs,
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
410 library_dirs = ssl_libs,
23811
e3e019bc4e1e Add dependencies on socketmodule.h.
Guido van Rossum <guido@python.org>
parents: 23777
diff changeset
411 libraries = ['ssl', 'crypto'],
23825
9f0009ca97b9 Munge depends files to have absolute paths.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23816
diff changeset
412 depends = ['socketmodule.h']), )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
413
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
414 # Modules that provide persistent dictionary-like semantics. You will
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
415 # 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
416 # your machine, though none are defined by default because of library
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
417 # dependencies. The Python module anydbm.py provides an
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
418 # implementation independent wrapper for these; dumbdbm.py provides
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
419 # similar functionality (but slower of course) implemented in Python.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
420
23867
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
421 # Berkeley DB interface.
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
422 #
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
423 # This requires the Berkeley DB code, see
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
424 # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
425 #
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
426 # (See http://pybsddb.sourceforge.net/ for an interface to
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
427 # Berkeley DB 3.x.)
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
428
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
429 # when sorted in reverse order, keys for this dict must appear in the
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
430 # order you wish to search - e.g., search for db3 before db2, db2
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
431 # before db1
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
432 db_try_this = {
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
433 'db4': {'libs': ('db-4.3', 'db-4.2', 'db-4.1', 'db-4.0'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
434 'libdirs': ('/usr/local/BerkeleyDB.4.3/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
435 '/usr/local/BerkeleyDB.4.2/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
436 '/usr/local/BerkeleyDB.4.1/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
437 '/usr/local/BerkeleyDB.4.0/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
438 '/usr/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
439 '/opt/sfw',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
440 '/sw/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
441 '/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
442 ),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
443 'incdirs': ('/usr/local/BerkeleyDB.4.3/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
444 '/usr/local/BerkeleyDB.4.2/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
445 '/usr/local/BerkeleyDB.4.1/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
446 '/usr/local/BerkeleyDB.4.0/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
447 '/usr/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
448 '/opt/sfw/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
449 '/sw/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
450 '/usr/local/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
451 ),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
452 'incs': ('db_185.h',)},
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
453 'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db-3.0'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
454 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
455 '/usr/local/BerkeleyDB.3.2/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
456 '/usr/local/BerkeleyDB.3.1/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
457 '/usr/local/BerkeleyDB.3.0/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
458 '/usr/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
459 '/opt/sfw',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
460 '/sw/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
461 '/lib',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
462 ),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
463 'incdirs': ('/usr/local/BerkeleyDB.3.3/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
464 '/usr/local/BerkeleyDB.3.2/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
465 '/usr/local/BerkeleyDB.3.1/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
466 '/usr/local/BerkeleyDB.3.0/include',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
467 '/usr/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
468 '/opt/sfw/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
469 '/sw/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
470 '/usr/local/include/db3',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
471 ),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
472 'incs': ('db_185.h',)},
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
473 'db2': {'libs': ('db2',),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
474 'libdirs': ('/usr/lib', '/sw/lib', '/lib'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
475 'incdirs': ('/usr/include/db2',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
476 '/usr/local/include/db2', '/sw/include/db2'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
477 'incs': ('db_185.h',)},
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
478 # if you are willing to risk hash db file corruption you can
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
479 # uncomment the lines below for db1. Note that this will affect
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
480 # not only the bsddb module, but the dbhash and anydbm modules
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
481 # as well. you have been warned!!!
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
482 ##'db1': {'libs': ('db1', 'db'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
483 ## 'libdirs': ('/usr/lib', '/sw/lib', '/lib'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
484 ## 'incdirs': ('/usr/include/db1', '/usr/local/include/db1',
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
485 ## '/usr/include', '/usr/local/include'),
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
486 ## 'incs': ('db.h',)},
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
487 }
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
488
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
489 # override this list to affect the library version search order
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
490 # for example, if you want to force version 2 to be used:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
491 # db_search_order = ["db2"]
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
492 db_search_order = db_try_this.keys()
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
493 db_search_order.sort()
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
494 db_search_order.reverse()
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
495
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
496 find_lib_file = self.compiler.find_library_file
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
497 class found(Exception): pass
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
498 try:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
499 for dbkey in db_search_order:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
500 dbd = db_try_this[dbkey]
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
501 for dblib in dbd['libs']:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
502 for dbinc in dbd['incs']:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
503 db_incs = find_file(dbinc, [], dbd['incdirs'])
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
504 dblib_dir = find_lib_file(dbd['libdirs'], dblib)
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
505 if db_incs and dblib_dir:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
506 dblib_dir = os.path.dirname(dblib_dir)
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
507 dblibs = [dblib]
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
508 raise found
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
509 except found:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
510 if dbinc == 'db_185.h':
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
511 exts.append(Extension('bsddb', ['bsddbmodule.c'],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
512 library_dirs=[dblib_dir],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
513 include_dirs=db_incs,
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
514 define_macros=[('HAVE_DB_185_H',1)],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
515 libraries=[dblib]))
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
516 else:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
517 exts.append(Extension('bsddb', ['bsddbmodule.c'],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
518 library_dirs=[dblib_dir],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
519 include_dirs=db_incs,
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
520 libraries=[dblib]))
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
521 else:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
522 db_incs = None
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
523 dblibs = []
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
524 dblib_dir = None
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
525
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
526 # The standard Unix dbm module:
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
527 if platform not in ['cygwin']:
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
528 if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
529 exts.append( Extension('dbm', ['dbmmodule.c'],
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
530 libraries = ['ndbm'] ) )
23867
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
531 elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
20593
25d764d88149 - Build dbm module using libdb1 if it's available. This fixes SF bug "[
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 20498
diff changeset
532 exts.append( Extension('dbm', ['dbmmodule.c'],
23867
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
533 libraries = ['gdbm'] ) )
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
534 elif db_incs is not None:
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
535 exts.append( Extension('dbm', ['dbmmodule.c'],
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
536 library_dirs=dblib_dir,
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
537 include_dirs=db_incs,
45d676933882 This introduces stricter library/header file checking for the Berkeley DB
Skip Montanaro <skip@pobox.com>
parents: 23825
diff changeset
538 libraries=dblibs))
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
539 else:
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
540 exts.append( Extension('dbm', ['dbmmodule.c']) )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
541
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
542 # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
543 if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
544 exts.append( Extension('gdbm', ['gdbmmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
545 libraries = ['gdbm'] ) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
546
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
547 # The mpz module interfaces to the GNU Multiple Precision library.
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
548 # You need to ftp the GNU MP library.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
549 # This was originally written and tested against GMP 1.2 and 1.3.2.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
550 # It has been modified by Rob Hooft to work with 2.0.2 as well, but I
21452
fb6b3fc4e0c1 Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents: 21391
diff changeset
551 # haven't tested it recently, and it definitely doesn't work with
fb6b3fc4e0c1 Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents: 21391
diff changeset
552 # GMP 4.0. For more complete modules, refer to
fb6b3fc4e0c1 Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents: 21391
diff changeset
553 # http://gmpy.sourceforge.net and
fb6b3fc4e0c1 Update comments about mpz, pointing to gmpy and mxNumber rather than
Guido van Rossum <guido@python.org>
parents: 21391
diff changeset
554 # http://www.egenix.com/files/python/mxNumber.html
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
555
20234
7ea61da878af Fix a spelling error that has been bugging me for longer than I care to admit.
Greg Ward <gward@python.net>
parents: 19968
diff changeset
556 # A compatible MP library unencumbered by the GPL also exists. It was
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
557 # posted to comp.sources.misc in volume 40 and is widely available from
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
558 # FTP archive sites. One URL for it is:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
559 # ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/volume40/fgmp/part01.Z
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
560
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
561 if (self.compiler.find_library_file(lib_dirs, 'gmp')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
562 exts.append( Extension('mpz', ['mpzmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
563 libraries = ['gmp'] ) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
564
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
565
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
566 # Unix-only modules
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
567 if platform not in ['mac', 'win32']:
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
568 # Steen Lumholt's termios module
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
569 exts.append( Extension('termios', ['termios.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
570 # Jeremy Hylton's rlimit interface
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
571 if platform not in ['atheos']:
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
572 exts.append( Extension('resource', ['resource.c']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
573
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
574 # Sun yellow pages. Some systems have the functions in libc.
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
575 if platform not in ['cygwin', 'atheos']:
16804
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
576 if (self.compiler.find_library_file(lib_dirs, 'nsl')):
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
577 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
578 else:
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
579 libs = []
8156879fe60d Patch #404680: disables the nis module and enables the dl module when
Andrew M. Kuchling <amk@amk.ca>
parents: 16750
diff changeset
580 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
581 libraries = libs) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
582
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
583 # Curses support, requring the System V version of curses, often
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
584 # provided by the ncurses library.
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
585 if platform == 'sunos4':
16842
76a684fe3f7f Fix for bug #404875: fix typo in setup.py
Andrew M. Kuchling <amk@amk.ca>
parents: 16804
diff changeset
586 inc_dirs += ['/usr/5include']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
587 lib_dirs += ['/usr/5lib']
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
588
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
589 if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
590 curses_libs = ['ncurses']
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
591 exts.append( Extension('_curses', ['_cursesmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
592 libraries = curses_libs) )
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
593 elif (self.compiler.find_library_file(lib_dirs, 'curses')
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
594 and platform != 'darwin'):
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
595 # 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
596 # the _curses module.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
597 if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
598 curses_libs = ['curses', 'terminfo']
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
599 else:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
600 curses_libs = ['curses', 'termcap']
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
601
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
602 exts.append( Extension('_curses', ['_cursesmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
603 libraries = curses_libs) )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
604
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
605 # 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
606 if (module_enabled(exts, '_curses') and
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
607 self.compiler.find_library_file(lib_dirs, 'panel')):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
608 exts.append( Extension('_curses_panel', ['_curses_panel.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
609 libraries = ['panel'] + curses_libs) )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
610
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
611
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
612
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
613 # Lee Busby's SIGFPE modules.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
614 # The library to link fpectl with is platform specific.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
615 # Choose *one* of the options below for fpectl:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
616
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
617 if platform == 'irix5':
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
618 # For SGI IRIX (tested on 5.3):
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
619 exts.append( Extension('fpectl', ['fpectlmodule.c'],
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
620 libraries=['fpe']) )
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
621 elif 0: # XXX how to detect SunPro?
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
622 # For Solaris with SunPro compiler (tested on Solaris 2.5
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
623 # with SunPro C 4.2): (Without the compiler you don't have
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
624 # -lsunmath.)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
625 #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
626 pass
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
627 else:
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
628 # For other systems: see instructions in fpectlmodule.c.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
629 #fpectl fpectlmodule.c ...
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
630 exts.append( Extension('fpectl', ['fpectlmodule.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
631
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
632
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
633 # Andrew Kuchling's zlib module.
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
634 # This require zlib 1.1.3 (or later).
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
635 # See http://www.cdrom.com/pub/infozip/zlib/
17531
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
636 zlib_inc = find_file('zlib.h', [], inc_dirs)
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
637 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
638 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
639 version = '"0.0.0"'
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
640 version_req = '"1.1.3"'
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
641 fp = open(zlib_h)
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
642 while 1:
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
643 line = fp.readline()
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
644 if not line:
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
645 break
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
646 if line.find('#define ZLIB_VERSION', 0) == 0:
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
647 version = line.split()[2]
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
648 break
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
649 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
650 if (self.compiler.find_library_file(lib_dirs, 'z')):
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
651 exts.append( Extension('zlib', ['zlibmodule.c'],
c497fa3fe38a Patch by Mark Favas to ensure that the zlib we find is 1.1.3 or
Guido van Rossum <guido@python.org>
parents: 17099
diff changeset
652 libraries = ['z']) )
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
653
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
654 # Interface to the Expat XML parser
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
655 #
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
656 # Expat is written by James Clark and must be downloaded separately
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
657 # (see below). The pyexpat module was written by Paul Prescod after a
21932
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
658 # prototype by Jack Jansen. Source of Expat 1.95.2 is included
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
659 # in Modules/expat. Usage of a system shared libexpat.so/expat.dll
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
660 # is only advised if that has the same or newer version and was
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
661 # build using the same defines.
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
662 if sys.byteorder == "little":
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
663 xmlbo = "12"
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
664 else:
21932
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
665 xmlbo = "21"
21942
9d44e752d617 Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents: 21939
diff changeset
666 expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
21932
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
667 exts.append(Extension('pyexpat',
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
668 sources = [
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
669 'pyexpat.c',
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
670 'expat/xmlparse.c',
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
671 'expat/xmlrole.c',
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
672 'expat/xmltok.c',
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
673 ],
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
674 define_macros = [
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
675 ('HAVE_EXPAT_H',None),
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
676 ('XML_NS', '1'),
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
677 ('XML_DTD', '1'),
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
678 ('XML_BYTE_ORDER', xmlbo),
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
679 ('XML_CONTEXT_BYTES','1024'),
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
680 ],
21942
9d44e752d617 Compute expat -I directives from srcdir. Fixes #517214.
Martin v. Löwis <martin@v.loewis.de>
parents: 21939
diff changeset
681 include_dirs = [expatinc]
21932
ab68ad43d514 Use included Expat library. Drop support for older expat versions.
Martin v. Löwis <martin@v.loewis.de>
parents: 21788
diff changeset
682 ))
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
683
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
684 # Dynamic loading module
21610
a9e06ffaf7fb Patch #497126: Always compile dl.
Martin v. Löwis <martin@v.loewis.de>
parents: 21452
diff changeset
685 dl_inc = find_file('dlfcn.h', [], inc_dirs)
23777
bec1b942e0bc Patch #488073: AtheOS port.
Martin v. Löwis <martin@v.loewis.de>
parents: 23659
diff changeset
686 if (dl_inc is not None) and (platform not in ['atheos']):
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
687 exts.append( Extension('dl', ['dlmodule.c']) )
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
688
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
689 # Platform-specific libraries
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
690 if platform == 'linux2':
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
691 # Linux-specific modules
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
692 exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
693
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
694 if platform == 'sunos5':
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
695 # SunOS specific modules
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
696 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
697
21233
803ccbe3ee7c As of OS X 10.1.1 the version numbering scheme has changed. Convert all "darwin*" to "darwin" and use that for testing.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21039
diff changeset
698 if platform == 'darwin':
19007
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
699 # Mac OS X specific modules. These are ported over from MacPython
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
700 # and still experimental. Some (such as gestalt or icglue) are
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
701 # already generally useful, some (the GUI ones) really need to
cefdcd60a8b2 Replace moddir and incdir by
Jack Jansen <jack.jansen@cwi.nl>
parents: 18845
diff changeset
702 # be used from a framework.
19704
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
703 #
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
704 # I would like to trigger on WITH_NEXT_FRAMEWORK but that isn't
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
705 # available here. This Makefile variable is also what the install
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
706 # procedure triggers on.
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
707 frameworkdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR')
22159
71902e1cfbef Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents: 22104
diff changeset
708 exts.append( Extension('gestalt', ['gestaltmodule.c'],
22545
142fd3e1073d Fix SF # 532618 517704, install problems when building modules fail.
Neal Norwitz <nnorwitz@gmail.com>
parents: 22159
diff changeset
709 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
710 exts.append( Extension('MacOS', ['macosmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
711 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
712 exts.append( Extension('icglue', ['icgluemodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
713 extra_link_args=['-framework', 'Carbon']) )
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
714 exts.append( Extension('macfs',
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
715 ['macfsmodule.c',
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
716 '../Python/getapplbycreator.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
717 extra_link_args=['-framework', 'Carbon']) )
22159
71902e1cfbef Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents: 22104
diff changeset
718 exts.append( Extension('_CF', ['cf/_CFmodule.c'],
71902e1cfbef Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents: 22104
diff changeset
719 extra_link_args=['-framework', 'CoreFoundation']) )
71902e1cfbef Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents: 22104
diff changeset
720 exts.append( Extension('_Res', ['res/_Resmodule.c'],
71902e1cfbef Apply Jack's patch attached to
Michael W. Hudson <mwh@python.net>
parents: 22104
diff changeset
721 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
722 exts.append( Extension('_Snd', ['snd/_Sndmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
723 extra_link_args=['-framework', 'Carbon']) )
19704
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
724 if frameworkdir:
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
725 exts.append( Extension('Nav', ['Nav.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
726 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
727 exts.append( Extension('_AE', ['ae/_AEmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
728 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
729 exts.append( Extension('_App', ['app/_Appmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
730 extra_link_args=['-framework', 'Carbon']) )
21379
743f67befb57 Build _CarbonEvt module on Mac OS X. Still gives a couple of warnings
Jack Jansen <jack.jansen@cwi.nl>
parents: 21321
diff changeset
731 exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
732 extra_link_args=['-framework', 'Carbon']) )
21391
2c32fc5f23c0 build CoreGraphics under darwin
Just van Rossum <just@letterror.com>
parents: 21379
diff changeset
733 exts.append( Extension('_CG', ['cg/_CGmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
734 extra_link_args=['-framework', 'ApplicationServices',
21391
2c32fc5f23c0 build CoreGraphics under darwin
Just van Rossum <just@letterror.com>
parents: 21379
diff changeset
735 '-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
736 exts.append( Extension('_Cm', ['cm/_Cmmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
737 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
738 exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
739 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
740 exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
741 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
742 exts.append( Extension('_Drag', ['drag/_Dragmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
743 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
744 exts.append( Extension('_Evt', ['evt/_Evtmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
745 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
746 exts.append( Extension('_Fm', ['fm/_Fmmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
747 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
748 exts.append( Extension('_Icn', ['icn/_Icnmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
749 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
750 exts.append( Extension('_List', ['list/_Listmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
751 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
752 exts.append( Extension('_Menu', ['menu/_Menumodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
753 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
754 exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
755 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
756 exts.append( Extension('_Qd', ['qd/_Qdmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
757 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
758 exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
759 extra_link_args=['-framework', 'Carbon']) )
19704
1901f875b7d3 On MacOSX built the toolbox extension modules iff we're building with
Jack Jansen <jack.jansen@cwi.nl>
parents: 19680
diff changeset
760 exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
761 extra_link_args=['-framework', 'QuickTime',
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
762 '-framework', 'Carbon']) )
21775
16cc538401b3 Mac _Scrap module is now carbon-compliant, so build it on OSX.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21742
diff changeset
763 exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
764 extra_link_args=['-framework', 'Carbon']) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
765 exts.append( Extension('_TE', ['te/_TEmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
766 extra_link_args=['-framework', 'Carbon']) )
21321
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
767 # As there is no standardized place (yet) to put user-installed
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
768 # Mac libraries on OSX you should put a symlink to your Waste
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
769 # installation in the same folder as your python source tree.
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
770 # Or modify the next two lines:-)
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
771 waste_incs = find_file("WASTE.h", [], ["../waste/C_C++ Headers"])
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
772 waste_libs = find_library_file(self.compiler, "WASTE", [],
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
773 ["../waste/Static Libraries"])
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
774 if waste_incs != None and waste_libs != None:
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
775 exts.append( Extension('waste',
21321
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
776 ['waste/wastemodule.c',
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
777 'Mac/Wastemods/WEObjectHandlers.c',
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
778 'Mac/Wastemods/WETabHooks.c',
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
779 'Mac/Wastemods/WETabs.c'
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
780 ],
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
781 include_dirs = waste_incs + ['Mac/Wastemods'],
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
782 library_dirs = waste_libs,
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
783 libraries = ['WASTE'],
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
784 extra_link_args = ['-framework', 'Carbon'],
3a2cf5e45656 Mods to make WASTE module compile and link for MachoPython. Not tested
Jack Jansen <jack.jansen@cwi.nl>
parents: 21277
diff changeset
785 ) )
20789
961b24f8e1d8 Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents: 20593
diff changeset
786 exts.append( Extension('_Win', ['win/_Winmodule.c'],
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
787 extra_link_args=['-framework', 'Carbon']) )
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
788
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
789 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
790
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
791 # 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
792 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
793
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
794
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
795 def detect_tkinter(self, inc_dirs, lib_dirs):
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
796 # 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
797
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
798 # 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
799 # 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
800 # 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
801 tcllib = tklib = tcl_includes = tk_includes = None
18819
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
802 for version in ['8.4', '84', '8.3', '83', '8.2',
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
803 '82', '8.1', '81', '8.0', '80']:
21787
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
804 tklib = self.compiler.find_library_file(lib_dirs,
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
805 'tk' + version )
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
806 tcllib = self.compiler.find_library_file(lib_dirs,
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
807 'tcl' + version )
3ef7bed007f6 Sjoerd Mullender pointed out that setup.py contained some tabs,
Michael W. Hudson <mwh@python.net>
parents: 21775
diff changeset
808 if tklib and tcllib:
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
809 # 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
810 break
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
811
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
812 # 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
813 if tklib and tcllib:
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
814 # Check for the include files on Debian, where
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
815 # they're put in /usr/include/{tcl,tk}X.Y
16467
1c71aa7d5513 Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents: 16447
diff changeset
816 debian_tcl_include = [ '/usr/include/tcl' + version ]
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
817 debian_tk_include = [ '/usr/include/tk' + version ] + \
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
818 debian_tcl_include
16467
1c71aa7d5513 Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents: 16447
diff changeset
819 tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include)
1c71aa7d5513 Patch #103578 ] _tkinter build fix for he current Debian unstable tcl/tk 8.3
Andrew M. Kuchling <amk@amk.ca>
parents: 16447
diff changeset
820 tk_includes = find_file('tk.h', inc_dirs, debian_tk_include)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
821
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
822 if (tcllib is None or tklib is None and
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
823 tcl_includes is None or tk_includes is None):
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
824 # Something's missing, so give up
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
825 return
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
826
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
827 # OK... everything seems to be present for Tcl/Tk.
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
828
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
829 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
830 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
831 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
832 include_dirs.append(dir)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
833
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
834 # Check for various platform-specific directories
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
835 platform = self.get_platform()
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
836 if platform == 'sunos5':
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
837 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
838 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
839 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
840 include_dirs.append('/usr/X11R6/include')
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
841 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
842 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
843 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
844 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
845 else:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
846 # 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
847 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
848 added_lib_dirs.append('/usr/X11/lib')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
849
19968
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
850 # If Cygwin, then verify that X is installed before proceeding
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
851 if platform == 'cygwin':
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
852 x11_inc = find_file('X11/Xlib.h', [], inc_dirs)
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
853 if x11_inc is None:
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
854 # X header files missing, so give up
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
855 return
e9128ea45cda [Patch #462258] On Cygwin, don't build Tkinter unless the X header files
Andrew M. Kuchling <amk@amk.ca>
parents: 19935
diff changeset
856
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
857 # Check for BLT extension
21274
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
858 if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
cfbe38a03e8c Wrap some long lines.
Fred Drake <fdrake@acm.org>
parents: 21256
diff changeset
859 'BLT8.0'):
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
860 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
861 libs.append('BLT8.0')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
862
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
863 # Add the Tcl/Tk libraries
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
864 libs.append('tk'+version)
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
865 libs.append('tcl'+version)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
866
16192
4fe69a9f8b30 Modified version of part of patch #102409 for Cygwin:
Andrew M. Kuchling <amk@amk.ca>
parents: 16176
diff changeset
867 if platform in ['aix3', 'aix4']:
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
868 libs.append('ld')
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
869
18819
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
870 # Finally, link with the X11 libraries (not appropriate on cygwin)
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
871 if platform != "cygwin":
dc9baf80c45a Patch #443669: Permit _tkinter to build on cygwin32.
Martin v. Löwis <martin@v.loewis.de>
parents: 18601
diff changeset
872 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
873
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
874 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
875 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
876 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
877 libraries = libs,
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
878 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
879 )
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
880 self.extensions.append(ext)
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
881
15996
c503fa9b265e Sizable reorganization of how header and library files are found
Andrew M. Kuchling <amk@amk.ca>
parents: 15970
diff changeset
882 # XXX handle these, but how to detect?
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
883 # *** 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
884 # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
885 # *** 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
886 # -DWITH_TOGL togl.c \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
887 # *** Uncomment these for TOGL extension only:
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
888 # -lGL -lGLU -lXext -lXmu \
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
889
17886
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
890 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
891 # 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
892 # 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
893 # installation:
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
894 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
895 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
896 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
897
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
898 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
899 # 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
900 import warnings
a1ddc4080cc5 Patch #411055 from MvL: import each extension after building it, and
Andrew M. Kuchling <amk@amk.ca>
parents: 17889
diff changeset
901 warnings.filterwarnings("ignore",category=DeprecationWarning)
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
902 setup(name = 'Python standard library',
15967
dcae3e08d848 - compile struct module
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 15961
diff changeset
903 version = '%d.%d' % sys.version_info[:2],
17886
0af824c88203 Fix bug #232619: fix misleading warning on installing to lib-dynload
Andrew M. Kuchling <amk@amk.ca>
parents: 17531
diff changeset
904 cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
905 # 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
906 # called unless there's at least one extension module defined.
16844
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
907 ext_modules=[Extension('struct', ['structmodule.c'])],
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
908
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
909 # Scripts to install
8156deb0e62d Install the pydoc script
Andrew M. Kuchling <amk@amk.ca>
parents: 16842
diff changeset
910 scripts = ['Tools/scripts/pydoc']
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
911 )
16201
38678cb0b3cd the ucnhash module is no longer used
Fredrik Lundh <fredrik@pythonware.com>
parents: 16192
diff changeset
912
15940
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
913 # --install-platlib
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
914 if __name__ == '__main__':
ea464eda6158 [Patch #102588/PEP 229]:
Andrew M. Kuchling <amk@amk.ca>
parents:
diff changeset
915 main()