From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: liming.gao@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Sun, 07 Jul 2019 17:44:28 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2019 17:44:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,464,1557212400"; d="scan'208";a="185566464" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 07 Jul 2019 17:44:28 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 7 Jul 2019 17:44:27 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 7 Jul 2019 17:44:27 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.110]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.60]) with mapi id 14.03.0439.000; Mon, 8 Jul 2019 08:44:25 +0800 From: "Liming Gao" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH V2] BaseTools:Add the Judgment Method of "--exclude" Thread-Topic: [PATCH V2] BaseTools:Add the Judgment Method of "--exclude" Thread-Index: AdUtfxDdzO2I1db+RMSiTXD6vTQe9gHpyttA Date: Mon, 8 Jul 2019 00:44:25 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A35DD@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhiju: Thanks for your fix. Can you list your test case?=20 Thanks Liming >-----Original Message----- >From: Fan, ZhijuX >Sent: Friday, June 28, 2019 3:01 PM >To: devel@edk2.groups.io >Cc: Gao, Liming ; Feng, Bob C >Subject: [PATCH V2] BaseTools:Add the Judgment Method of "--exclude" > >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1944 > >--exclude cannot be used under certain circumstances >1.The value of the parameter USES an absolute path >2.The value of Exclude parameters is based on the value > of the Path parameter >Neither of these approaches currently works > >This patch is going to fix that issue. > >Cc: Liming Gao >Cc: Bob Feng >Signed-off-by: Zhiju.Fan >--- >keep original behavior on >--exclude for the directory name or file name. > > BaseTools/Scripts/FormatDosFiles.py | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/BaseTools/Scripts/FormatDosFiles.py >b/BaseTools/Scripts/FormatDosFiles.py >index d9a880f299..3150bef3c2 100644 >--- a/BaseTools/Scripts/FormatDosFiles.py >+++ b/BaseTools/Scripts/FormatDosFiles.py >@@ -20,7 +20,7 @@ import copy > > __prog__ =3D 'FormatDosFiles' > __version__ =3D '%s Version %s' % (__prog__, '0.10 ') >-__copyright__ =3D 'Copyright (c) 2018, Intel Corporation. All rights re= served.' >+__copyright__ =3D 'Copyright (c) 2018-2019, Intel Corporation. All righ= ts >reserved.' > __description__ =3D 'Convert source files to meet the EDKII C Coding Stan= dards >Specification.\n' > DEFAULT_EXT_LIST =3D ['.h', '.c', '.nasm', '.nasmb', '.asm', '.S', '.inf'= , '.dec', '.dsc', >'.fdf', '.uni', '.asl', '.aslc', '.vfr', '.idf', '.txt', '.bat', '.py'] > >@@ -46,10 +46,26 @@ def FormatFile(FilePath, Args): > def FormatFilesInDir(DirPath, ExtList, Args): > > FileList =3D [] >+ ExcludeDir =3D DirPath > for DirPath, DirNames, FileNames in os.walk(DirPath): > if Args.Exclude: > DirNames[:] =3D [d for d in DirNames if d not in Args.Exclude= ] > FileNames[:] =3D [f for f in FileNames if f not in Args.Exclu= de] >+ Continue =3D False >+ for Path in Args.Exclude: >+ if not os.path.isdir(Path) and not os.path.isfile(Path): >+ Path =3D os.path.join(ExcludeDir, Path) >+ if os.path.isdir(Path) and Path.endswith(DirPath): >+ DirNames[:] =3D [] >+ Continue =3D True >+ elif os.path.isfile(Path): >+ FilePaths =3D FileNames >+ for ItemPath in FilePaths: >+ FilePath =3D os.path.join(DirPath, ItemPath) >+ if Path.endswith(FilePath): >+ FileNames.remove(ItemPath) >+ if Continue: >+ continue > for FileName in [f for f in FileNames if any(f.endswith(ext) for = ext in >ExtList)]: > FileList.append(os.path.join(DirPath, FileName)) > for File in FileList: >-- >2.14.1.windows.1