media/webrtc/trunk/build/win/install-build-deps.py

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rwxr-xr-x

Integrate suggestion from review to improve consistency with existing code.

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

mercurial