Skip to content

Commit d080024

Browse files
[3.15] Fix miscellaneous issues in the 'Configure Python' docs (GH-158679) (#161486)
(cherry picked from commit d138fd9) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 9076cd0 commit d080024

3 files changed

Lines changed: 94 additions & 99 deletions

File tree

‎Doc/tools/extensions/pyspecific.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import re
1313

14+
from docutils import nodes
1415
from sphinx import addnodes
1516
from sphinx.domains.python import PyFunction, PyMethod
1617

@@ -78,6 +79,13 @@ def parse_pdb_command(env, sig, signode):
7879
return fullname
7980

8081

82+
def parse_make_target(env, sig, signode):
83+
"""Transform a make target signature into RST nodes."""
84+
signode += addnodes.desc_name(sig, sig)
85+
signode['ids'].append(nodes.make_id(sig))
86+
return sig
87+
88+
8189
def parse_monitoring_event(env, sig, signode):
8290
"""Transform a monitoring event signature into RST nodes."""
8391
signode += addnodes.desc_addname('sys.monitoring.events.', 'sys.monitoring.events.')
@@ -113,6 +121,7 @@ def setup(app):
113121
app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature)
114122
app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command)
115123
app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event)
124+
app.add_object_type('make-target', 'make-target', '%s (make target)', parse_make_target)
116125
app.add_directive_to_domain('py', 'awaitablefunction', PyAwaitableFunction)
117126
app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
118127
app.connect('env-check-consistency', patch_pairindextypes)

‎Doc/using/configure.rst‎

Lines changed: 84 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Configure Python
77

88
.. _build-requirements:
99

10-
Build Requirements
10+
Build requirements
1111
==================
1212

1313
To build CPython, you will need:
@@ -164,6 +164,8 @@ platform-specific modules like :mod:`winreg` are not listed here.
164164
SQLite 3.15.2 is now required for :mod:`sqlite3`.
165165

166166

167+
.. _generated-files:
168+
167169
Generated files
168170
===============
169171

@@ -174,9 +176,11 @@ files. Commands to regenerate all generated files::
174176
make regen-stdlib-module-names
175177
make regen-limited-abi
176178
make regen-configure
179+
make regen-sbom
180+
make regen-unicodedata
177181

178-
The ``Makefile.pre.in`` file documents generated files, their inputs, and tools used
179-
to regenerate them. Search for ``regen-*`` make targets.
182+
The :source:`Makefile.pre.in` file documents generated files, their inputs, and
183+
tools used to regenerate them. Search for ``regen-*`` make targets.
180184

