Skip to content

Commit 01cf4fb

Browse files
authored
bpo-45548: Make Modules/Setup easier to read (GH-29143)
1 parent 098a33f commit 01cf4fb

File tree

1 file changed

+115
-196
lines changed

1 file changed

+115
-196
lines changed

Modules/Setup

+115-196
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
# *noconfig* has the same effect as *shared*.)
6363
#
6464
# NOTE: As a standard policy, as many modules as can be supported by a
65-
# platform should be present. The distribution comes with all modules
66-
# enabled that are supported by most platforms and don't require you
67-
# to ftp sources from elsewhere.
65+
# platform should be listed below. The distribution comes with all
66+
# modules enabled that are supported by most platforms and don't
67+
# require you to download sources from elsewhere.
6868

6969

7070
# Some special rules to define PYTHONPATH.
@@ -94,126 +94,132 @@ COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)
9494
PYTHONPATH=$(COREPYTHONPATH)
9595

9696

97-
# The modules listed here can't be built as shared libraries for
98-
# various reasons; therefore they are listed here instead of in the
99-
# normal order.
100-
101-
# This only contains the minimal set of modules required to run the
102-
# setup.py script in the root of the Python source tree.
103-
104-
posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c # posix (UNIX) system calls
105-
errno errnomodule.c # posix (UNIX) errno values
106-
pwd pwdmodule.c # this is needed to find out the user's home dir
107-
# if $HOME is not set
108-
_sre -DPy_BUILD_CORE_BUILTIN _sre.c # Fredrik Lundh's new regular expressions
109-
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
110-
_weakref _weakref.c # weak references
111-
_functools -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _functoolsmodule.c # Tools for working with functions and callable objects
112-
_operator -DPy_BUILD_CORE_BUILTIN _operator.c # operator.add() and similar goodies
113-
_collections _collectionsmodule.c # Container types
114-
_abc -DPy_BUILD_CORE_BUILTIN _abc.c # Abstract base classes
115-
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
116-
atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
117-
_signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c
118-
_stat _stat.c # stat.h interface
119-
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c # -lm # time operations and variables
120-
_thread -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _threadmodule.c # low-level threading interface
121-
122-
# access to ISO C locale support
123-
_locale -DPy_BUILD_CORE_BUILTIN _localemodule.c # -lintl
97+
# ---
98+
# Built-in modules required to get a functioning interpreter;
99+
# cannot be built as shared!
124100

125-
# Standard I/O baseline
101+
_collections _collectionsmodule.c
102+
_abc -DPy_BUILD_CORE_BUILTIN _abc.c
103+
_codecs _codecsmodule.c
104+
_functools -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _functoolsmodule.c
126105
_io -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
127-
128-
# faulthandler module
106+
_locale -DPy_BUILD_CORE_BUILTIN _localemodule.c # -lintl
107+
_operator -DPy_BUILD_CORE_BUILTIN _operator.c
108+
_signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c
109+
_sre -DPy_BUILD_CORE_BUILTIN _sre.c
110+
_stat _stat.c
111+
_symtable symtablemodule.c # setup.py can't track the .h file that _symtable depends on.
112+
_thread -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _threadmodule.c
113+
_tracemalloc _tracemalloc.c # See bpo-35053 as to why this is built in.
114+
_weakref _weakref.c
115+
atexit atexitmodule.c
116+
errno errnomodule.c
129117
faulthandler faulthandler.c
118+
itertools itertoolsmodule.c
119+
posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c
120+
pwd pwdmodule.c
121+
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c
130122

131-
# debug tool to trace memory blocks allocated by Python
132-
#
133-
# bpo-35053: The module must be builtin since _Py_NewReference()
134-
# can call _PyTraceMalloc_NewReference().
135-
_tracemalloc _tracemalloc.c
136123

