From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: liming.gao@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Wed, 07 Aug 2019 05:01:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 05:01:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,357,1559545200"; d="scan'208";a="373746959" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 07 Aug 2019 05:01:40 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 05:01:40 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 05:01:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Wed, 7 Aug 2019 20:01:37 +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+RMSiTXD6vTQe9gfmMWyA Date: Wed, 7 Aug 2019 12:01:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4CBE29@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 Sorry for the missing. Reviewed-by: Liming Gao >-----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