Skip to content

Commit 4217e50

Browse files
author
Jonathan Corbet
committed
Docs: drop Python 2 support
The kernel build system as a whole is dropping support for Python 2, so we should do the same. The effects are rather small, especially considering that much of the deleted code was not doing anything under any version of Python anyway. Signed-off-by: Jonathan Corbet <[email protected]>
1 parent f546ff0 commit 4217e50

File tree

5 files changed

+3
-28
lines changed

5 files changed

+3
-28
lines changed

Documentation/sphinx/kfigure.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,14 @@
4949
from os import path
5050
import subprocess
5151
from hashlib import sha1
52-
import sys
53-
5452
from docutils import nodes
5553
from docutils.statemachine import ViewList
5654
from docutils.parsers.rst import directives
5755
from docutils.parsers.rst.directives import images
5856
import sphinx
59-
6057
from sphinx.util.nodes import clean_astext
61-
from six import iteritems
62-
6358
import kernellog
6459

65-
PY3 = sys.version_info[0] == 3
66-
67-
if PY3:
68-
_unicode = str
69-
else:
70-
_unicode = unicode
71-
7260
# Get Sphinx version
7361
major, minor, patch = sphinx.version_info[:3]
7462
if major == 1 and minor > 3:
@@ -540,7 +528,7 @@ def add_kernel_figure_to_std_domain(app, doctree):
540528
docname = app.env.docname
541529
labels = std.data["labels"]
542530

543-
for name, explicit in iteritems(doctree.nametypes):
531+
for name, explicit in doctree.nametypes.items():
544532
if not explicit:
545533
continue
546534
labelid = doctree.nameids[name]

Documentation/sphinx/maintainers_include.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def parse_maintainers(self, path):
6161
field_content = ""
6262

6363
for line in open(path):
64-
if sys.version_info.major == 2:
65-
line = unicode(line, 'utf-8')
6664
# Have we reached the end of the preformatted Descriptions text?
6765
if descriptions and line.startswith('Maintainers'):
6866
descriptions = False

Documentation/sphinx/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
docutils
22
Sphinx==2.4.4
33
sphinx_rtd_theme
4-
six

Documentation/sphinx/rstFlatTable.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
# imports
4343
# ==============================================================================
4444

45-
import sys
46-
4745
from docutils import nodes
4846
from docutils.parsers.rst import directives, roles
4947
from docutils.parsers.rst.directives.tables import Table
@@ -55,14 +53,6 @@
5553

5654
__version__ = '1.0'
5755

58-
PY3 = sys.version_info[0] == 3
59-
PY2 = sys.version_info[0] == 2
60-
61-
if PY3:
62-
# pylint: disable=C0103, W0622
63-
unicode = str
64-
basestring = str
65-
6656
# ==============================================================================
6757
def setup(app):
6858
# ==============================================================================

scripts/sphinx-pre-install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,8 @@ sub check_needs()
728728
$need_virtualenv = 1;
729729
}
730730
if ($1 < 3) {
731-
# Complain if it finds python2 (or worse)
732-
printf "Warning: python$1 support is deprecated. Use it with caution!\n";
731+
# Fail if it finds python2 (or worse)
732+
die "Python 3 is required to build the kernel docs\n";
733733
}
734734
} else {
735735
die "Warning: couldn't identify $python_cmd version!";

0 commit comments

Comments
 (0)