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

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

Issue 11115018: Better handling of permission errors during install. (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.
(...skipping 27 matching lines...) Expand all
38 38
39 39
40 def UninstallDirectory(directory): 40 def UninstallDirectory(directory):
41 if os.path.exists(directory): 41 if os.path.exists(directory):
42 shutil.rmtree(directory) 42 shutil.rmtree(directory)
43 print 'Removed: %s' % (directory) 43 print 'Removed: %s' % (directory)
44 44
45 45
46 def UninstallFile(file_path): 46 def UninstallFile(file_path):
47 if os.path.exists(file_path): 47 if os.path.exists(file_path):
48 if not os.access(file_path, os.W_OK):
49 raise InstallError("File is marked as read-only: %s.\n"
50 "Please correct and try again." % file_path)
48 os.remove(file_path) 51 os.remove(file_path)
49 print 'Removed: %s' % (file_path) 52 print 'Removed: %s' % (file_path)
50 53
51 54
52 def Uninstall(platform_dirs, addin_directory): 55 def Uninstall(platform_dirs, addin_directory):
53 for dirname in platform_dirs: 56 for dirname in platform_dirs:
54 UninstallDirectory(dirname) 57 UninstallDirectory(dirname)
55 for file_name in ADDIN_FILES: 58 for file_name in ADDIN_FILES:
56 UninstallFile(os.path.join(addin_directory, file_name)) 59 UninstallFile(os.path.join(addin_directory, file_name))
57 60
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 try: 245 try:
243 rtn = main() 246 rtn = main()
244 except InstallError as e: 247 except InstallError as e:
245 print 248 print
246 print e 249 print e
247 except shutil.Error as e: 250 except shutil.Error as e:
248 print "Error while copying file. Please ensure file is not in use." 251 print "Error while copying file. Please ensure file is not in use."
249 print e 252 print e
250 except WindowsError as e: 253 except WindowsError as e:
251 if e.winerror == 5: 254 if e.winerror == 5:
252 print "Access denied error. Please ensure Visual Studio and MSBuild" 255 print e
253 print "processes are closed." 256 print("The install script failed to write to the files mentioned above")
257 if ctypes.windll.shell32.IsUserAnAdmin() != 1:
258 print("Please try running as administrator.")
259 else:
260 print("Please check for any running programs that might "
261 "have them locked.")
binji 2012/10/12 18:43:02 You probably still want to mention Visual studio a
Sam Clegg 2012/10/12 18:51:58 We already check for them explicitly/separately ab
254 else: 262 else:
255 raise 263 raise
256 sys.exit(rtn) 264 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