181185
configure script
182186
----------------
@@ -207,7 +211,7 @@ and `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 1.8.1.
207211

208212
.. _configure-options:
209213

210-
Configure Options
214+
Configure options
211215
=================
212216

213217
List all :file:`configure` script options using::
@@ -216,7 +220,7 @@ List all :file:`configure` script options using::
216220

217221
See also the :file:`Misc/SpecialBuilds.txt` in the Python source distribution.
218222

219-
General Options
223+
General options
220224
---------------
221225

222226
.. option:: --enable-loadable-sqlite-extensions
@@ -617,7 +621,7 @@ Options for third-party dependencies
617621
overriding ``pkg-config``.
618622

619623

620-
WebAssembly Options
624+
WebAssembly options
621625
-------------------
622626

623627
.. option:: --enable-wasm-dynamic-linking
@@ -636,7 +640,7 @@ WebAssembly Options
636640
.. versionadded:: 3.11
637641

638642

639-
Install Options
643+
Install options
640644
---------------
641645

642646
.. option:: --prefix=PREFIX
@@ -905,7 +909,7 @@ also be used to improve performance.
905909

906910
.. _debug-build:
907911

908-
Python Debug Build
912+
Python debug build
909913
------------------
910914

911915
A debug build is Python built with the :option:`--with-pydebug` configure
@@ -1149,7 +1153,7 @@ Libraries options
11491153
.. versionadded:: 3.10
11501154

11511155

1152-
Security Options
1156+
Security options
11531157
----------------
11541158

11551159
.. option:: --with-hash-algorithm=[fnv|siphash13|siphash24]
@@ -1227,7 +1231,7 @@ Security Options
12271231
.. versionadded:: 3.14
12281232

12291233

1230-
macOS Options
1234+
macOS options
12311235
-------------
12321236

12331237
See :source:`Mac/README.rst`.
@@ -1282,7 +1286,7 @@ See :source:`Mac/README.rst`.
12821286

12831287
.. versionadded:: 3.13
12841288

1285-
iOS Options
1289+
iOS options
12861290
-----------
12871291

12881292
See :source:`Platforms/Apple/iOS/README.md`.
@@ -1297,7 +1301,7 @@ See :source:`Platforms/Apple/iOS/README.md`.
12971301
Specify the name for the framework (default: ``Python``).
12981302

12991303

1300-
Cross Compiling Options
1304+
Cross compiling options
13011305
-----------------------
13021306

13031307
Cross compiling, also known as cross building, can be used to build Python
@@ -1347,7 +1351,7 @@ Cross compiling example::
13471351
--with-build-python=../x86_64/python
13481352

13491353

1350-
Python Build System
1354+
Python build system
13511355
===================
13521356

13531357
Main files of the build system
@@ -1371,107 +1375,88 @@ Main build steps
13711375
Main Makefile targets
13721376
---------------------
13731377

1374-
make
1375-
^^^^
1376-
1377-
For the most part, when rebuilding after editing some code or
1378-
refreshing your checkout from upstream, all you need to do is execute
1379-
``make``, which (per Make's semantics) builds the default target, the
1380-
first one defined in the Makefile. By tradition (including in the
1381-
CPython project) this is usually the ``all`` target. The
1382-
``configure`` script expands an ``autoconf`` variable,
1383-
``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make
1384-
all`` will build. The three choices are:
1385-
1386-
* ``profile-opt`` (configured with ``--enable-optimizations``)
1387-
* ``build_wasm`` (chosen if the host platform matches ``wasm32-wasi*`` or
1388-
``wasm32-emscripten``)
1389-
* ``build_all`` (configured without explicitly using either of the others)
1390-
1391-
Depending on the most recent source file changes, Make will rebuild
1392-
any targets (object files and executables) deemed out-of-date,
1393-
including running ``configure`` again if necessary. Source/target
1394-
dependencies are many and maintained manually however, so Make
1395-
sometimes doesn't have all the information necessary to correctly
1396-
detect all targets which need to be rebuilt. Depending on which
1397-
targets aren't rebuilt, you might experience a number of problems. If
1398-
you have build or test problems which you can't otherwise explain,
1399-
``make clean && make`` should work around most dependency problems, at
1400-
the expense of longer build times.
1401-
1402-
1403-
make platform
1404-
^^^^^^^^^^^^^
1378+
.. make-target:: make
14051379

1406-
Build the ``python`` program, but don't build the standard library
1407-
extension modules. This generates a file named ``platform`` which
1408-
contains a single line describing the details of the build platform,
1409-
e.g., ``macosx-14.3-arm64-3.12`` or ``linux-x86_64-3.13``.
1380+
For the most part, when rebuilding after editing some code or
1381+
refreshing your checkout from upstream, all you need to do is execute
1382+
``make``, which (per Make's semantics) builds the default target, the
1383+
first one defined in the Makefile. By tradition (including in the
1384+
CPython project) this is usually the ``all`` target. The
1385+
``configure`` script expands an ``autoconf`` variable,
1386+
``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make
1387+
all`` will build. The choices are:
14101388

1389+
* ``profile-opt`` (configured with ``--enable-optimizations``)
1390+
* ``bolt-opt`` (configured with ``--enable-bolt``)
1391+
* ``build_emscripten`` (chosen if the host platform matches
1392+
``wasm32-emscripten``)
1393+
* ``build_wasm`` (chosen if the host platform matches ``wasm32-wasi*``)
1394+
* ``build_all`` (configured without explicitly using any of the others)
14111395

1412-
make profile-opt
1413-
^^^^^^^^^^^^^^^^
1396+
Depending on the most recent source file changes, Make will rebuild
1397+
any targets (object files and executables) deemed out-of-date,
1398+
including running ``configure`` again if necessary. Source/target
1399+
dependencies are many and maintained manually however, so Make
1400+
sometimes doesn't have all the information necessary to correctly
1401+
detect all targets which need to be rebuilt. Depending on which
1402+
targets aren't rebuilt, you might experience a number of problems. If
1403+
you have build or test problems which you can't otherwise explain,
1404+
``make clean && make`` should work around most dependency problems, at
1405+
the expense of longer build times.
14141406

1415-
Build Python using profile-guided optimization (PGO). You can use the
1416-
configure :option:`--enable-optimizations` option to make this the
1417-
default target of the ``make`` command (``make all`` or just
1418-
``make``).
1407+
.. make-target:: make platform
14191408

1409+
Build the ``python`` program, but don't build the standard library
1410+
extension modules. This generates a file named ``platform`` which
1411+
contains a single line describing the details of the build platform,
1412+
for example, ``macosx-14.3-arm64-3.12`` or ``linux-x86_64-3.13``.
14201413

1414+
.. make-target:: make profile-opt
14211415

1422-
make clean
1423-
^^^^^^^^^^
1416+
Build Python using profile-guided optimization (PGO). You can use the
1417+
configure :option:`--enable-optimizations` option to make this the
1418+
default target of the ``make`` command (``make all`` or just
1419+
``make``).
14241420

1425-
Remove built files.
1421+
.. make-target:: make clean
14261422

1423+
Remove built files.
14271424

1428-
make distclean
1429-
^^^^^^^^^^^^^^
1425+
.. make-target:: make distclean
14301426

1431-
In addition to the work done by ``make clean``, remove files
1432-
created by the configure script. ``configure`` will have to be run
1433-
before building again. [#]_
1427+
In addition to the work done by ``make clean``, remove files
1428+
created by the configure script. ``configure`` will have to be run
1429+
before building again. [#]_
14341430

1431+
.. make-target:: make install
14351432

1436-
make install
1437-
^^^^^^^^^^^^
1433+
Build the ``all`` target and install Python.
14381434

1439-
Build the ``all`` target and install Python.
1435+
.. make-target:: make test
14401436

1437+
Build the ``all`` target and run the Python test suite with the
1438+
``--fast-ci`` option without GUI tests. Variables:
14411439

1442-
make test
1443-
^^^^^^^^^
1440+
* ``TESTOPTS``: additional regrtest command-line options.
1441+
* ``TESTPYTHONOPTS``: additional Python command-line options.
1442+
* ``TESTTIMEOUT``: timeout in seconds (default: 10 minutes).
14441443

1445-
Build the ``all`` target and run the Python test suite with the
1446-
``--fast-ci`` option without GUI tests. Variables:
1444+
.. make-target:: make ci
14471445

1448-
* ``TESTOPTS``: additional regrtest command-line options.
1449-
* ``TESTPYTHONOPTS``: additional Python command-line options.
1450-
* ``TESTTIMEOUT``: timeout in seconds (default: 10 minutes).
1446+
This is similar to ``make test``, but uses the ``-ugui`` to also run GUI tests.
14511447

1448+
.. versionadded:: 3.14
14521449

1453-
make ci
1454-
^^^^^^^
1455-
1456-
This is similar to ``make test``, but uses the ``-ugui`` to also run GUI tests.
1457-
1458-
.. versionadded:: 3.14
1459-
1460-
1461-
make buildbottest
1462-
^^^^^^^^^^^^^^^^^
1463-
1464-
This is similar to ``make test``, but uses the ``--slow-ci``
1465-
option and default timeout of 20 minutes, instead of ``--fast-ci`` option.
1450+
.. make-target:: make buildbottest
14661451

1452+
This is similar to ``make test``, but uses the ``--slow-ci``
1453+
option and default timeout of 20 minutes, instead of ``--fast-ci`` option.
14671454

1468-
make regen-all
1469-
^^^^^^^^^^^^^^
1455+
.. make-target:: make regen-all
14701456

1471-
Regenerate (almost) all generated files. These include (but are not
1472-
limited to) bytecode cases, and parser generator file.
1473-
``make regen-stdlib-module-names`` and ``autoconf`` must be run
1474-
separately for the remaining `generated files <#generated-files>`_.
1457+
Regenerate (almost) all generated files. These include (but are not
1458+
limited to) bytecode cases, and parser generator files. See
1459+
:ref:`generated-files` for the targets that must be run separately.
14751460

