From nobody Sun May 5 19:06:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568282245; cv=none; d=zoho.com; s=zohoarc; b=UZvoP4iK3GHTM0IKH5qp/0LET1EIu/67It9iX+jS1OjUsTLrr+sD8z2Si4zQyImrjAlscNDJE7XlNrjRc/dq69E0Rb5wxGkv3/P+uQz7RUWj650s0BCnyp/xYFJFBMjcIXCVQAzHotzHm6aNnOhUWYtOfyby1xGtnvQVUaIVrdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568282245; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=hlKdRz36N87ew+bI2WZYmiW7CUbiztGwiA50hpNpBus=; b=ArRcawgZ8Xxs1itAi8t6tG+psaAuWfxcCTtLy3shgUl+R8fBmjIug4qPpoKAQTaZtgX1eNrgpeiy7RBSzUf0wgMkZd2qYb6/Ngn9+uCHS4IvaH5LQgjZjWvsAaiav6jwa2kwsdWmqlIqlqO+PXsqaoQN/gA4r+ibiyxxAsm0qf4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568282245216239.98454335506779; Thu, 12 Sep 2019 02:57:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B13C10CC1E0; Thu, 12 Sep 2019 09:57:22 +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 E1CBD5D9E2; Thu, 12 Sep 2019 09:57:21 +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 5FAD1180B536; Thu, 12 Sep 2019 09:57:19 +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 x8C9uchC031294 for ; Thu, 12 Sep 2019 05:56:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E8E25D9E5; Thu, 12 Sep 2019 09:56:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx29.extmail.prod.ext.phx2.redhat.com [10.5.110.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18D035D9E2 for ; Thu, 12 Sep 2019 09:56:35 +0000 (UTC) Received: from mail-m24147.qiye.163.com (mail-m24147.qiye.163.com [220.194.24.147]) by mx1.redhat.com (Postfix) with ESMTP id 280DA18C8933 for ; Thu, 12 Sep 2019 09:56:31 +0000 (UTC) Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp4 (Coremail) with SMTP id JedpCgDnT49LFnpdTn4HAw--.262S2; Thu, 12 Sep 2019 17:56:27 +0800 (CST) From: Shi Lei To: libvir-list@redhat.com Date: Thu, 12 Sep 2019 17:55:38 +0800 Message-Id: <20190912095538.26842-1-shi_lei@massclouds.com> X-CM-TRANSID: JedpCgDnT49LFnpdTn4HAw--.262S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUr1vaUUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiGw4uT1pcgwaq-wAAsi X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Thu, 12 Sep 2019 09:56:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Thu, 12 Sep 2019 09:56:32 +0000 (UTC) for IP:'220.194.24.147' DOMAIN:'mail-m24147.qiye.163.com' HELO:'mail-m24147.qiye.163.com' FROM:'shi_lei@massclouds.com' RCPT:'' X-RedHat-Spam-Score: 0.002 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE) 220.194.24.147 mail-m24147.qiye.163.com 220.194.24.147 mail-m24147.qiye.163.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.70 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 12 Sep 2019 09:57:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now sc_prohibit_semicolon_at_eol_in_python can't handle semicolon within multiline strings(comments) properly. I suggest that we could use pep8 to check python code style error, such as 'statement ends with a semicolon'. In future, we could use '--select' to introduce other rules. Signed-off-by: Shi Lei --- cfg.mk | 6 ++---- configure.ac | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cfg.mk b/cfg.mk index 42e1abf0..c8eaf74e 100644 --- a/cfg.mk +++ b/cfg.mk @@ -813,10 +813,8 @@ sc_require_enum_last_marker: =20 # In Python files we don't want to end lines with a semicolon like in C sc_prohibit_semicolon_at_eol_in_python: - @prohibit=3D'^[^#].*\;$$' \ - in_vc_files=3D'\.py$$' \ - halt=3D'python does not require to end lines with a semicolon' \ - $(_sc_search_regexp) + @$(VC_LIST_EXCEPT) | $(GREP) '\.py$$' | xargs $(PEP8) --select E703 \ + | $(GREP) . && { exit 1; } || : =20 # mymain() in test files should use return, not exit, for nicer output sc_prohibit_exit_in_tests: diff --git a/configure.ac b/configure.ac index bf9e7681..37fa9924 100644 --- a/configure.ac +++ b/configure.ac @@ -704,6 +704,10 @@ AC_PATH_PROGS([PYTHON], [python3 python2 python]) if test -z "$PYTHON"; then AC_MSG_ERROR(['python3', 'python2' or 'python' binary is required to b= uild libvirt]) fi +AC_PATH_PROG([PEP8], [pep8]) +if test -z "$PEP8"; then + AC_MSG_ERROR(['pep8' binary is required to check python code style]) +fi AC_PATH_PROG([PERL], [perl]) if test -z "$PERL"; then AC_MSG_ERROR(['perl' binary is required to build libvirt]) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list