swc-setup-installation-test.git
11 years agoswc-installation-test-1.py: Give instructions for 'python command not found'
W. Trevor King [Tue, 1 Jan 2013 13:01:45 +0000 (08:01 -0500)]
swc-installation-test-1.py: Give instructions for 'python command not found'

11 years agoswc-installation-test-2.py: Sort shells in order of preference
W. Trevor King [Tue, 1 Jan 2013 12:46:48 +0000 (07:46 -0500)]
swc-installation-test-2.py: Sort shells in order of preference

Placing the often-symlinked `sh` at the end of the list.  This way if
a user has Bash installed, it doesn't show up as plain old Bourne.

11 years agoswc-installation-test-2.py: Break after first successful or-dependency
W. Trevor King [Tue, 1 Jan 2013 12:45:03 +0000 (07:45 -0500)]
swc-installation-test-2.py: Break after first successful or-dependency

No need to test the other dependencies once you find one that matches.

11 years agoswc-installation-test-2.py: Give suggested install hints
W. Trevor King [Tue, 1 Jan 2013 12:41:28 +0000 (07:41 -0500)]
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)

11 years agoswc-installation-test-1.py: Give suggested install hints
W. Trevor King [Tue, 1 Jan 2013 12:16:57 +0000 (07:16 -0500)]
swc-installation-test-1.py: Give suggested install hints

This can link to the "howto setup Python" notes from SWC once those
get a more precise link than:

  http://software-carpentry.org/setup/

11 years agoswc-installation-test-2.py: Don't say how to get a terminal
W. Trevor King [Tue, 1 Jan 2013 12:10:09 +0000 (07:10 -0500)]
swc-installation-test-2.py: Don't say how to get a terminal

We already told them how to do this in swc-installation-test-1.py,
hopefully they remember ;).

11 years agoswc-installation-test-2.py: Avoid BaseException.message warning
W. Trevor King [Tue, 1 Jan 2013 02:14:12 +0000 (21:14 -0500)]
swc-installation-test-2.py: Avoid BaseException.message warning

Dodge the logic which (at least in Python 2.6.1) raises:

  DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

We're setting the .message attribute explicitly, so the deprecation
warning does not apply to us.  The fix was suggested by Brett Cannon:

On Sun Jul 8 02:42:18 CEST 2007, Brett Cannon wrote [1]:
> You can get around this easily enough with a subclass that uses a
> property for message::
>
>   class gerror(Exception):
>     def _get_message(self, message): return self._message
>     def _set_message(self, message): self._message = message
>     message = property(_get_message, _set_message)

[1]: http://mail.python.org/pipermail/python-dev/2007-July/073777.html

11 years agoswc-installation-test-2.py: Only require Git >= 1.7 (not >= 1.8)
W. Trevor King [Tue, 1 Jan 2013 02:11:01 +0000 (21:11 -0500)]
swc-installation-test-2.py: Only require Git >= 1.7 (not >= 1.8)

Xcode 4.0.2 for OS X 10.6.8 shipped with Git 1.7.3.4.

11 years agoswc-installation-test-2.py: Add EasyInstallDependency class
W. Trevor King [Tue, 1 Jan 2013 02:04:52 +0000 (21:04 -0500)]
swc-installation-test-2.py: Add EasyInstallDependency class

Distribute's easy_install supports --version (at least since 0.6.21),
but Setuptool's original version does not (at least as of 0.6c9).
Assume that if we get some kind of reasonable output from
`easy_install --version` we're dealing with the Setuptools version.

11 years agoswc-installation-test-2.py: Add a virtual-shell and non-Bash shells
W. Trevor King [Tue, 1 Jan 2013 01:34:52 +0000 (20:34 -0500)]
swc-installation-test-2.py: Add a virtual-shell and non-Bash shells

Commit to POSIX.2 [1] compatibility by allowing additional shells.  If
anyone has something besides sh, bash, or dash installed, they
probably know how to use it ;).

[1]: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
     IEEE Std 1003.2-1992

11 years agoswc-installation-test-2.py: Don't require a specific Bash version
W. Trevor King [Tue, 1 Jan 2013 01:28:25 +0000 (20:28 -0500)]
swc-installation-test-2.py: Don't require a specific Bash version

I have access to a machine running OS X 10.6.8, which has:

  $ bash --version
  GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
  Copyright (C) 2007 Free Software Foundation, Inc.

That means no associative arrays, but for SWC purposes, it should
still get the job done.  All we really need is POSIX.2.

11 years agoswc-installation-test-2.py: Fix version extraction for sqlite3-python
W. Trevor King [Sun, 30 Dec 2012 18:24:51 +0000 (13:24 -0500)]
swc-installation-test-2.py: Fix version extraction for sqlite3-python

The 'sqlite3' package has the same version as the standard library.
We only check for it because sometimes (e.g. on Gentoo) Python may be
compiled without this package.

11 years agoswc-installation-test-2.py: Fix 'mercurial' version extraction
W. Trevor King [Sun, 30 Dec 2012 18:15:28 +0000 (13:15 -0500)]
swc-installation-test-2.py: Fix 'mercurial' version extraction

The Mercurial Python package stores its version in strange places.

11 years agoswc-installation-test-2.py: Refactor PythonPackageDependency._get_version
W. Trevor King [Sun, 30 Dec 2012 18:14:37 +0000 (13:14 -0500)]
swc-installation-test-2.py: Refactor PythonPackageDependency._get_version