14761461

14771462
C extensions
@@ -1491,23 +1476,23 @@ Built-in modules have no ``__file__`` attribute:
14911476
File "<stdin>", line 1, in <module>
14921477
AttributeError: module 'sys' has no attribute '__file__'
14931478
1494-
Other C extensions are built as dynamic libraries, like the ``_asyncio`` module.
1479+
Other C extensions are built as dynamic libraries, like the ``_zoneinfo`` module.
14951480
They are built with the ``Py_BUILD_CORE_MODULE`` macro defined.
1496-
Example on Linux x86-64:
1481+
For example on Linux x86-64:
14971482

14981483
.. code-block:: pycon
14991484
1500-
>>> import _asyncio
1501-
>>> _asyncio
1502-
<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'>
1503-
>>> _asyncio.__file__
1504-
'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'
1485+
>>> import _zoneinfo
1486+
>>> _zoneinfo
1487+
<module '_zoneinfo' from '/.../lib.linux-x86_64-3.16/_zoneinfo.cpython-316d-x86_64-linux-gnu.so'>
1488+
>>> _zoneinfo.__file__
1489+
'/.../lib.linux-x86_64-3.16/_zoneinfo.cpython-316d-x86_64-linux-gnu.so'
15051490
15061491
:file:`Modules/Setup` is used to generate Makefile targets to build C extensions.
15071492
At the beginning of the files, C extensions are built as built-in modules.
15081493
Extensions defined after the ``*shared*`` marker are built as dynamic libraries.
15091494

1510-
The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and
1495+
The :c:macro:`PyAPI_FUNC()`, :c:macro:`PyAPI_DATA()` and
15111496
:c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined
15121497
differently depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:
15131498

‎Makefile.pre.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,7 @@ regen-unicodedata:
19391939
# Regenerate all generated files
19401940

19411941
# "clinic" is regenerated implicitly via "regen-global-objects".
1942+
# Keep the list of targets to run manually in sync with Doc/using/configure.rst.
19421943
.PHONY: regen-all
19431944
regen-all: regen-cases regen-slots \
19441945
regen-token regen-ast regen-keyword regen-sre regen-frozen \

0 commit comments

Comments
 (0)