From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F0ACC55179 for ; Thu, 29 Oct 2020 00:56:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8D7B20724 for ; Thu, 29 Oct 2020 00:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603932961; bh=sG7DxcBFx0WTmu9b/Xo07LGFBwzzXb1v/PwdPGAsbeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0HhS263w/FtlGNH5XFsBHs82Fn50WOcmbosFVfAiqmm2iFeKARG+QPk1G/9rrrPn7 qAR4wTEutQDi8j5WGqZe88/2bg2Xcs7Qiy+GJE9esmVrAugG72f0IlKJN4IsjfYuTZ VmCSGPMIGF4wUbTeMsyFmcSE0e1VqlHSt8U3wVnw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731647AbgJ1WRi (ORCPT ); Wed, 28 Oct 2020 18:17:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:60502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731512AbgJ1WR1 (ORCPT ); Wed, 28 Oct 2020 18:17:27 -0400 Received: from mail.kernel.org (ip5f5ad5b2.dynamic.kabel-deutschland.de [95.90.213.178]) (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 9EABC2476C; Wed, 28 Oct 2020 14:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603895014; bh=sG7DxcBFx0WTmu9b/Xo07LGFBwzzXb1v/PwdPGAsbeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSxeqrXIceioIEcPe2aPxku+6Se4OlsR3goLHo+5mDm6nNj1ufRzuBeqtVpfnHsg+ NMKMKYmEo7AdPY4FYzApiKKD9Q4Ps3vfx4Xp+p9mkkbcOjes7/QODzUR9pgAWwmMLD Ayn9Ov1vSwqM7wUNQaxJXvhYyJDbNjQYU2XdyLJ4= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kXmMO-003hlJ-Kg; Wed, 28 Oct 2020 15:23:32 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 13/33] docs: kernel_abi.py: fix UTF-8 support Date: Wed, 28 Oct 2020 15:23:11 +0100 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab The parser breaks with UTF-8 characters with Sphinx 1.4. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/kernel_abi.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py index f8e7a02066c2..fe69c213716d 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -1,5 +1,7 @@ # -*- coding: utf-8; mode: python -*- +# coding=utf-8 # SPDX-License-Identifier: GPL-2.0 +# u""" kernel-abi ~~~~~~~~~~ @@ -30,6 +32,7 @@ u""" """ +import codecs import sys import os from os import path @@ -45,14 +48,6 @@ from docutils.utils.error_reporting import ErrorString __version__ = '1.0' -# We can't assume that six is installed -PY3 = sys.version_info[0] == 3 -PY2 = sys.version_info[0] == 2 -if PY3: - # pylint: disable=C0103, W0622 - unicode = str - basestring = str - def setup(app): app.add_directive("kernel-abi", KernelCmd) @@ -117,12 +112,12 @@ class KernelCmd(Directive): cmd , stdout = subprocess.PIPE , stderr = subprocess.PIPE - , universal_newlines = True , **kwargs ) out, err = proc.communicate() - if err: - self.warn(err) + + out, err = codecs.decode(out, 'utf-8'), codecs.decode(err, 'utf-8') + if proc.returncode != 0: raise self.severe( u"command '%s' failed with return code %d" @@ -131,7 +126,7 @@ class KernelCmd(Directive): except OSError as exc: raise self.severe(u"problems with '%s' directive: %s." % (self.name, ErrorString(exc))) - return unicode(out) + return out def nestedParse(self, lines, fname): content = ViewList() -- 2.26.2