Split it into pieces for easier subclassing.

11 years agoswc-installation-test-2.py: Add import_module for older Pythons
W. Trevor King [Sun, 30 Dec 2012 17:57:49 +0000 (12:57 -0500)]
swc-installation-test-2.py: Add import_module for older Pythons

importlib is new in Python 2.7 / 3.1.  Add a minimal workaround for
earlier versions.

11 years agoswc-installation-test-2.py: Don't parse missing versions
W. Trevor King [Sun, 30 Dec 2012 17:54:24 +0000 (12:54 -0500)]
swc-installation-test-2.py: Don't parse missing versions

11 years agoswc-installation-test-2.py: import print_function for Python 2.6
W. Trevor King [Sun, 30 Dec 2012 17:51:49 +0000 (12:51 -0500)]
swc-installation-test-2.py: import print_function for Python 2.6

Otherwise `print()` actually prints `()`, where we want it to print a
blank line.

11 years agoswc-installation-test-2.py: Don't chain exceptions (yet)
W. Trevor King [Sun, 30 Dec 2012 17:36:44 +0000 (12:36 -0500)]
swc-installation-test-2.py: Don't chain exceptions (yet)

Exception chaining (PEP 3134, 'raise ... from') raises SyntaxErros in
Python 2.x.  Comment the chaining out until SWC starts teaching only
Python 3.x.

11 years agoswc-installation-test-2.py: Print successfully-found versions
W. Trevor King [Sun, 30 Dec 2012 17:25:29 +0000 (12:25 -0500)]
swc-installation-test-2.py: Print successfully-found versions

This makes it easy to see what a user has installed.

11 years agoswc-installation-test-2.py: Don't print duplicate exceptions
W. Trevor King [Sun, 30 Dec 2012 16:43:47 +0000 (11:43 -0500)]
swc-installation-test-2.py: Don't print duplicate exceptions

For example, if you have an outdated 'python', you only want to hear
about that once, not once for each PythonPackageDependency.

11 years agoswc-installation-test-2.py: Cache check errors
W. Trevor King [Sun, 30 Dec 2012 16:41:25 +0000 (11:41 -0500)]
swc-installation-test-2.py: Cache check errors

Avoid running the same check (e.g. 'python') over and over.

11 years agoswc-installation-test-2.py: `PythonDependency`s should depend on Python
W. Trevor King [Sun, 30 Dec 2012 16:37:10 +0000 (11:37 -0500)]
swc-installation-test-2.py: `PythonDependency`s should depend on Python

11 years agoswc-installation-test-2.py: Add exe_extension for MS Windows compat.
W. Trevor King [Sun, 30 Dec 2012 16:35:03 +0000 (11:35 -0500)]
swc-installation-test-2.py: Add exe_extension for MS Windows compat.

Use distutils' new_compiler() to get the appropriate exe_extension for
the user's system.  This way command names can always be specified in
their bare form, and we'll automatically add the right executable
extension for other platforms.

11 years agoswc-installation-test-2.py: Add virtual-editor and virtual-browser
W. Trevor King [Sun, 30 Dec 2012 15:31:55 +0000 (10:31 -0500)]
swc-installation-test-2.py: Add virtual-editor and virtual-browser

Often we don't care which editor is installed, so long as at least one
is installed.  This commit tweaks Dependency and adds a
VirtualDependency class to support such virtual dependencies.  You
can't get very fancy with boolean logic, but an all-and and all-or
lists will probably be sufficient for our needs.

11 years agoswc-installation-test-2.py: Add some editors and browsers
W. Trevor King [Sun, 30 Dec 2012 15:07:54 +0000 (10:07 -0500)]
swc-installation-test-2.py: Add some editors and browsers

Based on a list of possibilities mentioned by Cait Pickens in an
internal email.

11 years agoswc-installation-test-2.py: sort CHECKS into topics
W. Trevor King [Sun, 30 Dec 2012 14:55:23 +0000 (09:55 -0500)]
swc-installation-test-2.py: sort CHECKS into topics

11 years agoswc-installation-test: Consolidate and reorganize test scripts
W. Trevor King [Sun, 30 Dec 2012 12:19:15 +0000 (07:19 -0500)]
swc-installation-test: Consolidate and reorganize test scripts

11 years agoMerge Konrad Hinsen and Fernando Perez's installation-testing scripts
W. Trevor King [Sat, 29 Dec 2012 19:48:04 +0000 (14:48 -0500)]
Merge Konrad Hinsen and Fernando Perez's installation-testing scripts

11 years agoworkshop_checklist.py: Add installation-testing script
Fernando Perez [Sat, 29 Dec 2012 19:43:59 +0000 (14:43 -0500)]
workshop_checklist.py: Add installation-testing script

This script was linked to by Eric Bray [1] and hosted on Fernando
Perez's website [2].

[1]: https://github.com/swcarpentry/website/issues/38#issuecomment-11386945
[2]: http://fperez.org/py4science/workshop_checklist.py

11 years agoswc-installation-test.py: Add installation-testing script
Konrad Hinsen [Sat, 29 Dec 2012 19:41:13 +0000 (14:41 -0500)]
swc-installation-test.py: Add installation-testing script

The content of this script was posted by Greg Wilson and attributed to
Konrad Hinsen [1].

[1]: https://github.com/swcarpentry/website/issues/38#issuecomment-11189525