From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=OuSpgo/v; spf=pass (domain: linaro.org, ip: 209.85.221.68, mailfrom: leif.lindholm@linaro.org) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by groups.io with SMTP; Mon, 02 Sep 2019 12:04:42 -0700 Received: by mail-wr1-f68.google.com with SMTP id q12so14929946wrj.12 for ; Mon, 02 Sep 2019 12:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=SvydQc2H0y3GoRa+o/gKqNjDD4TYX9vtS4pNx/QxFb8=; b=OuSpgo/vjC+WfLDPLTV4be64Sq+VsXoymzTK96lvLOljNx4N+8qYVMgxm/wG8h6B5H jH2gF8iDKKm9BBi0DkfgEUzFCLyHlQPanBbzq4N9zetl/Yst+9d6a3r5YrpXLVDpa0po Xw579zVGdHKbmnHnNm33dcuABNiT+uSWBvPQKs6vWycwsN+iDVCOw0ZYP006/GUPILsW 7w58xO1yRsRhGH6dmZG8RXtzZ90ckBvXUgd8wNcZ21myj3kcR0SMDlvBSUjIWKjL+Wa4 u92Bnhb+aKf1gDqMlqruZWmpT7yirwwyPY7YAjuRH2HPtkRnNNrodYbYEmWuAp+Z3zj5 Xxhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=SvydQc2H0y3GoRa+o/gKqNjDD4TYX9vtS4pNx/QxFb8=; b=XmLFwV+qm3C7rXNfTl37/pU0WqPoYaYiB5LF6Yfsqh8bB1KEq4zE5zapZwuQ/AP0d/ qECyAZUc1E5uob5uRdCVajhWdS34uJqXvm7NNXKXxr3nUP+QVDTw6BvWrSRrKyzhXQO0 Mf4aKjd9tS96OQ3Yp/Iz733kfDChyJV9DLiHEytY4csB4yugoJ4YiYblCvolfAGJDcVR CfUuNmi+738R7Sbydyq5DQOCXtoPkDnwuv+F+qq6OC+LNptUt4nG1+KuJVe+tH7PZ1HT RoJ2OfVnq0T6qlCUg2yZ3KPT6BCryJvY4ADFHyRmmcYZl0+o+lNUxkX1Ik/nksz3l6n3 zNyQ== X-Gm-Message-State: APjAAAU24OsmT0nV2q7OqIoeJ2g5G3OwVFmBdPoBzxSF3+58sjAtvgKp IvvvwyGZeEO84Ief1v7Kj96wfA== X-Google-Smtp-Source: APXvYqzEFGvxvcz9FKdRNgEi0eaR3afqxY/2qLNDoo4WgIj+iGM90j0dYmnW2vFNlwKucXBuRbuyag== X-Received: by 2002:a5d:4a03:: with SMTP id m3mr29985040wrq.182.1567451080805; Mon, 02 Sep 2019 12:04:40 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id t14sm15707795wrs.58.2019.09.02.12.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 12:04:40 -0700 (PDT) Date: Mon, 2 Sep 2019 20:04:38 +0100 From: "Leif Lindholm" To: "Feng, Bob C" Cc: devel@edk2.groups.io, Liming Gao Subject: Re: [edk2] [Patch 32/33] BaseTools: ECC tool Python3 adaption Message-ID: <20190902190438.GA29255@bivouac.eciton.net> References: <20190129020610.14300-1-bob.c.feng@intel.com> <20190129020610.14300-33-bob.c.feng@intel.com> <20190902190211.GZ29255@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: <20190902190211.GZ29255@bivouac.eciton.net> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Argh - forgot about the mailing list move, forwarding to current list. / Leif On Mon, Sep 02, 2019 at 08:02:11PM +0100, Leif Lindholm wrote: > Hi Bob, >=20 > I was running Ecc today, apparently for the first time since I > switched to Python3 by default. >=20 > I have raised https://bugzilla.tianocore.org/show_bug.cgi?id=3D2148 over > the way Python3 hard codes use of antlr4, whereas it seems to me it > should be possible to ue Python3 with antlr3 (but not Python2 with > antlr4). >=20 > However, whilst that issue could be looked at without extreme urgency, > I am curious as to what is causing the error I am seeing upon working > around the import failure on my Debian installation (which lacks > python3-antlr4). >=20 > The output I get when running > $ Ecc -t /work/git/edk2/EmbeddedPkg/Drivers/DtPlatformDxe/ -s >=20 > is >=20 > --- > /work/git/edk2/BaseTools/Source/Python/Ecc/EccMain.py:409: DeprecationWar= ning: time.clock has been deprecated in Python 3.3 and will be removed from= Python 3.8: use time.perf_counter or time.process_time instead > StartTime =3D time.clock() > 11:44:43, Sep.02 2019 [00:00] >=20 > Loading ECC configuration ... done > Building database for Meta Data File Done! > Parsing //work/git/edk2/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c > Traceback (most recent call last): > File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main > "__main__", mod_spec) > File "/usr/lib/python3.7/runpy.py", line 85, in _run_code > exec(code, run_globals) > File "/work/git/edk2/BaseTools/Source/Python/Ecc/EccMain.py", line 410,= in > Ecc =3D Ecc() > File "/work/git/edk2/BaseTools/Source/Python/Ecc/EccMain.py", line 94, = in __init__ > self.DetectOnlyScanDirs() > File "/work/git/edk2/BaseTools/Source/Python/Ecc/EccMain.py", line 130,= in DetectOnlyScanDirs > self.BuildDatabase() > File "/work/git/edk2/BaseTools/Source/Python/Ecc/EccMain.py", line 150,= in BuildDatabase > c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget) > File "/work/git/edk2/BaseTools/Source/Python/Ecc/c.py", line 526, in Co= llectSourceCodeDataIntoDB > collector.ParseFile() > File "/work/git/edk2/BaseTools/Source/Python/Ecc/CodeFragmentCollector.= py", line 517, in ParseFile > lexer =3D CLexer(cStream) > File "/work/git/edk2/BaseTools/Source/Python/Ecc/CParser3/CLexer.py", l= ine 147, in __init__ > Lexer.__init__(self, input) > File "/usr/lib/python3/dist-packages/antlr3/recognizers.py", line 1039,= in __init__ > BaseRecognizer.__init__(self, state) > File "/usr/lib/python3/dist-packages/antlr3/recognizers.py", line 169, = in __init__ > .format(self.api_version)) > RuntimeError: ANTLR version mismatch: The recognizer has been generated w= ith API V0, but this runtime does not support this. > --- >=20 > Any idea? >=20 > Best Regards, >=20 > Leif >=20 > On Tue, Jan 29, 2019 at 10:06:09AM +0800, Feng, Bob C wrote: > > v2: > > The python files under CParser4 are generated by antlr4 and for > > python3 usage. They have python3 specific syntax, for example > > the data type declaration for the arguments of a function. That > > is not compitable with python2. this patch is to remove these syntax. > >=20 > > ECC tool Python3 adaption. > >=20 > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Bob Feng > > Cc: Liming Gao > > --- > > BaseTools/Source/Python/Ecc/{ =3D> CParser3}/CLexer.py | 0 > > BaseTools/Source/Python/Ecc/{ =3D> CParser3}/CParser.py | 0 > > BaseTools/Source/Python/Ecc/CParser3/__init__.py | 0 > > BaseTools/Source/Python/Ecc/CParser4/C.g4 | 637 +++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++ > > BaseTools/Source/Python/Ecc/CParser4/CLexer.py | 632 +++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++ > > BaseTools/Source/Python/Ecc/CParser4/CListener.py | 815 +++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++ > > BaseTools/Source/Python/Ecc/CParser4/CParser.py | 6279 +++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++ > > + > > BaseTools/Source/Python/Ecc/CParser4/__init__.py | 0 > > BaseTools/Source/Python/Ecc/Check.py | 4 +- > > BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 20 +-- > > BaseTools/Source/Python/Ecc/Configuration.py | 3 - > > BaseTools/Source/Python/Ecc/EccMain.py | 2 +- > > BaseTools/Source/Python/Ecc/EccToolError.py | 4 +- > > BaseTools/Source/Python/Ecc/FileProfile.py | 2 +- > > BaseTools/Source/Python/Ecc/MetaDataParser.py | 2 +- > > BaseTools/Source/Python/Ecc/c.py | 6 +- > > BaseTools/Source/Python/Ecc/config.ini | 2 - > > 17 files changed, 8385 insertions(+), 23 deletions(-)