Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: visual_studio/NativeClientVSAddIn/InstallerResources/install.py

Issue 11092028: Fix for running buildbot script with 32-bit python under WOW64 (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Copies necessary add-in files into place to install the add-in. 6 """Copies necessary add-in files into place to install the add-in.
7 7
8 This script will copy the necessary files for the Visual Studio add-in 8 This script will copy the necessary files for the Visual Studio add-in
9 to where Visual Studio can find them. It assumes the current directory 9 to where Visual Studio can find them. It assumes the current directory
10 contains the necessary files to copy. 10 contains the necessary files to copy.
11 """ 11 """
12 12
13 import create_ppapi_platform 13 import create_ppapi_platform
14 import ctypes 14 import ctypes
15 import os 15 import os
16 import optparse 16 import optparse
17 import platform 17 import platform
18 import shutil 18 import shutil
19 import sys 19 import sys
20 import time 20 import time
21 21
22 NACL_PLATFORM_NAME = 'NaCl' 22 NACL_PLATFORM_NAME = 'NaCl'
23 PEPPER_PLATFORM_NAME = 'PPAPI' 23 PEPPER_PLATFORM_NAME = 'PPAPI'
24 24
25 DEFAULT_VS_USER_DIRECTORY = os.path.expandvars( 25 DEFAULT_VS_USER_DIRECTORY = os.path.expandvars(
26 '%USERPROFILE%\\My Documents\\Visual Studio 2010') 26 '%USERPROFILE%\\My Documents\\Visual Studio 2010')
27 27
28 DEFAULT_MS_BUILD_DIRECTORY = os.path.expandvars('%ProgramFiles(x86)%\\MSBuild')
29
30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 28 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
31 29
32 ADDIN_FILES = ['NativeClientVSAddIn.AddIn', 'NativeClientVSAddIn.dll'] 30 ADDIN_FILES = ['NativeClientVSAddIn.AddIn', 'NativeClientVSAddIn.dll']
33 31
34 class InstallError(Exception): 32 class InstallError(Exception):
35 """Error class for this installer indicating a fatal but expected error.""" 33 """Error class for this installer indicating a fatal but expected error."""
36 pass 34 pass
37 35
38 def UninstallDirectory(directory): 36 def UninstallDirectory(directory):
39 if os.path.exists(directory): 37 if os.path.exists(directory):
(...skipping 28 matching lines...) Expand all
68 answer = raw_input().strip().lower() 66 answer = raw_input().strip().lower()
69 if answer in ('y', 'yes'): 67 if answer in ('y', 'yes'):
70 return True 68 return True
71 if answer in ('n', 'no'): 69 if answer in ('n', 'no'):
72 return False 70 return False
73 71
74 72
75 def main(): 73 def main():
76 parser = optparse.OptionParser(usage='Usage: %prog [options]') 74 parser = optparse.OptionParser(usage='Usage: %prog [options]')
77 parser.add_option('-b', '--msbuild-path', dest='msbuild_path', 75 parser.add_option('-b', '--msbuild-path', dest='msbuild_path',
78 default=DEFAULT_MS_BUILD_DIRECTORY, metavar='PATH', 76 metavar='PATH', help='Provide the path to the MSBuild directory')
79 help='Provide the path to the MSBuild directory')
80 parser.add_option('-a', '--vsuser-path', dest='vsuser_path', 77 parser.add_option('-a', '--vsuser-path', dest='vsuser_path',
81 default=DEFAULT_VS_USER_DIRECTORY, metavar='PATH', 78 default=DEFAULT_VS_USER_DIRECTORY, metavar='PATH',
82 help='Provide the path to the Visual Studio user directory') 79 help='Provide the path to the Visual Studio user directory')
83 parser.add_option('-f', '--force', action="store_true", 80 parser.add_option('-f', '--force', action="store_true",
84 default=False, help='Force an overwrite of existing files') 81 default=False, help='Force an overwrite of existing files')
85 parser.add_option('-p', '--ppapi', action="store_true", dest='install_ppapi', 82 parser.add_option('-p', '--ppapi', action="store_true", dest='install_ppapi',
86 help='Install PPAPI template without asking.') 83 help='Install PPAPI template without asking.')
87 parser.add_option('-n', '--no-ppapi', action="store_false", 84 parser.add_option('-n', '--no-ppapi', action="store_false",
88 dest='install_ppapi', help='Do not install PPAPI template and do not ask') 85 dest='install_ppapi', help='Do not install PPAPI template and do not ask')
89 parser.add_option('-u', '--uninstall', action="store_true", 86 parser.add_option('-u', '--uninstall', action="store_true",
90 dest='uninstall', help='Remove the add-in.') 87 dest='uninstall', help='Remove the add-in.')
91 (options, args) = parser.parse_args() 88 (options, args) = parser.parse_args()
92 89
93 print "*************************************************" 90 print "*************************************************"
94 print "Native-Client Visual Studio 2010 Add-in Installer" 91 print "Native-Client Visual Studio 2010 Add-in Installer"
95 print "*************************************************\n" 92 print "*************************************************\n"
96 93
97 if platform.system() != 'Windows': 94 if platform.system() != 'Windows':
98 raise InstallError('Must install to Windows system') 95 raise InstallError('Must install to Windows system')
99 96
97 if not options.msbuild_path:
98 # Find the x86 program files folder. If we are uing a 64-bit version of
99 # python.exe then ProgramFiles(x86). If we using a 32-bit python then
100 # ProgramFiles will always be set to point the x86 program files even
101 # under W0W64.
102 if 'ProgramFiles(x86)' in os.environ:
103 options.msbuild_path = os.path.expandvars('%ProgramFiles(x86)%\\MSBuild')
104 else:
105 options.msbuild_path = os.path.expandvars('%ProgramFiles%\\MSBuild')
106
107
100 if CheckForRunningProgams(): 108 if CheckForRunningProgams():
101 if not options.force: 109 if not options.force:
102 print "Visual Studio and MSBuild must be closed during installation" 110 print "Visual Studio and MSBuild must be closed during installation"
103 if not Ask("Kill all instances now?"): 111 if not Ask("Kill all instances now?"):
104 raise InstallError('Please close all Visual Studio or MSBuild ' 112 raise InstallError('Please close all Visual Studio or MSBuild '
105 'instances before installing') 113 'instances before installing')
106 os.system("taskkill.exe /IM MSBuild.exe /f") 114 os.system("taskkill.exe /IM MSBuild.exe /f")
107 os.system("taskkill.exe /IM devenv.exe") 115 os.system("taskkill.exe /IM devenv.exe")
108 if CheckForRunningProgams(): 116 if CheckForRunningProgams():
109 for i in xrange(10): 117 for i in xrange(10):
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 except shutil.Error as e: 235 except shutil.Error as e:
228 print "Error while copying file. Please ensure file is not in use." 236 print "Error while copying file. Please ensure file is not in use."
229 print e 237 print e
230 except WindowsError as e: 238 except WindowsError as e:
231 if e.winerror == 5: 239 if e.winerror == 5:
232 print "Access denied error. Please ensure Visual Studio and MSBuild" 240 print "Access denied error. Please ensure Visual Studio and MSBuild"
233 print "processes are closed." 241 print "processes are closed."
234 else: 242 else:
235 raise 243 raise
236 sys.exit(rtn) 244 sys.exit(rtn)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698