Staging
v0.5.1
https://github.com/python/cpython
Revision f31f6c952f5975d7f6c7208335495da8d7fe34ac authored by R. David Murray on 23 February 2010, 23:03:49 UTC, committed by R. David Murray on 23 February 2010, 23:03:49 UTC
................
  r78388 | r.david.murray | 2010-02-23 17:57:58 -0500 (Tue, 23 Feb 2010) | 11 lines

  Merged revisions 78384 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78384 | dirkjan.ochtman | 2010-02-23 16:09:52 -0500 (Tue, 23 Feb 2010) | 4 lines

    Fix #1537721: add writeheader() method to csv.DictWriter.

    Reviewed by skip.montanaro and thomas.wouters.
  ........
................
  r78389 | r.david.murray | 2010-02-23 18:00:34 -0500 (Tue, 23 Feb 2010) | 2 lines

  Fix version added for csv writeheader.
................
1 parent 41c5d2f
Raw File
Tip revision: f31f6c952f5975d7f6c7208335495da8d7fe34ac authored by R. David Murray on 23 February 2010, 23:03:49 UTC
Blocked revisions 78388-78389 via svnmerge
Tip revision: f31f6c9
vs9to8.py
from __future__ import with_statement
import os

def vs9to8(src, dest):
    for name in os.listdir(src):
        path, ext = os.path.splitext(name)
        if ext.lower() not in ('.sln', '.vcproj', '.vsprops'):
            continue

        filename = os.path.normpath(os.path.join(src, name))
        destname = os.path.normpath(os.path.join(dest, name))
        print("%s -> %s" % (filename, destname))

        with open(filename, 'rU') as fin:
            lines = fin.read()
            lines = lines.replace('Version="9,00"', 'Version="8.00"')
            lines = lines.replace('Version="9.00"', 'Version="8.00"')
            lines = lines.replace('Format Version 10.00', 'Format Version 9.00')
            lines = lines.replace('Visual Studio 2008', 'Visual Studio 2005')

            lines = lines.replace('wininst-9.0', 'wininst-8.0')
            lines = lines.replace('..\\', '..\\..\\')
            lines = lines.replace('..\\..\\..\\..\\', '..\\..\\..\\')

            # Bah. VS8.0 does not expand macros in file names.
            # Replace them here.
            lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-3.5.9')

        with open(destname, 'wb') as fout:
            lines = lines.replace("\n", "\r\n").encode()
            fout.write(lines)

if __name__ == "__main__":
    vs9to8(src=".", dest="../PC/VS8.0")
back to top