124+
# ---
137125
# The rest of the modules listed in this file are all commented out by
138126
# default. Usually they can be detected and built as dynamically
139-
# loaded modules by the new setup.py script added in Python 2.1. If
140-
# you're on a platform that doesn't support dynamic loading, want to
141-
# compile modules statically into the Python binary, or need to
142-
# specify some odd set of compiler switches, you can uncomment the
143-
# appropriate lines below.
144-
145-
# ======================================================================
146-
147-
# The Python symtable module depends on .h files that setup.py doesn't track
148-
_symtable symtablemodule.c
127+
# loaded modules by setup.py. If you're on a platform that doesn't
128+
# support dynamic loading, want to compile modules statically into the
129+
# Python binary, or need to specify some odd set of compiler switches,
130+
# you can uncomment the appropriate lines below.
149131

150132
# Uncommenting the following line tells makesetup that all following
151133
# modules are to be built as shared libraries (see above for more
152134
# detail; also note that *static* or *disabled* cancels this effect):
153135

154136
#*shared*
155137

156-
# GNU readline. Unlike previous Python incarnations, GNU readline is
157-
# now incorporated in an optional module, configured in the Setup file
158-
# instead of by a configure script switch. You may have to insert a
159-
# -L option pointing to the directory where libreadline.* lives,
160-
# and you may have to change -ltermcap to -ltermlib or perhaps remove
161-
# it, depending on your system -- see the GNU readline instructions.
162-
# It's okay for this to be a shared library, too.
163-
164-
#readline readline.c -lreadline -ltermcap
165-
166-
167138
# Modules that should always be present (non UNIX dependent):
168139

169-
#array -DPy_BUILD_CORE_MODULE arraymodule.c # array objects
170-
#cmath cmathmodule.c _math.c -DPy_BUILD_CORE_MODULE # -lm # complex math library functions
171-
#math mathmodule.c _math.c -DPy_BUILD_CORE_MODULE # -lm # math library functions, e.g. sin()
172-
#_contextvars _contextvarsmodule.c # Context Variables
173-
#_struct -DPy_BUILD_CORE_MODULE _struct.c # binary structure packing/unpacking
174-
#_testcapi _testcapimodule.c # Python C API test module; CANNOT be statically compiled!
175-
#_testinternalcapi _testinternalcapi.c -I$(srcdir)/Include/internal -DPy_BUILD_CORE_MODULE # Python internal C API test module
176-
#_random _randommodule.c -DPy_BUILD_CORE_MODULE # Random number generator
177-
#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
178-
#_pickle -DPy_BUILD_CORE_MODULE _pickle.c # pickle accelerator
179-
#_datetime _datetimemodule.c # datetime accelerator
180-
#_zoneinfo _zoneinfo.c -DPy_BUILD_CORE_MODULE # zoneinfo accelerator
181-
#_bisect _bisectmodule.c # Bisection algorithms
182-
#_heapq _heapqmodule.c -DPy_BUILD_CORE_MODULE # Heap queue algorithm
183-
#_asyncio _asynciomodule.c # Fast asyncio Future
184-
#_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c # _json speedups
185-
#_statistics _statisticsmodule.c # statistics accelerator
186-
#_typing _typingmodule.c # typing accelerator
187-
#_lsprof _lsprof.c rotatingtree.c # cProfile accelerators
140+
#_asyncio _asynciomodule.c
141+
#_bisect _bisectmodule.c
142+
#_blake2 -DPy_BUILD_CORE_BUILTIN _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
143+
#_codecs_cn cjkcodecs/_codecs_cn.c
144+
#_codecs_hk cjkcodecs/_codecs_hk.c
145+
#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
146+
#_codecs_jp cjkcodecs/_codecs_jp.c
147+
#_codecs_kr cjkcodecs/_codecs_kr.c
148+
#_codecs_tw cjkcodecs/_codecs_tw.c
149+
#_contextvars _contextvarsmodule.c
150+
#_csv _csv.c
151+
#_datetime _datetimemodule.c
152+
#_elementtree -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI -I$(srcdir)/Modules/expat _elementtree.c
153+
#_heapq -DPy_BUILD_CORE_MODULE _heapqmodule.c
154+
#_json -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _json.c
155+
#_lsprof _lsprof.c rotatingtree.c
156+
#_md5 -DPy_BUILD_CORE_BUILTIN md5module.c
157+
#_multibytecodec cjkcodecs/multibytecodec.c
188158
#_opcode _opcode.c
189-
#_queue _queuemodule.c -DPy_BUILD_CORE_MODULE
190-
191-
#unicodedata unicodedata.c -DPy_BUILD_CORE_BUILTIN # static Unicode character database
192-
159+
#_pickle -DPy_BUILD_CORE_MODULE _pickle.c
160+
#_posixsubprocess -DPy_BUILD_CORE_BUILTIN _posixsubprocess.c
161+
#_queue -DPy_BUILD_CORE_MODULE _queuemodule.c
162+
#_random -DPy_BUILD_CORE_MODULE _randommodule.c
163+
#_sha1 -DPy_BUILD_CORE_BUILTIN sha1module.c
164+
#_sha256 -DPy_BUILD_CORE_BUILTIN sha256module.c
165+
#_sha512 -DPy_BUILD_CORE_BUILTIN sha512module.c
166+
#_sha3 -DPy_BUILD_CORE_BUILTIN _sha3/sha3module.c
167+
#_statistics _statisticsmodule.c
168+
#_struct -DPy_BUILD_CORE_MODULE _struct.c
169+
#_typing _typingmodule.c
170+
#_zoneinfo -DPy_BUILD_CORE_MODULE _zoneinfo.c
171+
#array -DPy_BUILD_CORE_MODULE arraymodule.c
172+
#audioop audioop.c
173+
#binascii -DPy_BUILD_CORE_MODULE binascii.c
174+
#cmath -DPy_BUILD_CORE_MODULE cmathmodule.c _math.c # -lm
175+
#math -DPy_BUILD_CORE_MODULE mathmodule.c _math.c # -lm
176+
#pyexpat -DHAVE_EXPAT_CONFIG_H -DXML_POOR_ENTROPY -DUSE_PYEXPAT_CAPI -I$(srcdir)/Modules/expat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c
177+
#unicodedata -DPy_BUILD_CORE_BUILTIN unicodedata.c
193178

