This fixes 2 aspects of `pip install output`:
1. When `pip install` succeeds, it's still printing a lot of output from
the package's setup.py. The average consumer of Python packages, when
they do `pip install lxml`, probably doesn't care to see a bunch of
output about:
- copying files to a `build` directory
- installing and running Cython
- compiling C code
This is noise to most when the `pip install` succeeds. It's useful to
see all the output when the install fails, which is the subject of #2
below. On success, the output is now very clean with 5 short lines:
$ pip install lxml
Collecting lxml
Using cached lxml-3.4.2.tar.gz
Installing collected packages: lxml
Running setup.py install for lxml
Successfully installed lxml-3.4.2
2. When there's an error from `pip install`, it's annoying to have to
scroll through 2 different copies of the failure output (especially when
one is filtered and one is unfiltered so one might have stuff that the
other doesn't). This makes it not print the filtered version so that
there is just the unfiltered version and nothing is repeated.
$ pip install ~/dev/git-repos/lxml
Processing /Users/marca/dev/git-repos/lxml
Installing collected packages: lxml
Running setup.py install for lxml
Complete output from command ...
cc -c /var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/xmlCheckVersion4tBaVV.c -o var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/xmlCheckVersion4tBaVV.o
/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/xmlCheckVersion4tBaVV.c:1:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
^
1 error generated.
----------------------------------------
Command "/Users/marca/python/virtualenvs/pip/bin/python -c ...
None of the lines above are repeated.
1. Check for the existence of a directory before copying from temporary directory to final target. If it exists, warn the user.
2. If the user specifies the --upgrade option and the directory exists, delete it and continue with installation.
3. Adding tests for above cases.
This resolves#1489, #1710 completely and parts of #1833.
In Python 2, the exec statement handles encoding for us, but in
Python 3 the encoding must be specified when opening the file
(if it's not specified it uses the system locale encoding, so
previously this would work only if your locale environment variables
specified the same encoding as the setup.py file).
On Python 3.2+ the tokenize.open function is available to interpret
the encoding declaration; fixing this for python 3.0 and 3.1 is more
difficult.
* Move virtualenv creation out of TestPipEnvironment
* Remove global state and force explicit use of TestPipEnvironment
instances
* Remove "backup" virtualenv copying and instead create new
virtual environments each time.
* Remove the monkeypatched "PyPICache" functionality
* Remove things that were not being used anymore and were dead
weight
* Remove sitecustomize support which was primarily used to
monkeypatch the "PyPICache" but was used in one or two other
tests.
* Better output with the bare asserts we use throughout the tests
* Function fixtures are pretty nice, especially as a way to
start a background server or create an isolated virtualenv