[pypy-svn] rev 2318 - pypy/trunk/src/pypy/tool
sschwarzer at codespeak.net
sschwarzer at codespeak.net
Mon Dec 15 14:26:31 CET 2003
Author: sschwarzer
Date: Mon Dec 15 14:26:31 2003
New Revision: 2318
Modified:
pypy/trunk/src/pypy/tool/fixeol
Log:
Removed hack for getting the native line ending; this value already exists
as os.linesep .
Modified: pypy/trunk/src/pypy/tool/fixeol
==============================================================================
--- pypy/trunk/src/pypy/tool/fixeol (original)
+++ pypy/trunk/src/pypy/tool/fixeol Mon Dec 15 14:26:31 2003
@@ -18,17 +18,7 @@
return False
-# hack to get the platform's native end-of-line format
-f = open('@fixeol at tmp.txt', 'w')
-print >> f
-f.close()
-f = open('@fixeol at tmp.txt', 'rb')
-native_eol = f.read()
-f.close()
-os.unlink('@fixeol at tmp.txt')
-
-
-def binary2text(filename, native_eol = native_eol):
+def binary2text(filename):
"Convert a file to the platform's native end-of-line format if needed."
f = open(filename, 'rb')
data = f.read()
@@ -38,7 +28,7 @@
original = data
data = data.replace('\r\n', '\n')
data = data.replace('\r', '\n')
- data = data.replace('\n', native_eol)
+ data = data.replace('\n', os.linesep)
if data != original:
f = open(filename, 'wb')
f.write(data)
More information about the Pypy-commit
mailing list