194179
# Modules with some UNIX dependencies -- on by default:
195180
# (If you have a really backward UNIX, select and socket may not be
196181
# supported...)
197182

198-
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
199-
#spwd spwdmodule.c # spwd(3)
200-
#grp grpmodule.c # grp(3)
201-
#select selectmodule.c # select(2); not on ancient System V
183+
#_socket socketmodule.c # socket(2)
184+
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
185+
#grp grpmodule.c # grp(3)
186+
#mmap mmapmodule.c # Also works on win32.
202187
#ossaudiodev ossaudiodev.c
188+
#select selectmodule.c # select(2); not on ancient System V
189+
#spwd spwdmodule.c # spwd(3)
190+
#syslog syslogmodule.c
203191

204-
# Memory-mapped files (also works on Win32).
205-
#mmap mmapmodule.c
192+
# Some more UNIX dependent modules -- off by default, since these
193+
# are not supported by all UNIX systems:
206194

207-
# CSV file helper
208-
#_csv _csv.c
195+
#_crypt _cryptmodule.c # -lcrypt # crypt(3); breaks many builds.
196+
#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
197+
#termios termios.c # Steen Lumholt's termios module
198+
#resource resource.c # Jeremy Hylton's rlimit interface
199+
200+
# Modules that require external libraries.
201+
202+
#_bz2 _bz2module.c -lbz2
203+
#_dbm _dbmmodule.c # -lndbm # dbm(3)
204+
#_gdbm -I/usr/local/include -L/usr/local/lib -lgdbm _gdbmmodule.c
205+
#_lzma _lzmamodule.c -llzma
206+
#zlib -I$(prefix)/include -L$(exec_prefix)/lib -lz zlibmodule.c
207+
208+
# GNU readline. Unlike previous Python incarnations, GNU readline is
209+
# now incorporated in an optional module, configured in the Setup file
210+
# instead of by a configure script switch. You may have to insert a
211+
# -L option pointing to the directory where libreadline.* lives,
212+
# and you may have to change -ltermcap to -ltermlib or perhaps remove
213+
# it, depending on your system -- see the GNU readline instructions.
214+
# It's okay for this to be a shared library, too.
215+
216+
#readline readline.c -lreadline -ltermcap
209217

