source: python/vendor/Python-2.7.6/Tools/scripts/crlf.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 611 bytes
Line 
1#! /usr/bin/env python
2"Replace CRLF with LF in argument files. Print names of changed files."
3
4import sys, os
5
6def main():
7 for filename in sys.argv[1:]:
8 if os.path.isdir(filename):
9 print filename, "Directory!"
10 continue
11 data = open(filename, "rb").read()
12 if '\0' in data:
13 print filename, "Binary!"
14 continue
15 newdata = data.replace("\r\n", "\n")
16 if newdata != data:
17 print filename
18 f = open(filename, "wb")
19 f.write(newdata)
20 f.close()
21
22if __name__ == '__main__':
23 main()
Note: See TracBrowser for help on using the repository browser.