This is needed for setup-requires, since without it its possible
to cause installation to fail in sort-circuit scenarios such as
the added functional test case demonstrates.
This is a small change to make prepare_file easier to read. It is slightly
complicated by the round-about way it was being assigned in non-editable cases.
This speeds up the _filter_install function that is used to filter the
output of `python setup.py install` when installing packages. It does
this by using a single regex which is pre-compiled and thus avoiding a
`for` loop over 15 different regexes.
Before:
$ python
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.timeit("""_filter_install("if we've already set distribute as a conflict to setuptools blah blah blah blah")""", setup='from pip.req.req_install import InstallRequirement; ir = InstallRequirement("foo", None, None); _filter_install = ir._filter_install')
21.220640897750854
After:
$ python
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.timeit("""_filter_install("if we've already set distribute as a conflict to setuptools blah blah blah blah")""", setup='from pip.req.req_install import InstallRequirement; ir = InstallRequirement("foo", None, None); _filter_install = ir._filter_install')
0.9454500675201416
Without this, I was getting:
$ pip install -U 'sentry[lol]'
...
UnknownExtra: Unknown 7.4.1 has no such extra feature 'lol'
With this, I get:
$ pip install -U 'sentry[lol]'
...
UnknownExtra: sentry 7.4.1 has no such extra feature 'lol'
- add a bunch of comments
- renamed correct_build_location to _correct_build_location
- use build_location inside of _correct_build_location to be consistent
with the other build directories
This makes it easier to inspect with pdb.
Instead of:
(Pdb++) req_to_install
<pip.req.req_install.InstallRequirement object at 0x10459f7d0>
we get the much friendlier:
(Pdb++) req_to_install
<InstallRequirement object: wheel==0.24.0 in /Users/marca/python/virtualenvs/pip/lib/python2.7/site-packages>
In the case of develop install where we have an egg-info directory and
an egg-link, make sure we uninstall it in the develop_egg_link if case.
Fix#2456
instead of egg_name since they don't seem to be unambiguous
also add a debug log in case no uninstall case match
(it would have made the debugging much easier)
closes#2293
use pkg_resources.Distribution.requires instead of
Requirements.requirements to have environment markers parsing for free
It also unifies a little the process for wheel and non-wheel installs
closes#2174
to catch a few messages that slipped through when I was installing
docutils on Python 3.4:
warning: no files found matching 'MANIFEST'
warning: no previously-included files matching '.cvsignore' found under directory '*'
Skipping implicit fixer: buffer
Before:
$ pip install ~/src/docutils --upgrade
Processing /Users/marca/src/docutils
warning: no files found matching 'MANIFEST'
warning: no previously-included files matching '.cvsignore' found under directory '*'
warning: no previously-included files matching '*~' found under directory '*'
warning: no previously-included files matching '.DS_Store' found under directory '*'
Installing collected packages: docutils
Found existing installation: docutils 0.13
Uninstalling docutils:
Successfully uninstalled docutils
Running setup.py install for docutils
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
...
After:
$ pip install ~/src/docutils --upgrade
Processing /Users/marca/src/docutils
Installing collected packages: docutils
Found existing installation: docutils 0.13
Uninstalling docutils:
Successfully uninstalled docutils
Running setup.py install for docutils
...
so that it filters out more "no previously-included..." warnings from
distutils while installing.
Before:
$ pip install -e ~/dev/git-repos/pip
Obtaining file:///Users/marca/dev/git-repos/pip
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Installing collected packages: pip
Running setup.py develop for pip
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
...
After:
$ pip install -e ~/dev/git-repos/pip
Obtaining file:///Users/marca/dev/git-repos/pip
Installing collected packages: pip
Running setup.py develop for pip
...
Change log level of `"Running setup.py (path:%s) egg_info"` log messages
from INFO to DEBUG. The average user does not know or care that pip is
running `python setup.py egg_info`, unless things are broken, IMHO.
See: GH-1070
It's now possible to specify requirements markers in requirements.
Examples::
futures; python_version < '2.7'
mock; python_version < '3.3'
nose
ordereddict; python_version < '2.7'
unittest2; python_version < '2.7'
The separator is "; ". For convinience, ";" alone is also supported, but
no in URLs. The ";" character is a legit and common character in an URL.
Example of valid URL without markers::
http://foo.com/?p=bar.git;a=snapshot;h=v0.1;sf=tgz
Example of URL with markers::
http://foo.com/?p=bar.git;a=snapshot;h=v0.1;sf=tgz; python_version < '3.3'
PyPI and Bandersnatch now normalize the project name in their
URLs. This change matches that and will reduce the number of
redirects we hit on PyPI and will reduce the need to hit /simple/
on a Bandersnatch mirror.