1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

293 commits

Author SHA1 Message Date
Xavier Fernandez
c9b48feea6 Fix test_relative_local_nested_req_files 2016-01-17 22:40:46 +01:00
Xavier Fernandez
21fb8a28f0 Dont raise on #egg metadata mismatch, just warn
Since pip 7, via pip freeze, is producing such mismatching #egg
fragment, forbidding them in pip 8 would be too strongly
backward-incompatible.
It is a partial rollback of 1a012bb6.
2016-01-14 00:30:02 +01:00
Ville Skyttä
8e436d994d Let logging format messages on demand 2016-01-03 00:21:59 +02:00
Xavier Fernandez
69d90440e7 Drop PasteScript specific hack
With or without, pip works the same with PasteScript latest version and
crashes the same with versions 0.3/0.3.1
It was added in c2000d7 (7 years from now)
2015-11-29 16:57:53 +01:00
Xavier Fernandez
30f4af0678 Move SETUPTOOLS_SHIM to its own file 2015-11-26 22:36:59 +01:00
Xavier Fernandez
3c00710438 Use a single setuptools shim
for all setup.py invocations
bdist_wheel will now use tokenize in Python 3 just like for install
fixes #2042
2015-11-26 22:36:59 +01:00
Marcus Smith
ca47dc9949 Merge pull request #3252 from domenkozar/install/prefix
Support pip install --prefix
2015-11-26 09:30:20 -08:00
Domen Kožar
b4bb2eee14 Support also pip install -e --prefix 2015-11-24 10:01:46 +01:00
Domen Kožar
e14a66f1b9 Support --prefix argument to install command.
There was no way to override prefix for an installation for wheels
previously. The default it whatever sys.prefix points to.
2015-11-22 19:13:51 +01:00
Steve Kowalik
dc8e7f01dd Join constraints and requested extras
Compare extras when checking if a requirement has already been
specified, and take a union of the extras before installation.

Co-Authored-By: Sachi King <nakato@nakato.io>
Closes #3046, #3189
2015-11-20 18:05:17 +11:00
Xavier Fernandez
e42e822f2c Provide more helpful message on invalid requirement
closes #540, #1000, #1426
2015-11-13 11:05:02 +01:00
Donald Stufft
f39bc756e5 Merge branch 'develop' into hashes2 2015-11-06 18:46:09 -05:00
Nathaniel J. Smith
5bb9899938 Display spinner during long setup.py calls
One of the downsides of pip's new hiding of build chatter is that for
packages that take a very long time to build (e.g. scipy) the user gets
no indication that anything is happening for a very long time (e.g. tens
of minutes), and is likely to get frustrated and hit Control-C. This can
also create issues for automated systems that kill jobs that don't
produce occasional output (e.g. Travis-CI).

This commit implements an idea discussed here:

  https://github.com/pypa/pip/issues/2732#issuecomment-153215371

where we put up a spinner that rotates whenever the underlying build
produces output. I tried it on scipy, and it the experience was quite
pleasant! It spun around, sometimes fast and sometimes slow, and then
there was one uncomfortable pause for ~1 minute while a very gnarly C++
file got compiled, but that's okay because it was actually providing
accurate feedback.

It looks like:
```
  Running setup.py install for scipy ... /
  Running setup.py install for scipy ... -
  Running setup.py install for scipy ... \
  Running setup.py install for scipy ... done
```
or if the command has non-zero return code, or an exception is raised,
you get:
```
  Running setup.py install for scipy ... /
  Running setup.py install for scipy ... -
  Running setup.py install for scipy ... \
  Running setup.py install for scipy ... error
```
2015-11-05 23:28:03 -08:00
Xavier Fernandez
0cc9d733bf Fix traceback.format_exc call
format_exc takes only one argument, limit which should be an integer.
python 2 seems more lenient than python 3 on that point.

mistake introduced in commit 3148b967a
2015-10-24 00:46:44 +02:00
Xavier Fernandez
f23cbb707f Merge pull request #3179 from cloudnull/fix/req_constraint
Resolves result obj in req_constraints
2015-10-23 18:04:54 +02:00
Kevin Carter
6c50ea5781
Fix to ensure "result" object is defined
The changes resolves a condition that can lead to a stacktrace due to the
use of constraint files. There are several conditions where the result
object may be left undefined which causes the problems.

