Skip to content

Commit 9c0620a

Browse files
Revert "[3.12] GH-121970: Extract availability into a new extension (GH-125082) (#125238)"
This reverts commit caa4924
1 parent 3f55056 commit 9c0620a

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s'
3333
GH_ISSUE_URI = 'https://github.com/python/cpython/issues/%s'
3434
# Used in conf.py and updated here by python/release-tools/run_release.py
35-
SOURCE_URI = 'https://github.com/python/cpython/tree/main/%s'
35+
SOURCE_URI = 'https://github.com/python/cpython/tree/3.12/%s'
3636

3737
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
3838
from docutils.parsers.rst.states import Body
@@ -184,22 +184,7 @@ def run(self):
184184
return PyMethod.run(self)
185185

186186

187-
# Support for documenting version of changes, additions, deprecations
188-
189-
def expand_version_arg(argument, release):
190-
"""Expand "next" to the current version"""
191-
if argument == 'next':
192-
return sphinx_gettext('{} (unreleased)').format(release)
193-
return argument
194-
195-
196-
class PyVersionChange(VersionChange):
197-
def run(self):
198-
# Replace the 'next' special token with the current development version
199-
self.arguments[0] = expand_version_arg(self.arguments[0],
200-
self.config.release)
201-
return super().run()
202-
187+
# Support for documenting version of removal in deprecations
203188

204189
class DeprecatedRemoved(VersionChange):
205190
required_arguments = 2
@@ -210,12 +195,8 @@ class DeprecatedRemoved(VersionChange):
210195
def run(self):
211196
# Replace the first two arguments (deprecated version and removed version)
212197
# with a single tuple of both versions.
213-
version_deprecated = expand_version_arg(self.arguments[0],
214-
self.config.release)
198+
version_deprecated = self.arguments[0]
215199
version_removed = self.arguments.pop(1)
216-
if version_removed == 'next':
217-
raise ValueError(
218-
'deprecated-removed:: second argument cannot be `next`')
219200
self.arguments[0] = version_deprecated, version_removed
220201

221202
# Set the label based on if we have reached the removal version
@@ -278,8 +259,8 @@ def run(self):
278259
# Support for building "topic help" for pydoc
279260

280261
pydoc_topic_labels = [
281-
'assert', 'assignment', 'assignment-expressions', 'async', 'atom-identifiers',
282-
'atom-literals', 'attribute-access', 'attribute-references', 'augassign', 'await',
262+
'assert', 'assignment', 'async', 'atom-identifiers', 'atom-literals',
263+
'attribute-access', 'attribute-references', 'augassign', 'await',
283264
'binary', 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object',
284265
'bltin-null-object', 'bltin-type-objects', 'booleans',
285266
'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound',
@@ -417,15 +398,12 @@ def setup(app):
417398
app.add_role('issue', issue_role)
418399
app.add_role('gh', gh_issue_role)
419400
app.add_directive('impl-detail', ImplementationDetail)
420-
app.add_directive('versionadded', PyVersionChange, override=True)
421-
app.add_directive('versionchanged', PyVersionChange, override=True)
422-
app.add_directive('versionremoved', PyVersionChange, override=True)
423-
app.add_directive('deprecated', PyVersionChange, override=True)
424401
app.add_directive('deprecated-removed', DeprecatedRemoved)
425402
app.add_builder(PydocTopicsBuilder)
426403
app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature)
427404
app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command)
428405
app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event)
406+
app.add_object_type('2to3fixer', '2to3fixer', '%s (2to3 fixer)')
429407
app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
430408
app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
431409
app.add_directive_to_domain('py', 'coroutinefunction', PyCoroutineFunction)

0 commit comments

Comments
 (0)