Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 1 | from __future__ import with_statement |
| 2 | import os |
| 3 | |
| 4 | def vs9to8(src, dest): |
| 5 | for name in os.listdir(src): |
| 6 | path, ext = os.path.splitext(name) |
| 7 | if ext.lower() not in ('.sln', '.vcproj', '.vsprops'): |
| 8 | continue |
| 9 | |
| 10 | filename = os.path.normpath(os.path.join(src, name)) |
| 11 | destname = os.path.normpath(os.path.join(dest, name)) |
| 12 | print("%s -> %s" % (filename, destname)) |
| 13 | |
| 14 | with open(filename, 'rU') as fin: |
| 15 | lines = fin.read() |
| 16 | lines = lines.replace('Version="9,00"', 'Version="8.00"') |
| 17 | lines = lines.replace('Version="9.00"', 'Version="8.00"') |
| 18 | lines = lines.replace('Format Version 10.00', 'Format Version 9.00') |
| 19 | lines = lines.replace('Visual Studio 2008', 'Visual Studio 2005') |
| 20 | |
| 21 | lines = lines.replace('wininst-9.0', 'wininst-8.0') |
| 22 | lines = lines.replace('..\\', '..\\..\\') |
| 23 | lines = lines.replace('..\\..\\..\\..\\', '..\\..\\..\\') |
| 24 | |
Amaury Forgeot d'Arc | 6166717 | 2008-06-12 22:53:41 +0000 | [diff] [blame] | 25 | # Bah. VS8.0 does not expand macros in file names. |
| 26 | # Replace them here. |
Amaury Forgeot d'Arc | cb87f82 | 2008-09-02 22:36:25 +0000 | [diff] [blame] | 27 | lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-3.5.9') |
Amaury Forgeot d'Arc | 6166717 | 2008-06-12 22:53:41 +0000 | [diff] [blame] | 28 | lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.4.20\\build_win32\\..') |
| 29 | lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.4.20\\build_win32') |
| 30 | |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 31 | with open(destname, 'wb') as fout: |
| 32 | lines = lines.replace("\n", "\r\n").encode() |
| 33 | fout.write(lines) |
| 34 | |
| 35 | if __name__ == "__main__": |
| 36 | vs9to8(src=".", dest="../PC/VS8.0") |