summaryrefslogtreecommitdiff
path: root/numpy/distutils/line_endings.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/line_endings.py')
-rw-r--r--numpy/distutils/line_endings.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/distutils/line_endings.py b/numpy/distutils/line_endings.py
index 4f30af06a..65fe2d129 100644
--- a/numpy/distutils/line_endings.py
+++ b/numpy/distutils/line_endings.py
@@ -4,16 +4,16 @@
import sys, re, os
def dos2unix(file):
- "Replace CRLF with LF in argument files. Print names of changed files."
+ "Replace CRLF with LF in argument files. Print names of changed files."
if os.path.isdir(file):
print file, "Directory!"
return
-
+
data = open(file, "rb").read()
if '\0' in data:
print file, "Binary!"
return
-
+
newdata = re.sub("\r\n", "\n", data)
if newdata != data:
print 'dos2unix:', file
@@ -22,7 +22,7 @@ def dos2unix(file):
f.close()
return file
else:
- print file, 'ok'
+ print file, 'ok'
def dos2unix_one_dir(modified_files,dir_name,file_names):
for file in file_names:
@@ -38,11 +38,11 @@ def dos2unix_dir(dir_name):
#----------------------------------
def unix2dos(file):
- "Replace LF with CRLF in argument files. Print names of changed files."
+ "Replace LF with CRLF in argument files. Print names of changed files."
if os.path.isdir(file):
print file, "Directory!"
return
-
+
data = open(file, "rb").read()
if '\0' in data:
print file, "Binary!"
@@ -56,7 +56,7 @@ def unix2dos(file):
f.close()
return file
else:
- print file, 'ok'
+ print file, 'ok'
def unix2dos_one_dir(modified_files,dir_name,file_names):
for file in file_names:
@@ -69,7 +69,7 @@ def unix2dos_dir(dir_name):
modified_files = []
os.path.walk(dir_name,unix2dos_one_dir,modified_files)
return modified_files
-
+
if __name__ == "__main__":
import sys
dos2unix_dir(sys.argv[1])