From: Alan M. Carroll Date: Thu, 15 Jul 2021 19:48:17 +0000 (+0100) Subject: Remove python2 vestiges from conf.py, traffic-server.py. X-Git-Tag: archive/raspbian/8.1.1+ds-1.1+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5f31bff22312c1279c2620a1693ee46f85668b96;p=trafficserver.git Remove python2 vestiges from conf.py, traffic-server.py. Origin: upstream Applied-Upstream: https://github.com/apache/trafficserver/commit/096b2590b6111dd16ec19ca24f88ff41d069f2d0 Reviewed-by: Jean Baptiste Favre Last-Update: 2020-07-29 Last-Update: 2020-07-29 Gbp-Pq: Name 0017-fix_sphinx_3.0.patch --- diff --git a/doc/conf.py b/doc/conf.py index 0a8449df..db5ac021 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -57,7 +57,9 @@ extensions = [ ] # Contains values that are dependent on configure.ac. -execfile('ext/local-config.py') +LOCAL_CONFIG = 'ext/local-config.py' +with open(LOCAL_CONFIG) as f : + exec(compile(f.read(), LOCAL_CONFIG, 'exec')) if version_info >= (1, 4): extensions.append('sphinx.ext.imgmath') @@ -114,7 +116,7 @@ gettext_compact = False # Generate .mo files just in time if os.environ.get('READTHEDOCS') == 'True': import polib - print "Generating .mo files", + print("Generating .mo files"), for locale_dir in locale_dirs: for path, dummy, filenames in os.walk(locale_dir): for filename in filenames: @@ -124,7 +126,7 @@ if os.environ.get('READTHEDOCS') == 'True': mo_file = base + ".mo" po = polib.pofile(po_file) po.save_as_mofile(fpath=mo_file) - print "done" + print("done") else: # On RedHat-based distributions, install the python-sphinx_rtd_theme package # to get an end result tht looks more like readthedoc.org. @@ -213,7 +215,7 @@ class Inliner(states.Inliner): punctuation_chars.closers)) issue = re.compile( - ur''' + r''' {start_string_prefix} TS-\d+ {end_string_suffix}'''.format( @@ -344,9 +346,9 @@ latex_elements = { #'preamble': '', } -if tags.has('latex_a4'): +if 'latex_a4' in tags: latex_elements['papersize'] = 'a4paper' -elif tags.has('latex_paper'): +elif 'latex_paper' in tags: latex_elements['papersiize'] = 'letterpaper' # Grouping the document tree into LaTeX files. List of tuples diff --git a/doc/ext/traffic-server.py b/doc/ext/traffic-server.py index 59ead26e..7a07e15b 100644 --- a/doc/ext/traffic-server.py +++ b/doc/ext/traffic-server.py @@ -31,7 +31,7 @@ from docutils.parsers import rst from docutils.parsers.rst import directives from sphinx.domains import Domain, ObjType, std from sphinx.roles import XRefRole -from sphinx.locale import l_, _ +from sphinx.locale import _ import sphinx import subprocess @@ -301,8 +301,8 @@ class TrafficServerDomain(Domain): data_version = 2 object_types = { - 'cv': ObjType(l_('configuration variable'), 'cv'), - 'stat': ObjType(l_('statistic'), 'stat') + 'cv': ObjType(_('configuration variable'), 'cv'), + 'stat': ObjType(_('statistic'), 'stat') } directives = {