all: Remove Python 2.7 support.

Python 2.7 has been EOL since January 2020.

Ubuntu oldoldlts (Focal Fossa, 20.04) has Python 3.8.  Debian oldoldstable
(Buster, from 2019) has Python 3.7.  RHEL 8 (from 2019) has Python 3.6.

It's easier than ever to install a modern Python using uv.

Given this, it seems like a fine idea to drop Python 2.7 support.

Even though the build is not tested on Python as old as 3.3, I left
comments stating that "3.3+" is the baseline Python version.  However, it
might make sense to bump this to e.g., 3.10, the oldest Python 3 version
used during CI. Or, using uv or another method actually test on the oldest
Python interpreter that is desirable to support (uv goes back to Python 3.7
easily; in October 2025, the oldest supported Python interpreter version
will be 3.10)

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler
2025-08-08 10:09:13 -05:00
committed by Damien George
parent d441788975
commit f0c6f16b9e
12 changed files with 35 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
"""
Process raw qstr file and output qstr data with length, hash and data bytes.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
This script works with Python 3.3+.
"""
from __future__ import print_function
@@ -9,13 +9,7 @@ from __future__ import print_function
import re
import sys
# Python 2/3/MicroPython compatibility:
# - iterating through bytes is different
# - codepoint2name from html.entities is hard-coded
if sys.version_info[0] == 2:
bytes_cons = lambda val, enc=None: bytearray(val)
elif sys.version_info[0] == 3: # Also handles MicroPython
bytes_cons = bytes
bytes_cons = bytes
# fmt: off
codepoint2name = {
@@ -57,7 +51,6 @@ codepoint2name = {
253: "yacute", 165: "yen", 255: "yuml", 950: "zeta", 8205: "zwj", 8204: "zwnj"
}
# fmt: on
# end compatibility code
codepoint2name[ord("-")] = "hyphen"

View File

@@ -2,7 +2,7 @@
This script processes the output from the C preprocessor and extracts all
qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
This script works with Python 3.3+.
"""
from __future__ import print_function

View File

@@ -1,7 +1,7 @@
"""
Generate header file with macros defining MicroPython version info.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
This script works with Python 3.3+.
"""
from __future__ import print_function
@@ -22,12 +22,6 @@ import subprocess
# "vX.Y.Z-preview.N.gHASH.dirty" -- building at any subsequent commit in the cycle
# with local changes
def get_version_info_from_git(repo_path):
# Python 2.6 doesn't have check_output, so check for that
try:
subprocess.check_output
except AttributeError:
return None
# Note: git describe doesn't work if no tag is available
try:
git_tag = subprocess.check_output(
@@ -57,12 +51,6 @@ def get_version_info_from_git(repo_path):
def get_hash_from_git(repo_path):
# Python 2.6 doesn't have check_output, so check for that.
try:
subprocess.check_output
except AttributeError:
return None
try:
return subprocess.check_output(
["git", "rev-parse", "--short", "HEAD"],