From: W. Trevor King Date: Tue, 1 Jan 2013 12:41:28 +0000 (-0500) Subject: swc-installation-test-2.py: Give suggested install hints X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eda4578aa2b2bee38c9ed21bb38a301a95d0cdb9;p=swc-boot-camp.git swc-installation-test-2.py: Give suggested install hints I can't give package-specific links yet, but they will hopefully be in place soon. I made the "email your instructor" suggestion optional, because it is easy for me to imagine a course large enough that the instructor could not field all requests. To disable, change print_suggestions(instructor_fallback=True) to print_suggestions(instructor_fallback=False) --- diff --git a/swc-installation-test-2.py b/swc-installation-test-2.py index 149eb59..15125ee 100755 --- a/swc-installation-test-2.py +++ b/swc-installation-test-2.py @@ -88,8 +88,11 @@ class DependencyError (Exception): self.message = message def __str__(self): - return 'check for {0} failed:\n{1}'.format( - self.checker.full_name(), self.message) + url = 'http://software-carpentry.org/setup/' # TODO: per-package URL + return 'check for {0} failed:\n{1}\n{2}\n{3}'.format( + self.checker.full_name(), self.message, + 'For instructions on installing an up-to-date version, see', + url) def check(checks=None): @@ -492,8 +495,21 @@ def print_system_info(): print(' {0}={1}'.format(key, value)) print('==================') +def print_suggestions(instructor_fallback=True): + print() + print('For suggestions on installing missing packages, see') + print('http://software-carpentry.org/setup/') + print('') + print('For instructings on installing a particular package,') + print('see the failure message for that package printed above.') + if instructor_fallback: + print('') + print('For help, email the *entire* output of this script to') + print('your instructor.') + if __name__ == '__main__': if not check(_sys.argv[1:]): print() print_system_info() + print_suggestions(instructor_fallback=True)