From 5028ad3ba8ace33843bf963f44227f835fce9ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:57:11 +0200 Subject: [PATCH] Recomend `podman` instead of `docker` and remove mentions to Docker images (#1442) * use GHCR images instead of Docker images * Address Ezio and Hugo's reviews * Address Ezio's review (round 2) --- _extensions/ubuntu_version.py | 28 --------------- conf.py | 8 ----- developer-workflow/extension-modules.rst | 43 +++++++++--------------- 3 files changed, 15 insertions(+), 64 deletions(-) delete mode 100644 _extensions/ubuntu_version.py diff --git a/_extensions/ubuntu_version.py b/_extensions/ubuntu_version.py deleted file mode 100644 index 1298f35d98..0000000000 --- a/_extensions/ubuntu_version.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Sphinx extension to update the required Ubuntu version. - -The required Ubuntu version should be specified in conf.py by:: - - configure_ubuntu_version = "MAJOR.MINOR" # e.g., "22.04" - -The version must match the one used to regenerate the configure script in -https://github.com/python/cpython/blob/main/Tools/build/regen-configure.sh. -""" - -from sphinx.errors import ExtensionError - - -def replace_ubuntu_version(app, docname, source): - """Replace all occurrences of $CONFIGURE_UBUNTU_VERSION$. - - This is needed since RST replacement via ``|...|`` is not supported - in code-blocks directives. - """ - if (ubuntu_version := app.config.configure_ubuntu_version) is None: - raise ExtensionError("configure_ubuntu_version is not set in conf.py") - source[0] = source[0].replace("$CONFIGURE_UBUNTU_VERSION$", ubuntu_version) - - -def setup(app): - app.add_config_value("configure_ubuntu_version", None, "env", types=(str,)) - app.connect("source-read", replace_ubuntu_version) - return {"parallel_read_safe": True, "parallel_write_safe": True} diff --git a/conf.py b/conf.py index aed6592c38..842bf1b0c4 100644 --- a/conf.py +++ b/conf.py @@ -1,10 +1,6 @@ -import sys import time -sys.path.insert(0, '_extensions') - extensions = [ - 'ubuntu_version', 'notfound.extension', 'sphinx.ext.extlinks', 'sphinx.ext.intersphinx', @@ -203,7 +199,3 @@ copybutton_prompt_text = "$ " # https://sphinx-copybutton.readthedocs.io/en/latest/use.html#honor-line-continuation-characters-when-copying-multline-snippets copybutton_line_continuation_character = "\\" - -# Must be synchronized with the Ubuntu image version in -# https://github.com/python/cpython/blob/main/Tools/build/regen-configure.sh -configure_ubuntu_version = "22.04" diff --git a/developer-workflow/extension-modules.rst b/developer-workflow/extension-modules.rst index 7e32283c2e..61c1ff08af 100644 --- a/developer-workflow/extension-modules.rst +++ b/developer-workflow/extension-modules.rst @@ -552,6 +552,17 @@ Now that the configuration is in place, it remains to compile the project: * ``make regen-configure`` updates the :cpy-file:`configure` script. + The :cpy-file:`configure` script must be generated using a specific version + of ``autoconf``. To that end, the :cpy-file:`Tools/build/regen-configure.sh` + script which the ``regen-configure`` rule is based on either requires Docker + or Podman, the latter being assumed by default. + + .. tip:: + + We recommend installing `Podman `_ + instead of Docker since the former does not require a background service + and avoids creating files owned by the ``root`` user in some cases. + * ``make regen-all`` is responsible for regenerating header files and invoking other scripts, such as :ref:`Argument Clinic `. Execute this rule if you do not know which files should be updated. @@ -590,37 +601,13 @@ by executing :cpy-file:`Tools/build/regen-configure.sh`: ./Tools/build/regen-configure.sh # create an up-to-date 'configure' ./configure # create an up-to-date 'Makefile' -``make regen-configure`` and missing permissions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Since this rule requires `Docker `_ to be -running, the following can be done on Linux platforms (``systemctl``-based): - -.. code-block:: shell - - systemctl status docker # is the Docker service running? - sudo systemctl start docker # start it if it is not - sudo systemctl restart docker # or restart it if the issue persists +``make regen-configure`` and missing permissions with Docker +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If Docker complains about missing permissions, this Stack Overflow post could be useful in solving the issue: `How to fix docker: permission denied -`_. - -Once the Docker service is running, check that you have an `Ubuntu -$CONFIGURE_UBUNTU_VERSION$ image `_, -or pull it if it is not case: - -.. code-block:: shell - - # check for the Docker image presence - docker images ubuntu:$CONFIGURE_UBUNTU_VERSION$ - # pull the Docker image if needed - docker image pull ubuntu:$CONFIGURE_UBUNTU_VERSION$ - -.. tip:: - - If the issue persists, you may try `podman `_. - The commands for listing or pulling an image are the same as ``docker``. +`_. Alternatively, you may try +using `Podman `_. Missing ``Py_BUILD_CORE`` define when using internal headers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^