210-
# Socket module helper for socket(2)
211-
#_socket socketmodule.c
218+
# Set OpenSSL when not using the system copy found by ./configure.
219+
#OPENSSL=/path/to/openssl/directory
212220

213-
# Socket module helper for SSL support; you must comment out the other
214-
# socket line above, and edit the OPENSSL variable:
215-
# OPENSSL=/path/to/openssl/directory
216-
# _ssl _ssl.c \
221+
# To dynamically link OpenSSL:
222+
#_ssl _ssl.c \
217223
# -I$(OPENSSL)/include -L$(OPENSSL)/lib \
218224
# -lssl -lcrypto \
219225
# -DPy_BUILD_CORE_BUILTIN
@@ -223,7 +229,7 @@ _symtable symtablemodule.c
223229
# -DPy_BUILD_CORE_BUILTIN
224230

225231
# To statically link OpenSSL:
226-
# _ssl _ssl.c \
232+
#_ssl _ssl.c \
227233
# -I$(OPENSSL)/include -L$(OPENSSL)/lib \
228234
# -l:libssl.a -Wl,--exclude-libs,libssl.a \
229235
# -l:libcrypto.a -Wl,--exclude-libs,libcrypto.a \
@@ -233,52 +239,6 @@ _symtable symtablemodule.c
233239
# -l:libcrypto.a -Wl,--exclude-libs,libcrypto.a \
234240
# -DPy_BUILD_CORE_BUILTIN
235241

236-
# The crypt module is now disabled by default because it breaks builds
237-
# on many systems (where -lcrypt is needed), e.g. Linux (I believe).
238-
239-
#_crypt _cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
240-
241-
242-
# Some more UNIX dependent modules -- off by default, since these
243-
# are not supported by all UNIX systems:
244-
245-
#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
246-
#termios termios.c # Steen Lumholt's termios module
247-
#resource resource.c # Jeremy Hylton's rlimit interface
248-
249-
#_posixsubprocess -DPy_BUILD_CORE_BUILTIN _posixsubprocess.c # POSIX subprocess module helper
250-
251-
# Multimedia modules -- off by default.
252-
# These don't work for 64-bit platforms!!!
253-
# #993173 says audioop works on 64-bit platforms, though.
254-
# These represent audio samples or images as strings:
255-
256-
#audioop audioop.c # Operations on audio samples
257-
258-
259-
# Note that the _md5 and _sha modules are normally only built if the
260-
# system does not have the OpenSSL libs containing an optimized version.
261-
262-
# The _md5 module implements the RSA Data Security, Inc. MD5
263-
# Message-Digest Algorithm, described in RFC 1321.
264-
265-
#_md5 md5module.c -DPy_BUILD_CORE_BUILTIN
266-
267-
268-
# The _sha module implements the SHA checksum algorithms.
269-
# (NIST's Secure Hash Algorithms.)
270-
#_sha1 sha1module.c -DPy_BUILD_CORE_BUILTIN
271-
#_sha256 sha256module.c -DPy_BUILD_CORE_BUILTIN
272-
#_sha512 sha512module.c -DPy_BUILD_CORE_BUILTIN
273-
#_sha3 _sha3/sha3module.c -DPy_BUILD_CORE_BUILTIN
274-
275-
# _blake module
276-
#_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c -DPy_BUILD_CORE_BUILTIN
277-
278-
# Compression
279-
#_bz2 _bz2module.c -lbz2
280-
#_lzma _lzmamodule.c -llzma
281-
282242
# The _tkinter module.
283243
#
284244
# The command for _tkinter is long and site specific. Please
@@ -322,75 +282,34 @@ _symtable symtablemodule.c
322282
# *** Always uncomment this; X11 libraries to link with:
323283
# -lX11
324284

