Backport PR #2399: IndentationError display

IndentationError is a subclass of SyntaxError, and they should display in a similar fashion, with the problematic line and line number shown. We were being over-specific with our type checking.

Closes #2398.
Backport PR #2503: Fix traceback handling of SyntaxErrors without line numbers.

E.g. lxml generates such errors.
Backport PR #2500: Add `encoding` attribute to `OutStream` class.

This means that `sys.stdout.encoding` returns something useful instead of raising an AttributeError.

Closes #2220.
Backport PR #2498: Don't catch tab press when something selected

Fixes #2487
Backport PR #2490: add ZMQInteractiveShell to IPEngineApp class list

so it will appear in default ipengine_config.py, `--help-all`, etc.

as [mentioned](https://github.com/ipython/ipython/issues/2473#issuecomment-9414837) in #2473
Backport PR #2491: color is supported in ironpython

changes for ongoing effort to make ipython to work under ironpython
I have activated color support.
Backport PR #2511: trigger default remote_profile_dir when profile_dir is set

in SSHLaunchers

remote_profile_dir_default could be triggered before profile_dir was set,
resulting in an empty remote_profile_dir, causing failures.
Backport PR #2294: inputhook_qt4: Use QEventLoop instead of starting up the QCoreApplication

I referenced this branch in #2080 and was letting it sit for a little while, but I have decided to make it a full pull request to get some additional visibility.

Essentially our Qt event loop mechanism repeatedly starts and quits a `QCoreApplication` object. Unfortunately the `QCoreApplication::quit` slot has a lot of unintended side effects (like emitting an `aboutToQuit` signal which closes all open file dialogs).

For our input hook, we _might_ be able to get by with just using a `QEventLoop` whose quit slot is much simpler and less destructive.

For a little bit of background on why one might want to just use `QEventLoop::exec`, let's examine what `QCoreApplication::exec` does:

```c++
int QCoreApplication::exec()
{
    if (!QCoreApplicationPrivate::checkInstance("exec"))
        return -1;

    // ... [some assertions]

    threadData->quitNow = false;
    QEventLoop eventLoop;
    self->d_func()->in_exec = true;
    self->d_func()->aboutToQuitEmitted = false;
    int returnCode = eventLoop.exec();
    threadData->quitNow = false;
    if (self) {
        self->d_func()->in_exec = false;
        if (!self->d_func()->aboutToQuitEmitted)
            emit self->aboutToQuit();
        self->d_func()->aboutToQuitEmitted = true;
        sendPostedEvents(0, QEvent::DeferredDelete);
    }

    return returnCode;
}
```

As far as I can tell, it's a small wrapper around `QEventLoop::exec` which also:
* Sets some variables regarding the current status
* Emits an `aboutToQuit` signal right before the function returns (which is the root cause of @denisri's problem in #2080).

Historically, our Qt event loop is a python implementation of the (win 32) input hook supplied with the PyQt4 source (see qtcore_input_hook` in `python-qt4/sip/QtCore/qcoreapplication.sip`), which more or less dates to a [mailing list post](http://www.riverbankcomputing.com/pipermail/pyqt/2007-July/016512.html) from July 2007.
Backport PR #2554: Avoid stopping in ipdb until we reach the main script.

For example:

```
In [1]: %run -d -b 52 setup.py
Breakpoint 1 at /tmp/ipython/setup.py:52
NOTE: Enter 'c' at the ipdb>  prompt to start your script.
> /tmp/ipython/setup.py(7)<module>()
      6 Under Windows, the command sdist is not supported, since IPython
----> 7 requires utilities which are not available under Windows."""
      8
```

compared to the previous behavior:

```
In [1]: %run -d -b 52 setup.py
Breakpoint 1 at /tmp/ipython/setup.py:52
NOTE: Enter 'c' at the ipdb>  prompt to start your script.
> <string>(1)<module>()
```

Closes #1679 ("List command desn't work in ipdb debugger the first time")
Backport PR #2561: Fix display of plain text containing multiple carriage returns before line feed

Closes gh-2560
Backport PR #2546: use 4 Pythons to build 4 Windows installers

See [stdlib docs](http://docs.python.org/2/distutils/builtdist.html#cross-compiling-on-windows) for why this has to be.

I don't know a better way than hard-coding the paths to four Pythons, since there is no natural way to have all of these available on your PATH.

This script (with PROPER and FIXED additions) is how I built/uploaded the two fixed installers.

closes #2531
Backport PR #2526: Don't kill paramiko tunnels when receiving ^C

prevents ^C from being passed along to children, bringing them down

closes #2520
Backport PR #2591: Fix for Issue #2584
Backport PR #2582: Fix displaying history when output cache is disabled.

Previously, disabling the output cache disabled all history. These were separated, but the `%hist` magic was left with an unnecessary check, where if the output cache was disabled, it would refuse to work.

Closes gh-2581
Backport PR #2574: Fix #2244

Reformatted the warning message as per the issue and changed some of the original logic to be more readable as advised by Fernando.
Backport PR #2638: Fix %paste in Python 3 on Mac

Fixes #2637.
Backport PR #2656: Fix irunner tests when $PYTHONSTARTUP is set

Closes gh-2655
Backport PR #2663: Fix issue #2660: parsing of help and version arguments

Help (-h --help --help-all) and version (--version -V) arguments that appear after a bare '--' argument are passed to the script IPython is running (like other arguments), instead of causing IPython itself to
write out help / version info.
Backport PR #2668: pylab_not_importable: Catch all exceptions, not just RuntimeErrors.

This catches situations when `pylab` isn't installed or fails for another
reason like:

  ImportError: No module named backend_tkagg

Closes gh-2646.
Backport PR #2662: qtconsole: wrap argument list in tooltip to match width of text body

previously, a function with a long argument list would produce
a very wide tooltip, hurting readability.

Since the width of the docstring body is chosen by the developer
whereas the formatting of the argument list is currently not, it's
reasonable to wrap the argument list width to the maximum of
a) 80 characters, or b) maximum length of a line in the docstring body.

This improves readability, without unduly affecting the appearence
of the docstring body itself.

closes #2661

I'm happy to add any additional tests or make any changes required to get this merged.