mpir/build.vc9/vc98_swap.py

28 lines
766 B
Python
Raw Normal View History

2008-05-19 09:37:29 -04:00
2008-05-26 18:38:26 -04:00
# Convert between Visual Studio 2008 and 2005 Project Files
# (with thanks to Tommi Vainikainen)
2008-05-19 09:37:29 -04:00
import os
import shutil
import string
2008-05-26 18:38:26 -04:00
import fileinput, sys
2008-05-19 09:37:29 -04:00
2008-05-26 18:38:26 -04:00
def fd_convert(sp):
for l in fileinput.input(sp, inplace = 1) :
p1 = l.find("Version=\"8.00\"")
p2 = l.find("Version=\"9.00\"")
if p1 != -1 or p2 != -1 :
if p1 != -1 :
l = l[ : p1 + 9] + '9' + l[ p1 + 10 : ]
else :
l = l[ : p2 + 9] + '8' + l[ p2 + 10 : ]
sys.stdout.write(l)
2008-05-19 09:37:29 -04:00
2008-05-26 18:38:26 -04:00
if os.getcwd().endswith("build.vc9") :
for root, dirs, files in os.walk("./") :
for file in files :
if file.endswith(".vcproj") :
fd_convert(os.path.join(root, file))
2008-05-19 09:37:29 -04:00
else :
print "This script must be run in the 'build.vc9' directory"