#\r
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
\r
#\r
\r
__prog__ = 'FormatDosFiles'\r
__version__ = '%s Version %s' % (__prog__, '0.10 ')\r
-__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.'\r
+__copyright__ = 'Copyright (c) 2018-2019, Intel Corporation. All rights reserved.'\r
__description__ = 'Convert source files to meet the EDKII C Coding Standards Specification.\n'\r
DEFAULT_EXT_LIST = ['.h', '.c', '.nasm', '.nasmb', '.asm', '.S', '.inf', '.dec', '.dsc', '.fdf', '.uni', '.asl', '.aslc', '.vfr', '.idf', '.txt', '.bat', '.py']\r
\r
def FormatFilesInDir(DirPath, ExtList, Args):\r
\r
FileList = []\r
+ ExcludeDir = DirPath\r
for DirPath, DirNames, FileNames in os.walk(DirPath):\r
if Args.Exclude:\r
DirNames[:] = [d for d in DirNames if d not in Args.Exclude]\r
FileNames[:] = [f for f in FileNames if f not in Args.Exclude]\r
+ Continue = False\r
+ for Path in Args.Exclude:\r
+ Path = Path.strip('\\').strip('/')\r
+ if not os.path.isdir(Path) and not os.path.isfile(Path):\r
+ Path = os.path.join(ExcludeDir, Path)\r
+ if os.path.isdir(Path) and Path.endswith(DirPath):\r
+ DirNames[:] = []\r
+ Continue = True\r
+ elif os.path.isfile(Path):\r
+ FilePaths = FileNames\r
+ for ItemPath in FilePaths:\r
+ FilePath = os.path.join(DirPath, ItemPath)\r
+ if Path.endswith(FilePath):\r
+ FileNames.remove(ItemPath)\r
+ if Continue:\r
+ continue\r
for FileName in [f for f in FileNames if any(f.endswith(ext) for ext in ExtList)]:\r
FileList.append(os.path.join(DirPath, FileName))\r
for File in FileList:\r