swc-installation-test-2.py: Allow multiple URLs for installation help
authorW. Trevor King <wking@tremily.us>
Thu, 5 Mar 2015 17:57:12 +0000 (09:57 -0800)
committerW. Trevor King <wking@tremily.us>
Thu, 5 Mar 2015 17:58:03 +0000 (09:58 -0800)
So we can link to both SWC and the upstream project.

I added an extra layer of indentation for the urls to set them off
from the rest of the instructions.  We want to make it easy for folks
to focus on the text, while the URLs are just for copy/pasting.

swc-installation-test-2.py

index 053bab645c20783bd1a4e4a4fbc17a321e518402..129bf96878ed0a821daf495a368b75eec908f429 100755 (executable)
@@ -193,7 +193,7 @@ class DependencyError (Exception):
             causes = []
         self.causes = causes
 
-    def get_url(self):
+    def get_urls(self):
         system = _platform.system()
         version = None
         for pversion in (
@@ -210,17 +210,17 @@ class DependencyError (Exception):
             if (_fnmatch.fnmatch(system, s) and
                     _fnmatch.fnmatch(version, v) and
                     _fnmatch.fnmatch(package, p)):
-                return url
-        return self._default_url
+                return [url]
+        return [self._default_url]
 
     def __str__(self):
-        url = self.get_url()
+        urls = self.get_urls()
         lines = [
             'check for {0} failed:'.format(self.checker.full_name()),
             '  ' + self.message,
             '  For instructions on installing an up-to-date version, see',
-            '  ' + url,
             ]
+        lines.extend(['    {0}'.format(url) for url in urls])
         if self.causes:
             lines.append('  causes:')
             for cause in self.causes: