Test for stbt-run uses stbt from development, not installed, location.

By using "stbt-run" instead of "stbt run", the test picks up the program
from the source directory (PATH is set up in the recipe for "make
check"). It used to pick up "stbt" from /usr/local/bin.

To avoid relying on the default stbt.conf, which may or may not be
installed, we also pass in defaults to all options, even those we don't
use ("--control", in this case).

In future we may want to install these tests as "stbt selfcheck", in
which case we'll want them to use the installed "stbt" ("stbt-run" etc
won't be in the path; they're installed to $prefix/lib/stbt/). But we'll
worry about that bridge when we reach it.
Cleanup: Use simpler pygst APIs
Fix "name 'listenport' is not defined" in stbt-record
Fix doctest to work without an X11 server

I suspect the line I'm removing was introduced by mistake; pygst and gst
are the imports causing the problem that ArgvHider was created to avoid.
Respect the user's choice of python interpreter

For example on my Mac I install pygst etc. with macports, so for
stb-tester to work I want to use the macports version of python on my
PATH, not the system python in /usr/bin.
Don't set PREFIX in stbt-{run,record}'s environment

because those tools never refer to $PREFIX.
Don't set PYTHONPATH in stbt-{run,record}'s environment

There is no need to: "The directory containing the script being run is
placed at the beginning of the search path".
-- http://docs.python.org/tutorial/modules.html#the-module-search-path
stbt-{run,record} from the source directory can find stbt.conf

Previously, running stbt-record from the source directory (as opposed to
running `stbt record` from the installed location, $prefix/bin/stbt)
failed to find stbt.conf.

Since stbt.conf contains mandatory defaults for each option, if you
didn't specify each option explicitly on the command line, the script
would fail with some obscure error message (e.g. uri_to_remote expects
its parameter to be a string). Rather than fixing each usage of the
parameters, or duplicating the default value for each parameter in each
of stbt-{run,record} (and there may be more stbt- scripts in future),
we just make sure that the default stbt.conf is found no matter what.

In fact, in a future commit we might install this stbt.conf as
"defaults.conf" in $prefix/lib/stbt, alongside stbt-{run,record}, so
that the default values will always be found, regardless of what the
user does to /etc/stbt/stbt.conf.
Fix receiving keypresses from VirtualRemote

7537b5de fixed the read_records doctest but broke the actual use of
read_records in production.  I had expected that

    socket.makefile(bufsize=0).read(x)

be equivalent to

    socket.recv(x)

but it turns out not to be the case.  This seems to be fixed in later
versions of Python[1].  To work around this we convert the StringIO used
in the tests to be socket-like rather than converting the socket used in
production to be file-like.

[1] http://stackoverflow.com/questions/6946629/can-i-get-a-socket-makefile-to-have-the-same-read-semantics-as-a-regular-file
Cleanup: Wrap long lines, sort imports, PEP8-compliant spacing
Debug output: Print command-line + config-file arguments

So that I can easily see which config files are being found, check that
the command-line arguments are correctly over-riding the config files,
etc.
Receive gstreamer warnings and print them to stderr

While it doesn't do much it lays the foundations for doing something
more intelligent with the warnings.
Print and exit when a Gstreamer error is received

This is a bit of a blunt way of dealing with errors but it is better
than silently doing nothing leaving the user wondering.  It also lays
the foundations for doing something more intelligent.
Fix printing error message on MatchTimeout

This commit fixes a typo introduced in 46647d6c: Add command line options.
Merge remote-tracking branch 'github-wmanley/error_handling'

* github-wmanley/error_handling:
  Fix printing error message on MatchTimeout
  Print and exit when a Gstreamer error is received
  Receive gstreamer warnings and print them to stderr
Check our code conforms to PEP8 during make check

PEP8[1] is the Python style guide.  This requires the pep8 binary
provided by the package python-pep8 on Fedora.

This commit also fixes all of the PEP8 violations detected by that tool.

[1] http://www.python.org/dev/peps/pep-0008/
'make check' doesn't need to build 'stbt'

Not since 2da99d0.
'make all' builds the manpage

So that 'make; sudo make install' doesn't leave a root-owned file
in the source directory.
Make the video sink be configurable with --sink-pipeline

This allows running stbt and its tests on OS X and on Linux VMs (on OS X
there is no xvimagesink, only ximagesink without the v; on my Linux VM
the xvimagesink brings up a blank window with no video, whereas
ximagesink does work).

The default value remains the same (xvimagesink sync=false). We might
choose to change it to:

* autovideosink -- this introduces a dependency on gst-plugins-good, and
  doesn't work on OS X (where it just hangs with no error message nor
  window; presumably it's trying to find xvimagesink), and it doesn't
  work on my Linux VM (where it brings up the xvimagesink window, which
  doesn't have any video, just a blank window). Also we'd need to test
  that autovideosink passes on properties like "sync=false" to the
  underlying sink.

* ximagesink -- less performant than xvimagesink, but works for everyone
  and thus is arguably a better out-of-the-box experience for the first-
  time downloader who just wants 'make check' to show some cool demos.
Fix minor display issue in generated man page

The line "3. ./stbt.conf" is converted by rst2man to:

    .IP 3. 3
    ./stbt.conf

The line "./stbt.conf" seems to be treated by `man` as a formatting
directive, because it starts with a ".". When viewed with `man` it
looked like:

    3.