Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1308721pxx; Fri, 30 Oct 2020 07:12:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA7CPmXJPViWL6InIVqHgQb0R6xL6+7TxLYd6m0zUvCG4LhCPkNcdextAzZmW4qIkeFMP7 X-Received: by 2002:a50:e149:: with SMTP id i9mr2669746edl.56.1604067158944; Fri, 30 Oct 2020 07:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604067158; cv=none; d=google.com; s=arc-20160816; b=QZ261lCS+riKI7e1zPRI2Aq4/JHwblC6DV1iCC6zyCNgwI1dfBVSZNPPdL9lRNde7v 19638JhXbQGMLaWxCB7i48eG/WYxh8NKyTGtyveow0hi9FstFzGjjEIccc+gmBmXZPiX 42WqfLAgqy6lzhKahWmd9UkHK5bUOUxBJJcYRLu+EOCbXspP+2DeCHQ0OyFc5QsMiim6 Wv3/6LaPFdOVw4HHaUrjTiZxG/sqgyUnCwCbNrJXVi1qCVI45pcpMYRPG4Mmph/td8Ah vmrscpOE4OSMBDxlhru1FsmGe9Sa6j1FE7qAmq94ypSg7qOXxBXS4umnFV1EMhxJnUPp SV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=d57X0iZjpKOEoDPQ4hpXoF/7MqJaXtN1kD847BGW6PU=; b=A8lE/X9zPOj4jrdxq0gWn+d/pz+Sa9gQ441+24PMfdsk8yCMeG1VujKHjYjrxBJdlx PB3LtgiYiyDp2rES95Qv04Lb4doLBb9zF5xxHTvCE5o30lPBxKsxqIgMuoApK9qO2Wgs jQbAoTOuSDpJnfuyq28XQVcprJqO3nRWTPSrmVubtVmIxYm501mb6qk0O3RBSO42G+7V 3e7l4Q0H3/TnnnRAqVPwqktVH/HFEpJS1RJi/VqGqe2mDY8CekI4ulJYJ5UyBJZf4Qh9 k/d/m1APaK/RnZQwFe017hjhKUdVA4u6CMgc/OOQaDkYcyA9F4YQN51to36ncKzlNMIy iNKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FRXIwTOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si4285244edj.223.2020.10.30.07.12.16; Fri, 30 Oct 2020 07:12:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FRXIwTOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbgJ3OKe (ORCPT + 99 others); Fri, 30 Oct 2020 10:10:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgJ3OKc (ORCPT ); Fri, 30 Oct 2020 10:10:32 -0400 Received: from coco.lan (ip5f5ad5bb.dynamic.kabel-deutschland.de [95.90.213.187]) (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 763E0206F7; Fri, 30 Oct 2020 14:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604067031; bh=vtiRxNbEy+gM88Ub3zLztcjaUW8rsYPrflGqYT98Cp4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FRXIwTOCwrgNpPpAwII8TU2AKjH+oJ+vWUF+020EC6eZ3SFlT5iDE9vEzbdyId8e/ eSKzQ/GHfGrWInrSygQJXo9+yxWQ9Z0DBDbDEjklDrg/Rxo8+p0bc6PG06lRN8h2OU WhTU+nalICuNkZLhL74oR3VpXcsmktJOSLm1RPTo= Date: Fri, 30 Oct 2020 15:10:26 +0100 From: Mauro Carvalho Chehab To: Dafna Hirschfeld Cc: "=?UTF-8?B?TsOtY29sYXM=?= F. R. A. Prado" , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com Subject: Python 2.7 support and automarkup.py - Was: Re: [PATCH v2 1/5] docs: automarkup.py: Use new C roles in Sphinx 3 Message-ID: <20201030151026.3afd7997@coco.lan> In-Reply-To: <5053e824-625b-5a76-d862-2c855c79c427@collabora.com> References: <20201013231218.2750109-1-nfraprado@protonmail.com> <20201013231218.2750109-2-nfraprado@protonmail.com> <5053e824-625b-5a76-d862-2c855c79c427@collabora.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dafna, Em Fri, 30 Oct 2020 14:33:52 +0100 Dafna Hirschfeld escreveu: > Hi >=20 > Am 14.10.20 um 01:13 schrieb N=C3=ADcolas F. R. A. Prado: > > While Sphinx 2 used a single c:type role for struct, union, enum and > > typedef, Sphinx 3 uses a specific role for each one. > > To keep backward compatibility, detect the Sphinx version and use the > > correct roles for that version. > >=20 > > Signed-off-by: N=C3=ADcolas F. R. A. Prado > > --- > > Documentation/sphinx/automarkup.py | 55 ++++++++++++++++++++++++++---- > > 1 file changed, 49 insertions(+), 6 deletions(-) > >=20 > > diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/= automarkup.py > > index a1b0f554cd82..db13fb15cedc 100644 > > --- a/Documentation/sphinx/automarkup.py > > +++ b/Documentation/sphinx/automarkup.py > > @@ -23,7 +23,21 @@ from itertools import chain > > # bit tries to restrict matches to things that won't create trouble. > > # > > RE_function =3D re.compile(r'(([\w_][\w\d_]+)\(\))') > > -RE_type =3D re.compile(r'(struct|union|enum|typedef)\s+([\w_][\w\d_]+)= ') > > + > > +# > > +# Sphinx 2 uses the same :c:type role for struct, union, enum and type= def > > +# > > +RE_generic_type =3D re.compile(r'(struct|union|enum|typedef)\s+([\w_][= \w\d_]+)') > > + > > +# > > +# Sphinx 3 uses a different C role for each one of struct, union, enum= and > > +# typedef > > +# > > +RE_struct =3D re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=3Dre.AS= CII) > > +RE_union =3D re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=3Dre.ASCI= I) > > +RE_enum =3D re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=3Dre.ASCII) > > +RE_typedef =3D re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=3Dre.= ASCII) =20 >=20 > I use ubuntu 18.04, my default python is 2.7, > when running 'make htmldocs' with that fix I get: >=20 > AttributeError: 'module' object has no attribute 'ASCII' FYI, there's a discussion at kernel-doc ML about dropping support for python 2.7 at Kernel 5.11. While not explicitly mentioned at the discussion, this is the rationale: https://www.python.org/doc/sunset-python-2/ As this is currently broken with Python 2.7, then perhaps we can do that for 5.10 :-) Jon, What do you think?=20 I see a few alternatives: 1) fix automarkup.py for it to work again with python 2.7; 2) conf.py could gain some logic to disable automarkup with Python < 3; 3) scripts/sphinx-pre-install already detects Python version.=20 It should likely be easy to ask the user to use python 3.x, if an older version is detected. Doing (1) or (2) will require an additional step when we raise the bar for Python version. Thanks, Mauro