Back to index

python3.2  3.2.2
Functions
vs9to8 Namespace Reference

Functions

def vs9to8

Function Documentation

def vs9to8.vs9to8 (   src,
  dest 
)

Definition at line 4 of file vs9to8.py.

00004 
00005 def vs9to8(src, dest):
00006     for name in os.listdir(src):
00007         path, ext = os.path.splitext(name)
00008         if ext.lower() not in ('.sln', '.vcproj', '.vsprops'):
00009             continue
00010 
00011         filename = os.path.normpath(os.path.join(src, name))
00012         destname = os.path.normpath(os.path.join(dest, name))
00013         print("%s -> %s" % (filename, destname))
00014 
00015         with open(filename, 'rU') as fin:
00016             lines = fin.read()
00017             lines = lines.replace('Version="9,00"', 'Version="8.00"')
00018             lines = lines.replace('Version="9.00"', 'Version="8.00"')
00019             lines = lines.replace('Format Version 10.00', 'Format Version 9.00')
00020             lines = lines.replace('Visual Studio 2008', 'Visual Studio 2005')
00021 
00022             lines = lines.replace('wininst-9.0', 'wininst-8.0')
00023             lines = lines.replace('..\\', '..\\..\\')
00024             lines = lines.replace('..\\..\\..\\..\\', '..\\..\\..\\')
00025 
00026             # Bah. VS8.0 does not expand macros in file names.
00027             # Replace them here.
00028             lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-3.6.21')
00029 
00030         with open(destname, 'wb') as fout:
00031             lines = lines.replace("\n", "\r\n").encode()
00032             fout.write(lines)