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

185 commits

Author SHA1 Message Date
Ville Skyttä
cee7a53712 Python 3.6 invalid escape sequence deprecation fixes 2017-03-20 13:54:29 +01:00
Donald Stufft
bb48371714 Removed the deprecated `--egg` flag 2017-03-19 20:31:23 -04:00
Anish Tambe
f913942479 Improve message when installing requirements file (#4127) (#4211)
* improve message when installing requirements file (#4127)

* Refactor for issue (#4127)
2017-01-17 23:14:09 +01:00
Xavier Fernandez
b867c78904 Refactor InstallRequirement instantiation 2016-12-11 19:53:25 +01:00
Xavier Fernandez
8f171cd212 Fix environment markers evaluation - issue #3829 (#4051) 2016-11-02 08:28:17 -04:00
Paul Moore
1f2d639029 Skip a couple of tests that fail on Windows 2016-09-01 19:59:07 +01:00
Jakub Wilk
6dc28c1b31 Fix typos 2016-06-10 21:29:43 +02:00
burrows
3c11bb4de9 Give markers chance to remove incompat wheel links
`pip install -r reqs.txt` was failing when the requirements file includes
an unsupported wheel, regardless of whether it is conditionally removed
by a marker. This patch fixes that issue.

Additionally, this patch makes pip check local file wheels for
compatibility. Previously, a requirements file could include a path
to a valid wheel for any platform and pip would happily install it.
2016-04-07 13:00:03 -04:00
Donald Stufft
8e236dd6a0 Update to use the Requirement class from packaging 2016-03-07 11:40:39 +11:00
Ed Morley
4bc0395a53 Correct the suggested package hash lines for URL requirements
When require hashes mode is enabled, if any packages defined in the
requirements file are missing a hash, installation fails with a message
suggesting the appropriate lines that should be copied into the
requirements file.

This worked fine for requirement specifiers such as `requests==2.9.1`,
however for packages specified by URL, the resultant output did not
match that originally in the requirements file.

For example a requirements file containing:
```
--require-hashes
https://github.com/benoitc/gunicorn/archive/19.4.5.zip
https://github.com/kennethreitz/requests/archive/v2.9.1.zip#egg=requests==2.9.1
```

Would result in:
```
Hashes are required in ...
    unknown package --hash=sha256:399347c0a7272fb70b45d5840027c372f...
    requests==2.9.1 --hash=sha256:89839b1698243e232780d1fc808ae8730...
```

Now the original URL line is correctly shown:
```
Hashes are required in ...
    https://github.com/benoitc/gunicorn/archive/19.4.5.zip --hash=...
    https://github.com/kennethreitz/requests/archive/v2.9.1.zip#egg=requests==2.9.1 --hash=...
```

Fixes #3362.
2016-03-04 10:46:40 +00:00
Stéphane Bidoul
f3ca1b973f remove editable_options which is now obsolete code 2016-02-09 11:08:16 +01:00
Xavier Fernandez
08932c4a4e Fix test_reqs unit tests on windows 2016-01-17 22:40:46 +01:00
Xavier Fernandez
d459969b03 fix test_unexisting_path on windows 2015-12-01 13:07:19 +01:00
Xavier Fernandez
b939c3d6d2 fix test_unsupported_hashes for windows 2015-12-01 12:57:46 +01:00
Xavier Fernandez
e42e822f2c Provide more helpful message on invalid requirement
closes #540, #1000, #1426
2015-11-13 11:05:02 +01: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
0e6058bc63 Change head() method to an attr in hashing exceptions. Tweak English.
Standardize on present tense, improve flow, and clarify.
2015-10-10 22:44:12 -04:00
Erik Rose
bf0ff80d73 pep8 fixes 2015-10-07 17:31:40 -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
f3f73f1c07 Remove the -H spelling for --hashes.
dstufft is nervous about blowing a single-char option on something that will usually be copied and pasted anyway. We can always put it back later if it proves to be a pain.
2015-09-25 15:32:33 -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
Marcus Smith
d85ceb06fe Merge pull request #2846 from mrtrumbe/dev/issue1236_movetests
Moved tests for InstallRequirement extras handling from test_req_file to test_req.
2015-06-01 07:30:21 -07:00
matthew
111dbc95dc Moved tests for InstallRequirement extras handling from test_req_file to test_req. 2015-05-31 13:43:39 -05:00
Donald Stufft
56d5076ee2 Hide setup.py output unless using -v 2015-05-20 21:27:12 -04:00
Marcus Smith
90f17915be consolidate tests from test_req to test_req_file 2015-04-13 00:07:15 +02:00
Marcus Smith
6c747be598 move some tests from test_req to test_req_file 2015-04-13 00:07:15 +02:00
Georgi Valkov
0da51b14d7 Remove misleading test cases and improve docs 2015-04-12 23:52:49 +02:00
Georgi Valkov
29f0c75c63 Do not shlex.split() and flatten value of global|install_options 2015-04-12 23:52:49 +02:00
Georgi Valkov
5a57325761 Fix pep8 compatibility 2015-04-12 23:52:49 +02:00
Georgi Valkov
832c050ca4 Fix pep8 compatibility 2015-04-12 23:52:49 +02:00
Georgi Valkov
0ab7a7bbb5 Use optparse and pip.cmdoptions for parsing requirement-line options 2015-04-12 23:52:49 +02:00
Georgi Valkov
4a70730617 Replace all occurrences of install|global-options with install|global-option 2015-04-12 23:52:49 +02:00
Georgi Valkov
b014668b30 Add --install-options and --global-options to the requirements file parser
This allows lines such as the following to exist in requirements files:

  INITools==0.2 --install-options="--prefix=/opt"
  virtualenv>=1 --global-options="--no-user-cfg"

In addition, the requirements file parser was overhauled with simplicity
and clarity in mind.
2015-04-12 23:52:49 +02:00
Xavier Fernandez
a947c29903 Always check environment markers
Fixes #2658
2015-04-07 22:42:17 +02:00
Donald Stufft
a510b2229e Reverts #2493 - Upgrades will again contact the index 2015-04-04 14:21:40 -04:00
Marc Abramowitz
d02cb6de43 Speed up _filter_install function
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
2015-03-19 19:27:19 -07:00
Donald Stufft
34073df838 Merge pull request #2493 from msabramo/issue-770-redux
Fix for #770: pip install -U shouldn't look at pypi if not needed
2015-03-17 07:26:34 -04:00
Marc Abramowitz
94fcd18ed4 Fix for #770: pip install -U shouldn't look at pypi if not needed
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.

Adds a test called
`test_upgrade_no_look_at_pypi_if_exact_version_installed`.

This is a rework of PR #771, because that PR is old and has merge
conflicts that were easier to fix by applying the changes manually.
2015-03-16 22:30:13 -07:00
Marc Abramowitz
d04850659c Make get_dist handle egg_info_path w/ slash at end
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'
2015-03-16 11:48:41 -07:00
Donald Stufft
cc7d178712 Fix tests 2015-03-16 08:44:02 -04:00
Donald Stufft
0de8e98708 Merge pull request #2496 from msabramo/test_req_add_tests
Add test_{str,repr} to tests/unit/test_req.py
2015-03-16 07:57:28 -04:00
Marc Abramowitz
90a7edfcca Add test_{str,repr} to tests/unit/test_req.py
Corrects my failure to include a test with
https://github.com/pypa/pip/pull/2495
2015-03-06 08:56:24 -08:00
Xavier Fernandez
e8e2566279 replace InstallRequirement.url by a link attribute 2015-03-05 11:01:28 +01:00
Matej Stuchlik
c5024dc851 Mark tests requiring Internet access 2015-01-15 00:53:15 +01:00
Donald Stufft
5f414a69c6 Don't return cached output for InstallRequirement().installed_version 2014-12-23 07:39:13 -05:00
Xavier Fernandez
06da6c07ec Fix environment extras installation for sdist
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
2014-12-19 19:12:20 +01:00
Xavier Fernandez
4ea7937264 parse_editable: clarify output
extras and editable_options are two different things
2014-12-19 19:11:14 +01:00
Marc Abramowitz
59d1ce1af7 Add test_installed_version_not_installed
Checks what happens when user tries to get `installed_version` property
for a InstallRequirement object when that distribution is not installed.
2014-12-17 15:23:42 -08:00
Donald Stufft
6f64d3e6e2 Implement PEP 440 2014-12-13 13:50:21 -05:00
Victor Stinner
e498d83db1 Support markers in requirements
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'
2014-11-20 10:52:08 -05:00
Donald Stufft
767d11e49c Switch to using the stdlib logger instead of pip.log 2014-09-10 09:36:09 -04:00
Donald Stufft
e4d1228e47 Test that parse_requirements does not require a finder 2014-08-30 17:20:21 -04:00
Marcus Smith
15427fda9a add missing vcs prefixes 2014-08-03 21:49:47 -07:00
Marcus Smith
4eb9e3297f InstallRequirement.url should preserve the initial value for from_line requirements 2014-08-03 21:01:12 -07:00
Jyrki Pulliainen
3377dd1917 req: Support --no-use-wheel flag in requirements.txt
Default from pip 1.6 will be to always use wheels, so the --use-wheels
in requirements.txt is now deprecated. However, the --no-use-wheels
is introduced to be able to disable wheel usage via requirements.txt.
2014-06-10 14:57:24 +02:00
Marcus Smith
3d64db281b merge 1.5.X into develop 2014-05-26 15:06:36 -07:00
Marcus Smith
3066157cc3 when installing from wheel files, parse the filename to build the requirement 2014-05-25 21:00:39 -07:00
Donald Stufft
52ca02608e Use CacheControl instead of custom cache code
* Deprecates the --download-cache option & removes the download
  cache code.
* Removes the in memory page cache on the index
* Uses CacheControl to cache all cacheable HTTP requests to the
  filesystem.
  * Properly handles CacheControl headers for unconditional
    caching.
  * Will use ETag and Last-Modified headers to attempt to do a
    conditional HTTP request to speed up cache misses and turn
    them into cache hits.
  * Removes some concurrency unsafe code in the download cache
    accesses.
  * Uses a Cache-Control request header to limit the maximum
    length of time a cache is valid for.
* Adds pip.appdirs to handle platform specific application
  directories such as cache, config, data, etc.
2014-05-09 18:28:20 -04:00
Donald Stufft
7037443975 Require an already created session to be passed into APIs 2014-05-06 22:37:46 -04:00
Alex Gaynor
a94ce18f62 Use the correct URL in the test
This saves loading a redirect in the test suite. speeeeeeed
2014-05-06 16:35:18 -07:00
Donald Stufft
95035fc5c4 Turn on everything in flake8
flake8 ignores some errors by default, these ignored by defaults
change sometimes. This will make things stabler by selecting
everything.
2014-02-24 16:52:23 -05:00
Donald Stufft
9f027337a8 Use Flake8 on the test of pip's Python files 2014-01-28 19:47:58 -05:00
Donald Stufft
2743768b7b Fix the style of the code base to better match pep8 2014-01-27 14:11:29 -05:00
Donald Stufft
8a2882c2c6 Merge branch 'master' into develop
Conflicts:
	pip/__init__.py
	pip/req.py
2014-01-26 10:39:29 -05:00
Donald Stufft
bd7dae9ed3 Properly parse comments from the end of a line 2014-01-22 21:50:57 -05:00
Marcus Smith
a7c522da97 fix references to req methods/classes after refactor 2014-01-12 10:05:11 -08:00
Stefan Scherfke
4fb769f9e0 Fix test to run on Python 2.6. 2013-12-20 14:31:12 -05:00
Stefan Scherfke
83a85fedc9 Try utf-8, the system’s default encoding, and latin1 when reading egg_info-files to avoid UnicodeDecodeErrors at the installation of a package. 2013-12-20 14:31:12 -05:00
Stefan Scherfke
eda45bfcf7 Fix test to run on Python 2.6. 2013-12-20 12:49:53 -05:00
Stefan Scherfke
b878de0fe1 Try utf-8, the system’s default encoding, and latin1 when reading egg_info-files to avoid UnicodeDecodeErrors at the installation of a package. 2013-12-20 12:49:52 -05:00
Marcus Smith
3dc40cad46 - if installing directly from a wheel, fail if it has an invalid name or is unsupported
- when walking links, skip invalid wheel filenames, don't crash
2013-11-14 16:35:24 -08:00
Paul Nasrat
a1bbab37d4 Fix deleted brack 2013-09-30 13:52:08 -04:00
Paul Nasrat
951ef7438c Merge remote-tracking branch 'niedbalski/develop' into subdirectory-editable
Conflicts:
	CHANGES.txt
	tests/functional/test_install_reqs.py
	tests/lib/__init__.py
	tests/unit/test_req.py

Additional work - refactored tests to new style.
2013-09-27 14:42:05 -04:00
Donald Stufft
1650d4166a Fix some missing find_links -> data.find_links switches 2013-08-27 06:49:40 -04:00
Donald Stufft
487925ea3f Isolate the tests from the shared data directory 2013-08-27 06:49:35 -04:00
Donald Stufft
da0bc4b1d1 Switch to using py.test as the test runner instead of nose
* 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
2013-08-21 10:19:58 -04:00
Jorge Niedbalski
abf27b5bd2 [tests] added test for subdirectory editable options 2013-07-24 12:25:35 -03:00
Marcus Smith
3b0eb9136a fix regexp for windows paths 2013-07-11 21:36:46 -07:00
Marcus Smith
78a40129dd patch wheel unit tests to appear to be running with setuptools 2013-06-27 18:08:25 -07:00
Marcus Smith
3e460e6946 test merge fixes 2013-06-19 17:08:32 -07:00
Marcus Smith
60f8da5c41 4 more wheel tests 2013-06-06 19:11:43 -07:00
Marcus Smith
28298c413d more functional/unit tests restructure 2013-05-29 13:41:13 -07:00
Marcus Smith
2e2ce0f4e9 break up tests dir into data, unit tests, and functional tests 2013-05-29 13:41:12 -07:00
Renamed from tests/test_req.py (Browse further)