``` traceback
  Exception:
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 211, in main
      status = self.run(options, args)
    File "/usr/local/lib/python2.7/dist-packages/pip/commands/wheel.py", line 180, in run
      wheel_cache
    File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 266, in populate_requirement_set
      requirement_set.add_requirement(req)
    File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 267, in add_requirement
      return result
  UnboundLocalError: local variable 'result' referenced before assignment
```

This change simply ensures that the 'result' object is a defined
when the method returns.

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2015-10-23 10:20:06 -05:00
Xavier Fernandez
fa91e3dcf4 Use get_installed_version and traceback 2015-10-22 23:15:06 +02:00
Xavier Fernandez
89a27cd740 Special-case based on exception message 2015-10-22 23:15:02 +02:00
Erik Rose
f38fc903f2 Obey --require-hashes option in requirements files.
Removed the mention of "package index options" in the docs, because they don't all fit that category anymore. Not even --no-binary and --only-binary do; they're "install options".
2015-10-21 16:02:47 -04:00
Erik Rose
925e4b4466 Fix false hash mismatches when installing a package that has a cached wheel.
This would occur when, for example, installing from a requirements file that references a certain hashed sdist, a common situation.

As of pip 7, pip always tries to build a wheel for each requirement (if one wasn't provided directly) and installs from that. The way this was implemented, InstallRequirement.link pointed to the cached wheel, which obviously had a different hash than the index-sourced archive, so spurious mismatch errors would result.

Now we no longer read from the wheel cache in hash-checking mode.

Make populate_link(), rather than the `link` setter, responsible for mapping InstallRequirement.link to a cached wheel. populate_link() isn't called until until prepare_files(). At that point, when we've examined all InstallRequirements and their potential --hash options, we know whether we should be requiring hashes and thus whether to use the wheel cache at all.

The only place that sets InstallRequirement.link other than InstallRequirement itself is pip.wheel, which does so long after hashes have been checked, when it's unpacking the wheel it just built, so it won't cause spurious hash mismatches.
2015-10-19 23:40:00 -04:00
Xavier Fernandez
8cbb8af466 Report import setuptools error to the user
closes #2931
2015-10-19 16:43:01 +02:00
Erik Rose
d541304354 Allow === as a pinning operator.
https://www.python.org/dev/peps/pep-0440/#arbitrary-equality
2015-10-11 10:14:30 -04:00
Erik Rose
52111c1397 Demote package-is-already-installed log message to debug-level.
An info-level message for each package might be too intense. And it might give a false sense of security as well: it doesn't confirm that the virtualenv is non-empty; it merely notices when a package we're installing is already there.
2015-10-10 22:44:12 -04:00
Erik Rose
6f828c351f Correct and clarify docs and comments. 2015-10-10 22:44:12 -04:00
Marcus Smith
13d43e3af8 Merge pull request #3170 from qwcode/req_line_numbers2
update for processing continuations/comments for req files
2015-10-09 07:48:28 -07:00
Marcus Smith
b58d2c9f34 process line continuations first (but with some special handling for comments) 2015-10-08 15:25:51 -07:00
Erik Rose
7a0a97c081 Merge 'develop' into 'hashing' to bring the latter up to date. 2015-10-08 13:37:19 -04:00
Xavier Fernandez
6aab626e7d Merge pull request #3153 from xavfernandez/error_project_name_mismatch
Abort installation on metadata mismatch
2015-10-05 23:54:09 +02:00
Marcus Smith
03de1c0072 Merge remote-tracking branch 'pypa/develop' into req_line_numbers 2015-10-03 20:44:21 -07:00
Marcus Smith
615adf9468 Merge remote-tracking branch 'pypa/develop' into issue_3011
Conflicts:
	CHANGES.txt
2015-10-03 10:21:15 -07:00
Marcus Smith
5f3437bd0f normcase the path tail for uninstall items 2015-10-03 10:13:00 -07:00
Marcus Smith
0d8933ced6 normalize the head to resolve parent directory symlinks, but not the tail 2015-10-03 09:17:26 -07:00
Xavier Fernandez
1a012bb63b Abort installation on metadata mismatch
If setup.py egg_info produces metadata for a different project name than
self.req.project_name, abort the installation.
Fixes #3143
2015-10-01 23:40:27 +02:00
Andy Freeland
73a439ea66 Add pip.compat.expanduser to workaround http://bugs.python.org/issue14768 2015-09-29 16:01:32 -04:00
Erik Rose
910b82c59d --require-hashes no longer implies --no-deps.
For dependencies that are properly pinned and hashed (not really dependencies at all, if you like, since they're explicit, root-level requirements), we install them as normal. For ones that are not pinned and hashes, we raise the errors typical of any unhashed requirement in --require-hashes mode.

Since the stanza under "if not ignore_dependencies" doesn't actually add anything if it's already in the RequirementSet, not much has to be done in the way of code: the unhashed deps don't have any hashes, so we complain about them as per usual.

Also...
* Revise wording of HashUnpinned errors. They can be raised even if no hash is specified, so the previous wording was misleading.
* Make wording of HashMissing less awkward.
2015-09-25 19:07:20 -04:00
Erik Rose
0c17248998 Pass PEP 8 checks. 2015-09-24 22:16:00 -04:00
Erik Rose
11dbb92440 Switch from --sha256 etc. to a single option: --hash.
Everybody seems to favor this. Spelled -H, it's still pretty short. And it is less unusual programmatically.
2015-09-24 22:16:00 -04:00
Erik Rose
1e41f01823 Add checks against requirements-file-dwelling hashes for most kinds of packages. Close #1175.
* Add --require-hashes option. This is handy in deployment scripts to force application authors to hash their requirements. It is also a convenient way to get pip to show computed hashes for a virgin, unhashed requirements file. Eventually, additions to `pip freeze` should fill a superset of this use case.
  * In --require-hashes mode, at least one hash is required to match for each requirement.
  * Option-based requirements (--sha256=...) turn on --require-hashes mode implicitly.
  * Internet-derived URL-based hashes are "necessary but not sufficient": they do not satisfy --require-hashes mode when they match, but they are still used to guard against transmission errors.
  * Other URL-based requirements (#md5=...) are treated just like flag-based ones, except they don't turn on --require-hashes.
* Complain informatively, with the most devastating errors first so you don't chase your tail all day only to run up against a brick wall at the end. This also means we don't complain that a hash is missing, only for the user to find, after fixing it, that we have no idea how to even compute a hash for that type of requirement.
  * Complain about unpinned requirements when hash-checking mode is on, lest they cause the user surprise later.
  * Complain about missing hashes.
  * Complain about requirement types we don't know how to hash (like VCS ones and local dirs).
* Have InstallRequirement keep its original Link around (original_link) so we can differentiate between URL hashes from requirements files and ones downloaded from the (untrustworthy) internet.
* Remove test_download_hashes, which is obsolete. Similar coverage is provided in test_utils.TestHashes and the various hash cases in test_req.py.
2015-09-24 22:16:00 -04:00
Erik Rose
3303be0c4e Teach requirements parser how to parser hash options, like --sha256.
We purposely keep it off the CLI for now. optparse isn't really geared to expose interspersed args and options, so a more heavy-handed approach will be necessary to support things like `pip install SomePackage --sha256=abcdef... OtherPackage --sha256=012345...`.
2015-09-23 17:39:32 -04:00
Erik Rose
9211d6e313 Style tweaks 2015-09-23 17:39:32 -04:00
Erik Rose
e058486c91 Fix some docstring typos. 2015-09-23 17:39:32 -04:00
Marcus Smith
2b0a722191 - add a preprocess function so that interactions between filtering and
joining can easily be tested
- add some test cases mentioned by @pgervais
- deal with case of last line ending with \
2015-09-22 16:53:26 -07:00
Marcus Smith
ecdb8584f8 refactor to preserve reporting of original line numbers in requirement files 2015-09-21 14:10:31 -07:00
Robert Collins
8737b9c5a4 Add apparently missing py flavor. 2015-09-15 15:04:58 +12:00
Donald Stufft
11d96fb3c5 Merge pull request #2937 from nakato/i2928
Attempt to install editable packge defined in constraints should error
2015-09-14 16:54:18 -04:00
Xavier Fernandez
ee3c2b0034 InstallRequirement: fix attribute name 2015-09-11 17:23:17 +02:00
Xavier Fernandez
b290e13cfa Allow --pre option in requirement files
closes #1273
2015-09-05 23:13:03 +02:00
Xavier Fernandez
a9325b0727 Allow --process-dependency-links in req files
closes #1274
2015-09-05 20:19:30 +02:00
Xavier Fernandez
e168b845a4 Allow --trusted-host option in requirement files
closes #2822
2015-09-03 22:33:31 +02:00
Donald Stufft
a23a65cee4 Merge pull request #3073 from dstufft/remove-8-deprecations
Remove items slated for removal in pip 8.0
2015-09-03 11:10:51 -04:00