Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp411311ybi; Thu, 13 Jun 2019 19:04:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM9hvxNgIO2DUIVqQB6q/JZp4QWST1yhxk4TCNlGzu5kG7JTIR7mAwPzYCTZfTDTZbiUSO X-Received: by 2002:a17:902:6b0c:: with SMTP id o12mr5964424plk.113.1560477895654; Thu, 13 Jun 2019 19:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560477895; cv=none; d=google.com; s=arc-20160816; b=lOuCm9CXOcM/CROftR17DJE5n96fkn5l7ltFeatdSFeBk3fQGkBb/iLZryqC5mdol1 hv2ymg1j30mdnDOjkOAOP8ojS8DwZlfyprm80MNRMJpeM3TPvZCdCNmiSta3EvWJHU5V cgX10lm9+A4CbNrvvixVaDZx+F6Ya0jyolKRlVOVObp27oTJbP37C3xwcam4UDI1WC/i rBRGmcGDh1YzVFxnQib7xn4ioSVlhRX8y9nGntUuvvSyyj5ID/Z9UKI15E2thjgA3r8y ASVEEWyAxo57x46SHKsVCm0EiZ4qr5mP+THruN3ERcoVn8xmpISdwtpBnMGZ2buV9cTj E+Iw== 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=2lZSJSMx6Y3MRGPxe0M3M6eDqWU4ZSMnhOq/IvfM44w=; b=VZ2YIcwuSwOwaL/VkTuXOnc4ZIuk6uDhSf7XPWWUJ/nppzi0JY/ehp/rEQO5/+lGbf kWLaddzpXito+A/NGOUL7digkLDzJtI1Q/JOycAKGtKPOjUtfTZDqd9jb1pWFThR7ryU 8RzKrZqi/T1l7gZHWnun46NUJNm9spUvwGKTIzXhUM0wGPYoHa1k8+p9F3lfhSt3S8QC tOL3Xl1+HTxDAWgyTJ9xIH9eyxmRY1pi+hbaVHPI0C1m59XMXrnQ7Y3NkCHxgOv48R+4 2k3xDDZewsVxURjqps00WYTEF8HcGobvbzOIVxz1rOVDYP91bXv3/+SYVK1PN17BWtBS 0JKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=r+3HHuXP; 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 i95si904097plb.106.2019.06.13.19.04.40; Thu, 13 Jun 2019 19:04:55 -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=r+3HHuXP; 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 S1727248AbfFNCEd (ORCPT + 99 others); Thu, 13 Jun 2019 22:04:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52938 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726999AbfFNCEb (ORCPT ); Thu, 13 Jun 2019 22:04:31 -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=2lZSJSMx6Y3MRGPxe0M3M6eDqWU4ZSMnhOq/IvfM44w=; b=r+3HHuXPGS3ZtKMbIKZ/3LhfYS dN1J2cRHSXcLomjjfYB7rcZYIOlTtPXB9ZlJ+GXpTEngauoLdyiBgw9Q6w4bUsdBDfp4IFkBj1oag fw+nAbYDRdmoWbPhUjVTf/hBlNir0nvXNLMKWzrgqdR9VUgTusVAzeCYvpQ8W3dktAW0TKeofKQIh kK0gn+Wg9UQ2CIzoiim26Prh0kAM1seD34W63Cj77+iPzcqu4vl/kS7jjJzfO/Oe4/ihOQMjq6Sb4 wc1IXqTcO2SrBH+zR60kb6t6K0rwx7Y+ApcF2Ec/4+JSIuFTb/6btIgsmtUCZS5nCr7bPh4QFaKgx lFWuTsoA==; Received: from 201.86.169.251.dynamic.adsl.gvt.net.br ([201.86.169.251] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbbZv-0000EG-1y; Fri, 14 Jun 2019 02:04:31 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hbbZo-0002oK-16; Thu, 13 Jun 2019 23:04:24 -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 13/14] sphinx/kernel_abi.py: make it compatible with Sphinx 1.7+ Date: Thu, 13 Jun 2019 23:04:19 -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. Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/kernel_abi.py | 31 ++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py index 32ce90775d96..7fa7806532dc 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -33,7 +33,16 @@ import os from os import path import subprocess -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 from docutils import nodes from docutils.parsers.rst import Directive, directives @@ -145,11 +154,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