4 if not sys
.platform
== "win32":
5 raise Exception("This script was only meant for Windows.")
10 print "dos2unix: %s" % path
17 outf
= open(path
, "wb")
32 def walkdirectory(path
):
33 if not os
.path
.exists(os
.path
.join(path
, "CVS")):
36 print "Directory: %s" % path
39 cvsf
= os
.path
.join(path
, "CVS", f
)
40 if os
.path
.exists(cvsf
):
43 entries
= open(os
.path
.join(path
, "CVS", "Entries"), "r")
48 (type, filename
, rev
, date
, flags
, extra
) = entry
.split('/')
49 if type == "D" or flags
== "-kb" or rev
[0] == "-":
52 dos2unix(os
.path
.join(path
, filename
))
54 # Now walk subdirectories
55 for entry
in os
.listdir(path
):
56 subdir
= os
.path
.join(path
, entry
)
57 if os
.path
.isdir(subdir
):
60 topsrcdir
= os
.sep
.join(os
.path
.abspath(__file__
).split(os
.sep
)[:-3])
62 print """This command will convert the source tree at
64 to an MSYS-compatible (unix mode) source tree. You can run this
65 command multiple times safely. Are you sure you want to continue (Y/N)? """ % topsrcdir
,
70 if len(ask
) == 0 or (ask
[0] != "y" and ask
[0] != "Y"):
71 raise Exception("User aborted action.")
73 walkdirectory(topsrcdir
)