[VS Addin] Fix several issues with install script.
Fix the --vsuser-path flag. It was attempted to append
to a tuble.
Don't depend on any one of the vsuser-paths existing, only
that at least one of them exists. This allows installation
to succeed on platforms that only have one version of VS
installed.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/282153003
git-svn-id: https://nativeclient-sdk.googlecode.com/svn/trunk/src@1573 050acbb0-2703-11df-ab0a-9f3f633ae91d
diff --git a/InstallerResources/install.py b/InstallerResources/install.py
index 4e31d95..6b5afa0 100644
--- a/InstallerResources/install.py
+++ b/InstallerResources/install.py
@@ -26,8 +26,8 @@
NACL_PLATFORM_OLD = 'NaCl'
PEPPER_PLATFORM = 'PPAPI'
-DEFAULT_VS_DIRECTORIES = ('%USERPROFILE%\\My Documents\\Visual Studio 2010',
- '%USERPROFILE%\\My Documents\\Visual Studio 2012')
+DEFAULT_VS_DIRECTORIES = ['%USERPROFILE%\\My Documents\\Visual Studio 2010',
+ '%USERPROFILE%\\My Documents\\Visual Studio 2012']
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -86,8 +86,6 @@
def InstallAddin(vsuser_path):
- vsuser_path = os.path.expandvars(vsuser_path)
-
vsname = os.path.basename(vsuser_path)
if '2012' in vsname:
vs_version = '2012'
@@ -308,6 +306,14 @@
print "\nUninstall complete!\n"
return 0
+ # Verify that at least on Visual Studio user path exists, then
+ # filter out any that don't.
+ options.vsuser_path = [os.path.expandvars(p) for p in options.vsuser_path]
+ if not any(os.path.exists(p) for p in options.vsuser_path):
+ raise InstallError('Failed to find any suitable location to install the'
+ ' Addin. Tried:\n\t' + '\n\t'.join(options.vsuser_path))
+ options.vsuser_path = [p for p in options.vsuser_path if os.path.exists(p)]
+
try:
InstallMSBuild()