hotpy_2 / PCbuild /

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'):

        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 =
            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.6.21')

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

if __name__ == "__main__":
    vs9to8(src=".", dest="../PC/VS8.0")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.