OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import shutil | |
7 import sys | |
8 import os | |
9 | |
10 def patch_msbuild(): | |
11 """VS2010 MSBuild has a ULDI bug that we patch here. See http://goo.gl/Pn8tj. | |
12 """ | |
13 source_path = os.path.join(os.environ['ProgramFiles(x86)'], | |
14 "MSBuild", | |
15 "Microsoft.Cpp", | |
16 "v4.0", | |
17 "Microsoft.CppBuild.targets") | |
18 backup_path = source_path + ".backup" | |
19 if not os.path.exists(backup_path): | |
20 try: | |
21 shutil.copyfile(source_path, backup_path) | |
M-A Ruel
2012/01/19 21:52:01
What about:
print "Backing up %s" % source_path
scottmg
2012/01/19 21:57:27
Done.
| |
22 except IOError: | |
23 print "Could not back up %s to %s. Run as Administrator?" % ( | |
24 source_path, backup_path) | |
25 return 1 | |
26 | |
27 source = open(source_path).read() | |
28 find = ('''<Target Name="GetResolvedLinkObjs" Returns="@(ObjFullPath)" ''' | |
29 '''DependsOnTargets="$(CommonBuildOnlyTargets);ComputeCLOutputs;''' | |
30 '''ResolvedLinkObjs">''') | |
31 replace = find + ''' Condition="'$(ConfigurationType)'=='StaticLibrary'">''' | |
32 source = source.replace(find, replace) | |
33 | |
34 open(source_path, "w").write(source) | |
35 print "Patched %s" % source_path | |
36 return 0 | |
37 | |
38 | |
39 def main(): | |
40 return patch_msbuild() | |
41 | |
42 | |
43 if __name__ == "__main__": | |
44 sys.exit(main()) | |
OLD | NEW |