cpython/PCbuild/vs9to8.py
Amaury Forgeot d'Arc 6166717fa4 Merged revisions 64202 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64202 | amaury.forgeotdarc | 2008-06-12 23:58:20 +0200 (jeu., 12 juin 2008) | 5 lines

  Update VS8.0 build files, using the script vs9to8.py.

  Also remove references to odbc libraries, which are not shipped with vs2003 express.
  (and certainly not useful)
........
2008-06-12 22:53:41 +00:00

37 lines
1.5 KiB
Python

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-source-3.3.4')
lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.4.20\\build_win32\\..')
lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.4.20\\build_win32')
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")