[Zope3-dev] DOS file endings not allowed in text files in CVS
Guido van Rossum
guido@python.org
Wed, 13 Nov 2002 14:29:44 -0500
> What they should do is one of the following:
>
> 1. Use a CVS windows client
>
> - Check out on windows
>
> - Edit files on windows
>
> - Check in the changes on windows
>
> Note you can still run and test on unix if you check into
> a shared file system.
>
> 2. Do all the work on windows. I'm sorry to say that I'm
> not familiar with running Zope 3 on windows, so I don't
> know if this poses any difficulties.
>
> 3. Edit the files on Unix. I can recommend a good editor. ;)
Or:
4. Before checking in from Unix, normalize line endings. I use
Tools/scripts/crlf.py from the Python distribution:
#! /usr/bin/env python
"Replace CRLF with LF in argument files. Print names of changed files."
import sys, re, os
for file in sys.argv[1:]:
if os.path.isdir(file):
print file, "Directory!"
continue
data = open(file, "rb").read()
if '\0' in data:
print file, "Binary!"
continue
newdata = re.sub("\r\n", "\n", data)
if newdata != data:
print file
f = open(file, "wb")
f.write(newdata)
f.close()
--Guido van Rossum (home page: http://www.python.org/~guido/)