Staging
v0.5.1
https://github.com/python/cpython
Revision f4d016f38a48e15823021b969aa66cabd0f679a8 authored by Benjamin Peterson on 30 October 2008, 23:00:52 UTC, committed by Benjamin Peterson on 30 October 2008, 23:00:52 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67060 | benjamin.peterson | 2008-10-30 17:39:25 -0500 (Thu, 30 Oct 2008) | 1 line

  backport bin() documentation
........
  r67061 | benjamin.peterson | 2008-10-30 17:44:18 -0500 (Thu, 30 Oct 2008) | 1 line

  finish backporting binary literals and new octal literals docs
........
1 parent 8efccfd
Raw File
Tip revision: f4d016f38a48e15823021b969aa66cabd0f679a8 authored by Benjamin Peterson on 30 October 2008, 23:00:52 UTC
Merged revisions 67060-67061 via svnmerge from
Tip revision: f4d016f
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')
            lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.7.25.0\\build_windows\\..')
            lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.7.25.0\\build_windows')

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

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