325-
# Lance Ellinghaus's syslog module
326-
#syslog syslogmodule.c # syslog daemon interface
327-
328-
329285
# Curses support, requiring the System V version of curses, often
330286
# provided by the ncurses library. e.g. on Linux, link with -lncurses
331287
# instead of -lcurses).
332288

333-
#_curses _cursesmodule.c -lcurses -ltermcap -DPy_BUILD_CORE_MODULE
334-
# Wrapper for the panel library that's part of ncurses and SYSV curses.
335-
#_curses_panel _curses_panel.c -lpanel -lncurses
336-
337-
338-
# Modules that provide persistent dictionary-like semantics. You will
339-
# probably want to arrange for at least one of them to be available on
340-
# your machine, though none are defined by default because of library
341-
# dependencies. The Python module dbm/__init__.py provides an
342-
# implementation independent wrapper for these; dbm/dumb.py provides
343-
# similar functionality (but slower of course) implemented in Python.
344-
345-
#_dbm _dbmmodule.c # dbm(3) may require -lndbm or similar
346-
347-
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
348-
349-
#_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
350-
351-
352-
# Helper module for various ascii-encoders
353-
#binascii binascii.c -DPy_BUILD_CORE_MODULE
354-
355-
# Andrew Kuchling's zlib module.
356-
# This require zlib 1.1.3 (or later).
357-
# See http://www.gzip.org/zlib/
358-
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
359-
360-
# Interface to the Expat XML parser
361-
# More information on Expat can be found at www.libexpat.org.
362-
#
363-
#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DXML_POOR_ENTROPY -DUSE_PYEXPAT_CAPI
364-
365-
# Hye-Shik Chang's CJKCodecs
289+
#_curses -DPy_BUILD_CORE_MODULE -lcurses -ltermcap _cursesmodule.c
366290

367-
# multibytecodec is required for all the other CJK codec modules
368-
#_multibytecodec cjkcodecs/multibytecodec.c
369-
370-
#_codecs_cn cjkcodecs/_codecs_cn.c
371-
#_codecs_hk cjkcodecs/_codecs_hk.c
372-
#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
373-
#_codecs_jp cjkcodecs/_codecs_jp.c
374-
#_codecs_kr cjkcodecs/_codecs_kr.c
375-
#_codecs_tw cjkcodecs/_codecs_tw.c
376-
377-
# Example -- included for reference only:
378-
# xx xxmodule.c
291+
# Wrapper for the panel library that's part of ncurses and SYSV curses.
292+
#_curses_panel -lpanel -lncurses _curses_panel.c
379293

380-
# Another example -- the 'xxsubtype' module shows C-level subtyping in action
381-
xxsubtype xxsubtype.c
294+
# Examples
382295

383-
# Limited API examples
296+
#xx xxmodule.c
384297
#xxlimited xxlimited.c
385298
#xxlimited_35 xxlimited_35.c
299+
xxsubtype xxsubtype.c # Required for the test suite to pass!
300+
301+
# Testing
386302

387-
# For testing
388303
#_xxsubinterpreters _xxsubinterpretersmodule.c
389304
#_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
390305
#_testbuffer _testbuffer.c
306+
#_testcapi _testcapimodule.c # CANNOT be statically compiled!
391307
#_testimportmultiple _testimportmultiple.c
308+
#_testinternalcapi -DPy_BUILD_CORE_MODULE -I$(srcdir)/Include/internal _testinternalcapi.c
392309
#_testmultiphase _testmultiphase.c
393310

311+
312+
# ---
394313
# Uncommenting the following line tells makesetup that all following modules
395314
# are not built (see above for more detail).
396315
#

0 commit comments

Comments
 (0)