Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 print "\nInstalling Add-in: %s" % vsuser_path | 110 print "\nInstalling Add-in: %s" % vsuser_path |
| 111 # Copy the necessary files into place. | 111 # Copy the necessary files into place. |
| 112 for file_name in ADDIN_FILES: | 112 for file_name in ADDIN_FILES: |
| 113 shutil.copy(os.path.join(SCRIPT_DIR, vs_version, file_name), addin_dir) | 113 shutil.copy(os.path.join(SCRIPT_DIR, vs_version, file_name), addin_dir) |
| 114 | 114 |
| 115 print "Add-in installed." | 115 print "Add-in installed." |
| 116 | 116 |
| 117 | 117 |
| 118 def InstallMSBuildPlatforms(platform_root): | 118 def InstallMSBuildPlatforms(platform_root): |
| 119 if not os.path.exists(platform_root): | 119 if not os.path.exists(platform_root): |
|
binji
2014/02/03 21:46:41
This is superfluous now, right?
Sam Clegg
2014/02/03 22:44:54
Yes, but still probably a good sanity check.
| |
| 120 raise InstallError("Could not find path: %s" % platform_root) | 120 raise InstallError("Could not find path: %s" % platform_root) |
| 121 | 121 |
| 122 if not os.access(platform_root, os.W_OK): | 122 if not os.access(platform_root, os.W_OK): |
| 123 # Admin is needed to write to the default platform directory. | 123 # Admin is needed to write to the default platform directory. |
| 124 if ctypes.windll.shell32.IsUserAnAdmin() != 1: | 124 if ctypes.windll.shell32.IsUserAnAdmin() != 1: |
| 125 raise InstallError("Not running as administrator. The install script " | 125 raise InstallError("Not running as administrator. The install script " |
| 126 "needs write access to protected Visual Studio " | 126 "needs write access to protected Visual Studio " |
| 127 "directories.") | 127 "directories.") |
| 128 raise InstallError("install script needs write access to: %s" | 128 raise InstallError("install script needs write access to: %s" |
| 129 % platform_root) | 129 % platform_root) |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 159 print "%s platform installed." % NACL64_PLATFORM | 159 print "%s platform installed." % NACL64_PLATFORM |
| 160 | 160 |
| 161 shutil.copytree(os.path.join(SCRIPT_DIR, NACLARM_PLATFORM), nacl_dir_arm) | 161 shutil.copytree(os.path.join(SCRIPT_DIR, NACLARM_PLATFORM), nacl_dir_arm) |
| 162 print "%s platform installed." % NACLARM_PLATFORM | 162 print "%s platform installed." % NACLARM_PLATFORM |
| 163 | 163 |
| 164 shutil.copytree(os.path.join(SCRIPT_DIR, PNACL_PLATFORM), pnacl_dir) | 164 shutil.copytree(os.path.join(SCRIPT_DIR, PNACL_PLATFORM), pnacl_dir) |
| 165 print "PNaCl platform installed." | 165 print "PNaCl platform installed." |
| 166 | 166 |
| 167 | 167 |
| 168 def InstallMSBuild(): | 168 def InstallMSBuild(): |
| 169 | |
| 170 # Ask user before installing PPAPI template. | 169 # Ask user before installing PPAPI template. |
| 171 if options.install_ppapi is None: | 170 if options.install_ppapi is None: |
| 172 ppapi_answer = Ask("Set up configuration to enable Pepper development " | 171 ppapi_answer = Ask("Set up configuration to enable Pepper development " |
| 173 "with Visual Studio?\n" | 172 "with Visual Studio?\n" |
| 174 "((Yes)) - I want to create and copy relevant files into a " | 173 "((Yes)) - I want to create and copy relevant files into a " |
| 175 "Pepper subdirectory\n" | 174 "Pepper subdirectory\n" |
| 176 "((No)) - I am not interested or will set up the configuration later") | 175 "((No)) - I am not interested or will set up the configuration later") |
| 177 if ppapi_answer: | 176 if ppapi_answer: |
| 178 options.install_ppapi = True | 177 options.install_ppapi = True |
| 179 print "Confirmed installer will include PPAPI platform." | 178 print "Confirmed installer will include PPAPI platform." |
| 180 else: | 179 else: |
| 181 options.install_ppapi = False | 180 options.install_ppapi = False |
| 182 print "Will not install PPAPI platform during installation." | 181 print "Will not install PPAPI platform during installation." |
| 183 | 182 |
| 184 if not os.path.exists(options.msbuild_path): | 183 if not os.path.exists(options.msbuild_path): |
| 185 raise InstallError("Could not find MS Build directory: %s" % ( | 184 raise InstallError("Could not find MS Build directory: %s" % ( |
| 186 options.msbuild_path)) | 185 options.msbuild_path)) |
| 187 | 186 |
| 188 root_2010 = os.path.join(options.msbuild_path, | 187 root_2010 = os.path.join(options.msbuild_path, |
| 189 'Microsoft.Cpp', 'v4.0', 'Platforms') | 188 'Microsoft.Cpp', 'v4.0', 'Platforms') |
| 190 InstallMSBuildPlatforms(root_2010) | |
| 191 | |
| 192 root_2012 = os.path.join(options.msbuild_path, | 189 root_2012 = os.path.join(options.msbuild_path, |
| 193 'Microsoft.Cpp', 'v4.0', 'V110', 'Platforms') | 190 'Microsoft.Cpp', 'v4.0', 'V110', 'Platforms') |
| 194 InstallMSBuildPlatforms(root_2012) | 191 |
| 192 if not os.path.exists(root_2012) and not os.path.exists(root_2010): | |
| 193 raise InstallError("MSBuild paths for Visual Studio 2010 and " | |
| 194 "2012 are missing.\n" | |
| 195 "Please install one or both before installing this " | |
| 196 "AddIn.\n" | |
| 197 "(%s)\n" | |
| 198 "(%s)\n" % (root_2010, root_2012)) | |
| 199 | |
| 200 if os.path.exists(root_2010): | |
| 201 InstallMSBuildPlatforms(root_2010) | |
| 202 | |
| 203 if os.path.exists(root_2012): | |
| 204 InstallMSBuildPlatforms(root_2012) | |
| 195 | 205 |
| 196 if options.install_ppapi: | 206 if options.install_ppapi: |
| 197 pepper_dir = os.path.join(root_2010, PEPPER_PLATFORM) | 207 pepper_dir = os.path.join(root_2010, PEPPER_PLATFORM) |
| 198 pepper_dir2 = os.path.join(root_2012, PEPPER_PLATFORM) | 208 pepper_dir2 = os.path.join(root_2012, PEPPER_PLATFORM) |
| 199 UninstallDirectory(pepper_dir) | 209 UninstallDirectory(pepper_dir) |
| 200 UninstallDirectory(pepper_dir2) | 210 UninstallDirectory(pepper_dir2) |
| 201 create_ppapi_platform.CreatePPAPI(options.msbuild_path) | 211 create_ppapi_platform.CreatePPAPI(options.msbuild_path) |
| 202 print "PPAPI platform installed." | 212 print "PPAPI platform installed." |
| 203 | 213 |
| 204 | 214 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 print e | 337 print e |
| 328 print("The install script failed to write to the files mentioned above") | 338 print("The install script failed to write to the files mentioned above") |
| 329 if ctypes.windll.shell32.IsUserAnAdmin() != 1: | 339 if ctypes.windll.shell32.IsUserAnAdmin() != 1: |
| 330 print("Please try running as administrator.") | 340 print("Please try running as administrator.") |
| 331 else: | 341 else: |
| 332 print("Please check for any running programs that might " | 342 print("Please check for any running programs that might " |
| 333 "have them locked.") | 343 "have them locked.") |
| 334 else: | 344 else: |
| 335 raise | 345 raise |
| 336 sys.exit(rtn) | 346 sys.exit(rtn) |
| OLD | NEW |