Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp586463ybd; Sat, 22 Jun 2019 09:59:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxz7FUSy8VjluGwXRe4TBp+UODAP5LmjbzdbJmd9kXnBPQymzhMKVAXU2vvtOc4H8cPbcgu X-Received: by 2002:a17:902:7b84:: with SMTP id w4mr28589343pll.22.1561222778047; Sat, 22 Jun 2019 09:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561222778; cv=none; d=google.com; s=arc-20160816; b=pEgbM0BjPaC6FhR4Q3dPOzcTliMj8MHlBrSDG7gSVroAwpPgEBbRtovkNBIBqZFrxk tUgfwNbXQvIC9GRuK289bWcnXlAnbkgeGsXDztDgw8EZqbayw8gZ3G3PHAB9HOexSYTm f5LLXfPr3KzFsR04mlEhgTZKNcIwqqj3Aar1WUwAbRO+qAGZSmhM5RDOSiicDPnmbqHT r0G+K52eTX7ihHbCgwwp+KYKqlsJObMinqaM4sv5rMxAPSptf/0KEXFOxntMUfrrIije B26fVjD6S0AXWBpFG1fQNVyssT/G1rz8k86+k+WKpR6k2crxDOgcZ6xUjiBIQlIEooIJ uvUQ== 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=ZU1PkVNlNi/r+xZg9LE71Qm2ECG6WUm+8ial2VSb4K2p4kH/RLRc3LddPYsyEMUho3 X59c2OOsFjw3gfbYlOXtK635zl4YcU6yJgT5Jhq/jkhGjPmimFYDr+or0IIpBF5HnT+y CWlP/LPU5hi69NGe72ZroBLHOh6mshXeOxoc1zQRf8wEeyCOkIGwBCz19+14HjSymA7v k5iSPDg0htQ8qacgR5Ae/YcfXmIUCMG1KkQFmAbjz3zm60Q8maYXlzioB4wt3+HCCn0I BFhIQ+02DfTkTOvKxLrt1ru8ekLawHOpEK6dN8qxO/dx0v5gGkK6dA11TJT/nQgy/L6e omBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aG0oHNyi; 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 c19si6010427pfn.0.2019.06.22.09.59.20; Sat, 22 Jun 2019 09:59:38 -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=aG0oHNyi; 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 S1726559AbfFVQ7I (ORCPT + 99 others); Sat, 22 Jun 2019 12:59:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42804 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbfFVQ67 (ORCPT ); Sat, 22 Jun 2019 12:58:59 -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=aG0oHNyitqdv4BKL74sEhz3za+ wy0ANv0OsdGgH5c3Dmg9WThh3df+r39AeC+isJD0GLw1eknwlznaEqfDFFCWKmjNDx+NEO4pnQbCc ZYD/Xxm955zlUxAEg2K9tKCbRQKiFxvG9LvUolOQm39uyQg+2IYOfU65K8NetdoZaZHqDqyQtYz0D eOVSvSlxoTyAzPsyYWfexJsDFHu/cOIG2khPAslNre9bB4x9AWARih+th/OtGuTrMXkzRZ3Ab36n3 t5W1tesi235ox9iRV2IWohcC7Ptd35JfjZFPZiWC28c/qz3qTVWsBoR+B0MZSQQCsxNSXBoXamZWV N6RBxJ3w==; Received: from [179.95.45.115] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hejLu-00054n-HS; Sat, 22 Jun 2019 16:58:58 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hejLr-0000vY-Vd; Sat, 22 Jun 2019 13:58:55 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , gregkh@linuxfoundation.org, Jonathan Corbet Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH 07/12] docs: kernel_abi.py: make it compatible with Sphinx 1.7+ Date: Sat, 22 Jun 2019 13:58:48 -0300 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: 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