BUG: fix issue with distutils.exec_command introduced in 1.7.0.

Closes gh-2999 and gh-2915.

There are several packages (nose, scipy.weave.inline, Sage inline Fortran) that
replace stdout, in which case it doesn't have a fileno method.  This method was
attempted to be used (change in gh-2766 to fix a py3k issue).

Conflicts:
	numpy/distutils/exec_command.py
FIX: add _supports_fileno() for testing fileno()

The new _supports_fileno() function works in all versions of Python.
The problem was that in Python 2.x, the fileno() method of StringIO() is
missing, while in Python 3.x, it is present, but raises an exception.
PEP8: don't use \
TST: add robust tests for exec_command()

First, we test both stdout and stderr.

Second, we now test both _exec_command_posix() and _exec_command(), see
numpy/distutils/exec_command.py. This reveals a bug in the implementation which
will be fixed in the next commit. For now the failing test is commented out so
that all tests still pass.
Implement separate checking for stdout and stderr

And enable a test for this that was failing before.
TST: Redirect the other stream to temp. file

Now things behave the same if executed with either of:

nosetests
nosetests -s
TST: skip general test on non-posix platforms

Add a comment explaining the issue.
TST: rework tests to work with Python 2.4

Instead of using the "with" statement, we introduce 'fake_with' function that
does the same.
Merge pull request #3136 from certik/backport3128

Backport #3128
DOC: add 1.7.1-notes.rst notes
REL: Release 1.7.1rc1
TST: open the TemporaryFile in ASCII mode

This should fix gh-3165.
Merge pull request #3166 from certik/fix3165

TST: open the TemporaryFile in ASCII mode
MAINT: Fix python3 ResourceWarning when running test_exec_command.py

The tests in test_exec_command.py used with blocks with a context
manager that could redirect stderr and stdout to temporary files but
those files were not closed on exit from the block.