From patchwork Fri Feb 21 17:23:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1242258 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=ZypJAPNj; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48PJJ42JVdz9sPK for ; Sat, 22 Feb 2020 04:25:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4CADB81B03; Fri, 21 Feb 2020 18:24:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="ZypJAPNj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5A3F81A25; Fri, 21 Feb 2020 18:24:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2C0FA81989 for ; Fri, 21 Feb 2020 18:24:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1582305851; bh=Be9eGd+ZDlitIyTNg4HXOAB4jToAJGtCsiurQ4VnXeg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZypJAPNjwv+dKYT3foey95vCldote0lQQ0N5bnLMoUaPCS9teSTAfwSKiDlAj8NMv DGWh6GkjuX3j31YQXa8lLBnALfzHvUjMza7HSFEN4HWae+YmD0pKcnEd5HLPr0HTIx +vYxiRxxffqR6zU/+7wgXtJNQabHU678UMC7TXgw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.119.33.160]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MKbgE-1iqyZC3CsW-00KwnT; Fri, 21 Feb 2020 18:24:10 +0100 From: Heinrich Schuchardt To: Tom Rini Cc: Heiko Schocher , Simon Glass , Stephen Warren , Joel Stanley , Marek Vasut , Eugen Hristev , Breno Matheus Lima , Jonathan Corbet , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v2 1/5] doc: update doc/sphinx/kerneldoc.py Date: Fri, 21 Feb 2020 18:23:59 +0100 Message-Id: <20200221172403.5358-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200221172403.5358-1-xypron.glpk@gmx.de> References: <20200221172403.5358-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:kVzXVyNWS7cd9baKxvMyDFtrghZHL36gjDfjEakyT5J7wwZfk2P uaNofy5/7QTIpfTVAB8TeYksPIGazaQIXInW4HgW4/oJCATJkXwe/Q/+5WWiwp/SdBT6Fdb BgFc138U5XgCQJxaXbowyvkXSfwmOu0DqxSm4Qi/blB2kdo54u1dD9S+dkrH/6HQf05YgQ+ l9YfRppseCtJkkIOI57eQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:FLPQi3BdRS8=:I4Wb/muSnPT1EZmc7kHkaQ /CPlTA0LspfuNwp4WnLPnhoIizywxevjNVyB+Q4123+o0YNO5uawvCwFQpF/H0H6yZ5OLuHTb +oYjXHhK9IQzxepWB/4GyKWCm6EEPDyU1K8Y4Wdt5n6m+u9YSgsZj7PfzWFOnek5n2DnOzfVN PTu4IGuy4RMvthEsQlPFvASbwIWvr9G9ow+0O6jw94H+Jra7cvd4uZySeJJfi+1SQd3VgX251 tuIdD6Lv0cicdCW/B2bgs/zg72v+W82TU3UDQtCSnodHSdV8eD3LQbqHpHE8bWHQwtxSPU1tA IVDllUZFDW4mUcQmLIQXleBeCZ7VMUKTw8n3mAQm3YkDZp5IJcHlEx9kM8TFI5/RnUS+URa5/ Cl6TrQsU6Q0pYT+eZly+8hI498AGTQi/Ap7DRVLG/D4XoZK8MdFJK1aHUJVOw9hVtxkyOvwJV tl/GQl1P+6Hs9ZtCUCK5nVP3ZqpDaqA67B1elpIuSFhwKfmT2PQk6QA0MNakaxpMTzBgAIkkT lvypL6FDIa4I9RGELFlVXAF+vq1k3I5/6PecGj5gmn/A2s+kr2temfgG+bjz0uKjoSM2MyGit t8BaibHjxXHOPAeahGBLff24rDZ6ixWymN4LMu4nfYqCN72UKlAXUZK9yIQO6GsmoSbZqFtjb gVXeslG4cGWeyECVWnVvnLYZrqeORrb9VURovgB1+6/P52ZnomRA8Gqn1EOXtbo/4yUW7Q8gZ I9chVEmiNEK4LEbJMvV9Thqitbr4B3xTsD/r7R93qZulpYSMgqWnfpclMimzcnpfclmKb/AkF 7qV2oX5ywgpCFiHYpSyUrFzCyRVoKfemsVqVAP5WZcOQjYq/pQBazwMn+xvlcQkz7xDTNDwN3 fe6MxT1m5S3+zNFnzj3DfFa4RmaSP+00rJQjF2ckvKzDnLzOeByLQ2BDHa980xysRYGQAUvCs ub1/Qv07t4c1kaC7D/OJV2VDsHAdNITmUXllaqQGvl+EtlNGRbV7swY1nYOl5nYtQaYWQiBFx pBwqnbTtTzgGZ1fG4MELkdzA9ocLhkzqAvzGxz7Qw+SvSoSPNJ2bSZ1J2kswRkSngbQTLkTD6 X9I8bp2AhN/pjAF9eXEmMXEh7roQlm1GeAk1A5GS8XHAiShDqHLX+B/QoDX+ywdjaQaOrDhId UaC9D0mQI53o2RCMhlnHc3Q8oUSCq8FDkIrYMSHaZtF0ALPTZf9V3I899CgOxc12elLQh+LeD yPo8UeT9XqRmMY05M X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Update doc/sphinx/kerneldoc.py from Linux next-20200219 to avoid warnings like: doc/sphinx/kerneldoc.py:125: RemovedInSphinx20Warning: AutodocReporter is now deprecated. Use sphinx.util.docutils.switch_source_input() instead. self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter) Signed-off-by: Heinrich Schuchardt --- v2: new patch --- doc/sphinx/kerneldoc.py | 51 +++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 12 deletions(-) -- 2.25.0 diff --git a/doc/sphinx/kerneldoc.py b/doc/sphinx/kerneldoc.py index e536360de1..4bcbd6ae01 100644 --- a/doc/sphinx/kerneldoc.py +++ b/doc/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 import kernellog @@ -49,9 +59,10 @@ class KernelDocDirective(Directive): optional_arguments = 4 option_spec = { 'doc': directives.unchanged_required, - 'functions': directives.unchanged_required, 'export': directives.unchanged, 'internal': directives.unchanged, + 'identifiers': directives.unchanged, + 'functions': directives.unchanged, } has_content = False @@ -67,6 +78,10 @@ class KernelDocDirective(Directive): tab_width = self.options.get('tab-width', self.state.document.settings.tab_width) + # 'function' is an alias of 'identifiers' + if 'functions' in self.options: + self.options['identifiers'] = self.options.get('functions') + # FIXME: make this nicer and more robust against errors if 'export' in self.options: cmd += ['-export'] @@ -76,9 +91,13 @@ class KernelDocDirective(Directive): export_file_patterns = str(self.options.get('internal')).split() elif 'doc' in self.options: cmd += ['-function', str(self.options.get('doc'))] - elif 'functions' in self.options: - for f in str(self.options.get('functions')).split(): - cmd += ['-function', f] + elif 'identifiers' in self.options: + identifiers = self.options.get('identifiers').split() + if identifiers: + for i in identifiers: + cmd += ['-function', i] + else: + cmd += ['-no-doc-sections'] for pattern in export_file_patterns: for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern): @@ -121,13 +140,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 +149,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')