[3.13] GH-121970: Modernise the patchlevel extension (GH-121995) (#122060)

GH-121970: Modernise the patchlevel extension (GH-121995)
(cherry picked from commit b7ad711fcb)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-07-20 16:02:23 +02:00 committed by GitHub
parent 1b4c5fe159
commit efc7d1ca86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 66 additions and 58 deletions

View file

@ -6,6 +6,7 @@
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
import importlib
import os
import sys
import time
@ -64,9 +65,8 @@ copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
import patchlevel # noqa: E402
version, release = patchlevel.get_version_info()
# See Doc/tools/extensions/patchlevel.py
version, release = importlib.import_module('patchlevel').get_version_info()
rst_epilog = f"""
.. |python_version_literal| replace:: ``Python {version}``