]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/lfcr.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Tools / scripts / lfcr.py
CommitLineData
4710c53d 1#! /usr/bin/env python\r
2\r
3"Replace LF with CRLF in argument files. Print names of changed files."\r
4\r
5import sys, re, os\r
6\r
7def main():\r
8 for filename in sys.argv[1:]:\r
9 if os.path.isdir(filename):\r
10 print filename, "Directory!"\r
11 continue\r
12 data = open(filename, "rb").read()\r
13 if '\0' in data:\r
14 print filename, "Binary!"\r
15 continue\r
16 newdata = re.sub("\r?\n", "\r\n", data)\r
17 if newdata != data:\r
18 print filename\r
19 f = open(filename, "wb")\r
20 f.write(newdata)\r
21 f.close()\r
22\r
23if __name__ == '__main__':\r
24 main()\r