\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