On Mon, Nov 11, 2019 at 02:38:14PM +0000, Daniel P. Berrangé wrote:
As part of an goal to eliminate Perl from libvirt build tools, rewrite the check-driverimpls.pl tool in Python. This was a straight conversion, manually going line-by-line to change the syntax from Perl to Python. Thus the overall structure of the file and approach is the same. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- Makefile.am | 1 + scripts/check-driverimpls.py | 102 +++++++++++++++++++++++++++++++++++ src/Makefile.am | 4 +- src/check-driverimpls.pl | 80 --------------------------- 4 files changed, 105 insertions(+), 82 deletions(-) create mode 100755 scripts/check-driverimpls.py delete mode 100755 src/check-driverimpls.pl diff --git a/Makefile.am b/Makefile.am index 7155ab6ce9..407a664626 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,7 @@ EXTRA_DIST = \ scripts/augeas-gentest.py \ scripts/check-aclperms.py \ scripts/check-drivername.py \ + scripts/check-driverimpls.py \ scripts/check-spacing.py \ scripts/check-symfile.py \ scripts/check-symsorting.py \ diff --git a/scripts/check-driverimpls.py b/scripts/check-driverimpls.py new file mode 100755 index 0000000000..78d53e75a4 --- /dev/null +++ b/scripts/check-driverimpls.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# +# Copyright (C) 2013-2019 Red Hat, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see +# <http://www.gnu.org/licenses/>. +# + +from __future__ import print_function + +import re +import sys + + +def checkdriverimpls(filename): + intable = False + mainprefix = None + + errs = False + with open(filename, "r") as fh: + lineno = 0 + for line in fh: + lineno = lineno + 1 + if intable: + if line.find("}") != -1: + intable = False + mainprefix = None + continue + + m = re.search(r'''\.(\w+)\s*=\s*(\w+),?/''', line)
With the leftover '/' removed: Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list