From patchwork Fri Jun 7 15:39:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 166160 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp800283ili; Fri, 7 Jun 2019 08:47:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqygg0fWR9cNnQuG7242TZn3gyqZFR10x6zucKKmndD5VHqn9ev+HNIWbFFtNvQBQT3C6npr X-Received: by 2002:a63:ef0e:: with SMTP id u14mr3325817pgh.295.1559922423109; Fri, 07 Jun 2019 08:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559922423; cv=none; d=google.com; s=arc-20160816; b=irC48KY4K2QGttePNi0X1Kc9hgOIjI36pdy2LuWyPF3mZQm3eDjfF0otfbIPTMVxQn 1bZlZ9SSC/s3NycoeFZG9eyY5w5tNDiEv4is1kmhtNOqGKNzppuuHAzj85fFSuxVRsoY 8yJt+AGi2pZ/9J3IzatGJ3qI91TGy9jE6Mk0ofwPV6XJB5Uc1IsZ8vxcuJ9QlI49cNo2 VVrWpVknm25vJhEbOJ69BelD7F04PI0VV2sPhBefTjPD5WHTM/DH28bn4ycx9CJMN7va pS8K/F0U2hcms+qCv5DlZEXXuBljS0/Fz4zahM6aBxIEVhtHNLg5AMDv3ek8h8XqFW2z QCMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dx+xx4M2UTtoUNae+utChSz46p8ENhfOC+gJr/9qCqM=; b=vIo7rrD0i69tiSTMQHQM4uEtOGXMNib0+RFwt2LgBe17no4rnYSKxoDJTvgx/O6SVy c16LNgxZoLudx9GEtTG0XXP4MXZiMTr/nd/h83GH4VG1v0TNOSlC+Fl0fHuKLyaRCBZh w4BYaGypmbnDD40Ve9b0JJNbF/MwTtdN5nbVqPSoxqCRbjaCghIxJYdczveD8/VS40ZC S/hJnDr+CQ+DhnGev/1nuu0/2PAuG5IRRKpGFBPb7vV++PdDUuWgvAWuzNqrQHkf/7v4 2JHoH99vzufI2LmKkJCtHgW5dBeTImQsTXR8dZV3nC4HQ+ep929zhSHbJk+PZA+afd+t eJVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FwQbpfVq; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si2087866pjp.24.2019.06.07.08.47.02; Fri, 07 Jun 2019 08:47:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FwQbpfVq; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731500AbfFGPrB (ORCPT + 14 others); Fri, 7 Jun 2019 11:47:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:59602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731494AbfFGPrA (ORCPT ); Fri, 7 Jun 2019 11:47:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C85421473; Fri, 7 Jun 2019 15:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559922419; bh=W6EXKwO2WLwrLah4By7DIUZSSEhhHmOZCXmMzKqlDxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FwQbpfVq7zSZS6ss8afD8PcXZ0pA+ZyTmxtX6rD4wE3BfjsdYHSFOdzoC+jorF9cF GcRF+x9geCTynMp8WLF+A3gZXrv3RaJyDp7J/xc/FjQmQa9bwVjC4zMAmtgn65//lC VAvF0/R8W85WPEwSEFBbBlJl2rUaV+Mqgg5sMBzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Corbet Subject: [PATCH 4.19 44/73] doc: Cope with the deprecation of AutoReporter Date: Fri, 7 Jun 2019 17:39:31 +0200 Message-Id: <20190607153854.067859834@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190607153848.669070800@linuxfoundation.org> References: <20190607153848.669070800@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Corbet commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream. AutoReporter is going away; recent versions of sphinx emit a warning like: Documentation/sphinx/kerneldoc.py:125: RemovedInSphinx20Warning: AutodocReporter is now deprecated. Use sphinx.util.docutils.switch_source_input() instead. Make the switch. But switch_source_input() only showed up in 1.7, so we have to do ugly version checks to keep things working in older versions. Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman --- Documentation/sphinx/kerneldoc.py | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) --- a/Documentation/sphinx/kerneldoc.py +++ b/Documentation/sphinx/kerneldoc.py @@ -37,7 +37,17 @@ import glob from docutils import nodes, statemachine from docutils.statemachine import ViewList from docutils.parsers.rst import directives, Directive -from sphinx.ext.autodoc import AutodocReporter + +# +# AutodocReporter is only good up to Sphinx 1.7 +# +import sphinx + +Use_SSI = sphinx.__version__[:3] >= '1.7' +if Use_SSI: + from sphinx.util.docutils import switch_source_input +else: + from sphinx.ext.autodoc import AutodocReporter __version__ = '1.0' @@ -121,13 +131,7 @@ class KernelDocDirective(Directive): lineoffset += 1 node = nodes.section() - buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter - self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter) - self.state.memo.title_styles, self.state.memo.section_level = [], 0 - try: - self.state.nested_parse(result, 0, node, match_titles=1) - finally: - self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + self.do_parse(result, node) return node.children @@ -136,6 +140,20 @@ class KernelDocDirective(Directive): (" ".join(cmd), str(e))) return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))] + def do_parse(self, result, node): + if Use_SSI: + with switch_source_input(self.state, result): + self.state.nested_parse(result, 0, node, match_titles=1) + else: + save = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter + self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter) + self.state.memo.title_styles, self.state.memo.section_level = [], 0 + try: + self.state.nested_parse(result, 0, node, match_titles=1) + finally: + self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = save + + def setup(app): app.add_config_value('kerneldoc_bin', None, 'env') app.add_config_value('kerneldoc_srctree', None, 'env')