From patchwork Fri Mar 16 18:05:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 131939 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp643026edb; Fri, 16 Mar 2018 11:12:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELs87YXqnLcJcKg+rAF6GYriuI/nfMlZO1V5A1wrbB2WghBMTcsHlz36Evi34GwJGv+0Lo3P X-Received: by 10.202.193.214 with SMTP id r205mr1784230oif.139.1521223954078; Fri, 16 Mar 2018 11:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521223954; cv=none; d=google.com; s=arc-20160816; b=CdIrTi9CKwq+4+KpzTIna/DdHx0wSkJrz8uIOvUX2Nr20+z+y7G+IvihexZEAvkVRx lEnyNYL0pKRuDdlRqXPUY/DUbRKZ/Aj3Ei78OdxwBN53aGAqx7CWs3BECQIIvbUY678K q2jjbmKmmIXS1ejGQyKuUnd0gH/eLjl+cnotXjrm531b5JARqxsMVd0/+FuEB26QGMVs L+8/NZCSvtVOZB6FLdLRsaMDHpkOv0pAC3gXI2jcuSQCUmBTkr9EsMy33xkARkxWLBrh bybT/D8M3HAhvPg4EnfRQ0nzwH3lV0DR10kjw2Vr+/vPF7KzSQS4Ksn8U6HxQuqnDtMF YbUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=fQgax75nktGRS9VWxFisPTKx4D4afJTp2tDdy05L1H0=; b=IWE+Y6EGSgAndh2dNln1DGAYeY8bCUzw0FXjmywRD9chkCKJpjWF17X1r12KlbaaiO u+vG7lHOGaccuz4rs3zy3mdLTqL//AD6t/Yj6B3ZuyKMskhW9o/Zdg+jxXDbq3mGmyYm J0SgRdnJkEMconl8kWJ+GBpL4dFfL0rh5i9pEGLV36EGRPy+mnxlBmYoMLoY3TznlKjP q0g4SugVyIq2KG9tRhCQA0PEjH0H7kr5/KYwz2AOg7nZ9GSQ+u4XElWy2cV1iaaHmiTU UcXAs+gJwGghqgq+Ni28bh22fW3xMnf5UWCZGpVtOGYe36hqzhWw0Pb0HI14kFI+QXpD ZLbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id s187si2157276oia.325.2018.03.16.11.12.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 11:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF83283F45; Fri, 16 Mar 2018 18:12:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9120D6A043; Fri, 16 Mar 2018 18:12:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 58D67181B9FB; Fri, 16 Mar 2018 18:12:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2GI5RDi000467 for ; Fri, 16 Mar 2018 14:05:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35ACC5D725; Fri, 16 Mar 2018 18:05:27 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-116-212.phx2.redhat.com [10.3.116.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3CAA5D72A; Fri, 16 Mar 2018 18:05:25 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 16 Mar 2018 14:05:12 -0400 Message-Id: <1e60444afa0362390d4e61e483e874302d1e98ec.1521222704.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 2/2] apibuild: Fix -refs.xml building X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 16 Mar 2018 18:12:33 +0000 (UTC) Another usage of deprecated 'string' functions. We are just trying to match ascii letters here, so use a simple regex. And again drop the aggressive exception handling, it doesn't seem to trigger for anything in libvirt code. Signed-off-by: Cole Robinson --- docs/apibuild.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) -- 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Daniel P. Berrangé diff --git a/docs/apibuild.py b/docs/apibuild.py index e81980e3c..51abf8383 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -11,7 +11,6 @@ from __future__ import print_function import os, sys -import string import glob import re @@ -2092,23 +2091,20 @@ class docBuilder: str = str.replace(';', ' ') tokens = str.split() for token in tokens: - try: - c = token[0] - if string.letters.find(c) < 0: - pass - elif len(token) < 3: + c = token[0] + if not re.match(r"[a-zA-Z]", c): + pass + elif len(token) < 3: + pass + else: + lower = token.lower() + # TODO: generalize this a bit + if lower == 'and' or lower == 'the': pass + elif token in self.xref: + self.xref[token].append(id) else: - lower = string.lower(token) - # TODO: generalize this a bit - if lower == 'and' or lower == 'the': - pass - elif token in self.xref: - self.xref[token].append(id) - else: - self.xref[token] = [id] - except: - pass + self.xref[token] = [id] def analyze(self): if not quiet: