Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1234683ybi; Fri, 14 Jun 2019 10:53:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkIKJoK+8PQ071yrIA6wdkx0DqS8x6AFjB8vUpgyAvouid9da68IYfqKPoaEpwPo7emaGb X-Received: by 2002:a17:90a:7f91:: with SMTP id m17mr12355758pjl.86.1560534830293; Fri, 14 Jun 2019 10:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534830; cv=none; d=google.com; s=arc-20160816; b=FigFL9rlATq3aRKKI4gzaWB3nlCzHfD2aFNgg6zytDBDeO9cZAUIk815YvIz2n0OcB /5P2Rf/FZyZsruVab+O3nzTRrRoYG94i0QInEIzJGFOS9ic4FdBRbaVk/xlxowIZ+E8Y WNT4VaG8h8goTS6dkVxxdjeE55QaS5E7cDaQa//7NlwU9zLdBwoiqRO54lDcpA8u343P YAOZXeRTa2ADXhRjuYu5EdwV39oL/0TlX8a9Qz3d4dPJBtOGalfAFmFAhVomwLxNMbM6 HnAE47YyeNOO/EHTUvksbJxGdz/2fXyQZZfQ1lglzdsUGWtRmWoqDlksdv6mvokgLEST dLcw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4yo27ijYQu1yYo30q/R/RGMGUqSkkm83kufrAmJA9ng=; b=cchOOqQ2vra6sjJ8oVNHXfNCtilRzJ7rdFEU47c/StW/+BnT7ZlNsLSRxMC0iUgtDM toJSjUxia2Xqwcj++71JILCJEyDSrskrf5svhQG1BmFnPCcxjwZe+MDAYS/uuR2XmSMI dpg9qi0+85899yr+iw66uzHogLZUpXEMGn78mOovqzXSFuo+h2bZH3JrC34UkTi/Rmvj igZvUAeHBNrtrmcUE61IDSws5mCAZUSv0Blbx4xkocsAT8isjRV03I5k739Yj8MtApTz fVo41+xVb07SDOOgn1cK2Fq44ZHB/21AlJgxR9owmKx3T9pedKhUUzILfU++ccuDaebS on2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=I7iAKGwk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a36si2877918pje.14.2019.06.14.10.53.35; Fri, 14 Jun 2019 10:53:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=I7iAKGwk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbfFNRwl (ORCPT + 99 others); Fri, 14 Jun 2019 13:52:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38610 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbfFNRwe (ORCPT ); Fri, 14 Jun 2019 13:52:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4yo27ijYQu1yYo30q/R/RGMGUqSkkm83kufrAmJA9ng=; b=I7iAKGwk8MIwZBi9pG7YENWXoI iC+5YfTXuhjWdD6D6k6ElBIDJKEZQ3nt26xJ737PLE1N6DCogIkBFPgGsfYXlgDyi8Ibu1uD5s+Fs 43gPcI+ZjITmBpwoAezCSuBJQheY1Nd1C5X68J7eqzW9l/ihOfkobXsSw2hhiOjX/kilnWTGGi9vD Oro6sa87I2rDchIXHAAuWGK2XhWqC0M1Aj4jehRwqobOR3cCU4JizQ3h6R4qxZC5z+nqvLsz4xKjl jF+2j6Km5RN89II1Bl0ZkK6hbBcJQK/+LfabBy6rbuTXYFhfJbnD0caw5LfwcLS7Bk0EJUSUx8YzB jx7h/Few==; Received: from 177.133.85.52.dynamic.adsl.gvt.net.br ([177.133.85.52] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbqNO-0000Pb-Im; Fri, 14 Jun 2019 17:52:34 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hbqNM-0002PN-2s; Fri, 14 Jun 2019 14:52:32 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH v2 15/16] sphinx/kernel_abi.py: make it compatible with Sphinx 1.7+ Date: Fri, 14 Jun 2019 14:52:29 -0300 Message-Id: <76a9db53d324ff55fca23fae86b223110aca7678.1560534648.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <3b8d7c64f887ddea01df3c4eeabc745c8ec45406.1560534648.git.mchehab+samsung@kernel.org> References: <3b8d7c64f887ddea01df3c4eeabc745c8ec45406.1560534648.git.mchehab+samsung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The same way kerneldoc.py needed changes to work with newer Sphinx, this script needs the same changes. While here, reorganize the include order to match kerneldoc.py. Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/kernel_abi.py | 39 +++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py index 0f3e51e67e8d..2d5d582207f7 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -30,18 +30,27 @@ u""" """ import codecs -import sys import os -from os import path import subprocess +import sys -from sphinx.ext.autodoc import AutodocReporter +from os import path -from docutils import nodes -from docutils.parsers.rst import Directive, directives +from docutils import nodes, statemachine from docutils.statemachine import ViewList +from docutils.parsers.rst import directives, Directive from docutils.utils.error_reporting import ErrorString +# +# 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' @@ -139,11 +148,17 @@ class KernelCmd(Directive): content.append(l, fname, c) buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter - self.state.memo.title_styles = [] - self.state.memo.section_level = 0 - self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter) - try: - self.state.nested_parse(content, 0, node, match_titles=1) - finally: - self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + + if Use_SSI: + with switch_source_input(self.state, content): + self.state.nested_parse(content, 0, node, match_titles=1) + else: + self.state.memo.title_styles = [] + self.state.memo.section_level = 0 + self.state.memo.reporter = AutodocReporter(content, self.state.memo.reporter) + try: + self.state.nested_parse(content, 0, node, match_titles=1) + finally: + self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf + return node.children -- 2.21.0