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

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

Issue 11266051: Add PNaCl support for VS addin. (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: fix nits and tests Created 8 years, 1 month 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
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 NACL32_PLATFORM = 'NaCl32' 22 NACL32_PLATFORM = 'NaCl32'
23 NACL64_PLATFORM = 'NaCl64' 23 NACL64_PLATFORM = 'NaCl64'
24 PNACL_PLATFORM = 'PNaCl'
24 NACL_PLATFORM_OLD = 'NaCl' 25 NACL_PLATFORM_OLD = 'NaCl'
25 PEPPER_PLATFORM = 'PPAPI' 26 PEPPER_PLATFORM = 'PPAPI'
26 27
27 DEFAULT_VS_USER_DIRECTORY = os.path.expandvars( 28 DEFAULT_VS_USER_DIRECTORY = os.path.expandvars(
28 '%USERPROFILE%\\My Documents\\Visual Studio 2010') 29 '%USERPROFILE%\\My Documents\\Visual Studio 2010')
29 30
30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 31 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
31 32
32 ADDIN_FILES = ['NativeClientVSAddIn.AddIn', 'NativeClientVSAddIn.dll'] 33 ADDIN_FILES = ['NativeClientVSAddIn.AddIn', 'NativeClientVSAddIn.dll']
33 34
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 # Admin is needed to write to the default platform directory. 156 # Admin is needed to write to the default platform directory.
156 if ctypes.windll.shell32.IsUserAnAdmin() != 1: 157 if ctypes.windll.shell32.IsUserAnAdmin() != 1:
157 raise InstallError("Not running as administrator. The install script " 158 raise InstallError("Not running as administrator. The install script "
158 "needs write access to protected Visual Studio " 159 "needs write access to protected Visual Studio "
159 "directories.") 160 "directories.")
160 raise InstallError("install script needs write access to: %s" 161 raise InstallError("install script needs write access to: %s"
161 % platform_root) 162 % platform_root)
162 163
163 nacl_directory32 = os.path.join(platform_root, NACL32_PLATFORM) 164 nacl_directory32 = os.path.join(platform_root, NACL32_PLATFORM)
164 nacl_directory64 = os.path.join(platform_root, NACL64_PLATFORM) 165 nacl_directory64 = os.path.join(platform_root, NACL64_PLATFORM)
166 pnacl_directory = os.path.join(platform_root, PNACL_PLATFORM)
165 nacl_directoryold = os.path.join(platform_root, NACL_PLATFORM_OLD) 167 nacl_directoryold = os.path.join(platform_root, NACL_PLATFORM_OLD)
166 nacl_common = os.path.join(os.path.dirname(platform_root), 'NaCl') 168 nacl_common = os.path.join(os.path.dirname(platform_root), 'NaCl')
167 pepper_directory = os.path.join(platform_root, PEPPER_PLATFORM) 169 pepper_directory = os.path.join(platform_root, PEPPER_PLATFORM)
168 remove_dirs = (nacl_directory32, nacl_directory64, 170 remove_dirs = (nacl_directory32, nacl_directory64, pnacl_directory,
169 nacl_directoryold, pepper_directory, nacl_common) 171 nacl_directoryold, pepper_directory, nacl_common)
170 # If uninstalling then redirect to uninstall program. 172 # If uninstalling then redirect to uninstall program.
171 if options.uninstall: 173 if options.uninstall:
172 Uninstall(remove_dirs, addin_directory) 174 Uninstall(remove_dirs, addin_directory)
173 print "\nUninstall complete!\n" 175 print "\nUninstall complete!\n"
174 sys.exit(0) 176 sys.exit(0)
175 177
176 if not os.path.exists(platform_root): 178 if not os.path.exists(platform_root):
177 raise InstallError("Could not find path: %s" % platform_root) 179 raise InstallError("Could not find path: %s" % platform_root)
178 if not os.path.exists(addin_directory): 180 if not os.path.exists(addin_directory):
179 os.makedirs(addin_directory) 181 os.makedirs(addin_directory)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 223
222 shutil.copytree(os.path.join(SCRIPT_DIR, 'NaCl'), nacl_common) 224 shutil.copytree(os.path.join(SCRIPT_DIR, 'NaCl'), nacl_common)
223 print "NaCl common resources installed." 225 print "NaCl common resources installed."
224 226
225 shutil.copytree(os.path.join(SCRIPT_DIR, NACL32_PLATFORM), nacl_directory32) 227 shutil.copytree(os.path.join(SCRIPT_DIR, NACL32_PLATFORM), nacl_directory32)
226 print "NaCl32 platform installed." 228 print "NaCl32 platform installed."
227 229
228 shutil.copytree(os.path.join(SCRIPT_DIR, NACL64_PLATFORM), nacl_directory64) 230 shutil.copytree(os.path.join(SCRIPT_DIR, NACL64_PLATFORM), nacl_directory64)
229 print "NaCl64 platform installed." 231 print "NaCl64 platform installed."
230 232
233 shutil.copytree(os.path.join(SCRIPT_DIR, PNACL_PLATFORM), pnacl_directory)
234 print "PNaCl platform installed."
235
231 if options.install_ppapi: 236 if options.install_ppapi:
232 create_ppapi_platform.CreatePPAPI(options.msbuild_path) 237 create_ppapi_platform.CreatePPAPI(options.msbuild_path)
233 print "PPAPI platform installed." 238 print "PPAPI platform installed."
234 except: 239 except:
235 print "\nException occured! Rolling back install...\n" 240 print "\nException occured! Rolling back install...\n"
236 Uninstall(remove_dirs, addin_directory) 241 Uninstall(remove_dirs, addin_directory)
237 raise 242 raise
238 else: 243 else:
239 print "\nInstallation complete!\n" 244 print "\nInstallation complete!\n"
240 245
(...skipping 14 matching lines...) Expand all
255 print e 260 print e
256 print("The install script failed to write to the files mentioned above") 261 print("The install script failed to write to the files mentioned above")
257 if ctypes.windll.shell32.IsUserAnAdmin() != 1: 262 if ctypes.windll.shell32.IsUserAnAdmin() != 1:
258 print("Please try running as administrator.") 263 print("Please try running as administrator.")
259 else: 264 else:
260 print("Please check for any running programs that might " 265 print("Please check for any running programs that might "
261 "have them locked.") 266 "have them locked.")
262 else: 267 else:
263 raise 268 raise
264 sys.exit(rtn) 269 sys.exit(rtn)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698