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

149 commits

Author SHA1 Message Date
Chris Jerdonek 8dbf88dff7 Update pip-download to respect --python-version. 2019-06-06 13:20:29 -07:00
Chris Jerdonek 99228e503a Import path_to_url() from utils/misc.py instead of download.py. 2019-06-03 02:31:40 -07:00
Chris Jerdonek ce46f8524e
Merge pull request #6545 from cjerdonek/vcs-imports
Remove from pip/_internal/__init__.py the vcs module imports
2019-06-03 02:10:43 -07:00
Chris Jerdonek 5c89643d3d Remove importing from vcs in pip/_internal/__init__.py.
This also renames the current vcs/__init__.py to vcs/versioncontrol.py.
2019-06-03 01:18:36 -07:00
Chris Jerdonek 798d814629 Change PackageFinder to use Tuple[int, ...] instead of List[str] for --python-version. 2019-05-28 03:05:14 -07:00
Chris Jerdonek a9a9cfd98c Improve the debug log message when installing an incompatible wheel. 2019-05-25 23:59:32 -07:00
Chris Jerdonek f82ea77217 Simplify the _check_dist_requires_python() call site. 2019-05-24 21:33:12 -07:00
Chris Jerdonek eeb74aeb29
Merge pull request #6518 from cjerdonek/issue-6371-ignore-requires-python
Fix #6371: make pip install respect --ignore-requires-python
2019-05-22 22:38:20 -07:00
Chris Jerdonek ad2b07898d Fix pip-install to respect --ignore-requires-python. 2019-05-22 21:34:41 -07:00
Andreas Lutro 9eccfae10d redact passwords in output when using --find-links (#6489) 2019-05-22 23:33:41 +02:00
Chris Jerdonek 7e142bae64 Refactor out _check_link_requires_python(), and test. 2019-05-22 09:07:14 -07:00
Chris Jerdonek 4f26eba472 Add CandidateEvaluator.make_found_candidates(). 2019-05-19 13:18:43 -07:00
Chris Jerdonek 7995e2d5a9 Move get_install_candidate() to PackageFinder. 2019-05-19 11:03:47 -07:00
Chris Jerdonek 33959b02d3 Use try-else inside _evaluate_link(). 2019-05-19 09:59:06 -07:00
Chris Jerdonek 1875a8e3f6
Merge pull request #6511 from cjerdonek/package-finder-create-function
Simplify PackageFinder's constructor by accepting a CandidateEvaluator
2019-05-19 09:39:32 -07:00
Chris Jerdonek 10ae49d932 Add py_version_info to CandidateEvaluator's constructor. 2019-05-18 22:40:08 +02:00
Chris Jerdonek cad71a7117 Add PackageFinder.create(), and simplify PackageFinder(). 2019-05-17 11:55:21 -07:00
Chris Jerdonek c54e50f50b Simplify CandidateEvaluator.evaluate_link(). 2019-05-12 15:21:14 -04:00
Chris Jerdonek 3a2a28aeb7 Fix typo. 2019-05-08 19:34:43 -04:00
Chris Jerdonek 5be4e1481e Remove utils/packaging.py's dependence on the current environment. 2019-05-07 21:51:39 -04:00
Chris Jerdonek 10c68e674b Rename _link_package_versions() to evaluate_link(). 2019-05-07 11:54:28 -04:00
Chris Jerdonek 651d6fe705 Move _link_package_versions() to CandidateEvaluator. 2019-05-07 11:46:08 -04:00
Chris Jerdonek 58ee598b03 Refine return type of _package_versions() and find_all_candidates(). 2019-05-07 11:46:08 -04:00
Nicolas Bock 265b4e7e65
Protect @ as safe character when cleaning URLs
Remote URLs that contain a link to a git repository and a tag
reference will have the `@` character converted into `%40`. This is
incorrect.

Fixes: #6437

Signed-off-by: Nicolas Bock <nicolasbock@gmail.com>
2019-04-25 06:26:04 -06:00
Chris Jerdonek dddd28b8de
Add CandidateEvaluator class to encapsulate sorting. (#6424) 2019-04-22 03:40:35 -07:00
Tzu-ping Chung 1ef8857b4d Finder found candidates cleanup (#6415) 2019-04-20 01:22:46 -07:00
Tzu-ping Chung 14cb4f4fb6 Isolate, reuse PackageFinder best candidate logic (#5971)
Split out how PackageFinder finds the best candidate, and reuse it in the
self version check, to avoid the latter duplicating (and incorrectly
implementing) the same logic.
2019-04-16 16:46:25 -07:00
Nicolas Bock 913757cb53
Do not clean base_url
When the `base_url` is a `[]` protected IPv6 address, the
`_clean_link()` function converts `[` to `%5B` and `]` to `%5D`, which
renders the `base_url` invalid. For example:

```
	Starting new HTTP connection (1): fd00:0:0:236:💯8181
	http://fd00:0:0:236:💯8181 "GET /os-releases/19.0.0.0b1/opensuse_leap-42.3-x86_64/requirements_absolute_requirements.txt HTTP/1.1" 200 None
	Setting setuptools==40.6.3 (from -c http://[fd00:0:0:236::100]:8181/os-releases/19.0.0.0b1/opensuse_leap-42.3-x86_64/requirements_absolute_requirements.txt (line 204)) extras to: ()
	Looking in indexes: http://[fd00:0:0:236::100]:8181/simple
	Collecting setuptools==40.6.3 (from -c http://[fd00:0:0:236::100]:8181/os-releases/19.0.0.0b1/opensuse_leap-42.3-x86_64/requirements_absolute_requirements.txt (line 204))
	  1 location(s) to search for versions of setuptools:
	  * http://[fd00:0:0:236::100]:8181/simple/setuptools/
	  Getting page http://[fd00:0:0:236::100]:8181/simple/setuptools/
	  http://fd00:0:0:236:💯8181 "GET /simple/setuptools/ HTTP/1.1" 200 376
	  Analyzing links from page http://[fd00:0:0:236::100]:8181/simple/setuptools/
	    _package_versions: link = http://%5bfd00:0:0:236::100%5d:8181/packages/opensuse_leap-42.3-x86_64/setuptools/setuptools-40.6.3-py2.py3-none-any.whl#md5=389d3cd088d7afec3a1133b1d8e15df0 (from http://[fd00:0:0:
	236::100]:8181/simple/setuptools/)
	    _link_package_versions: link = http://%5bfd00:0:0:236::100%5d:8181/packages/opensuse_leap-42.3-x86_64/setuptools/setuptools-40.6.3-py2.py3-none-any.whl#md5=389d3cd088d7afec3a1133b1d8e15df0 (from http://[fd00
	:0:0:236::100]:8181/simple/setuptools/)
	    Found link http://%5bfd00:0:0:236::100%5d:8181/packages/opensuse_leap-42.3-x86_64/setuptools/setuptools-40.6.3-py2.py3-none-any.whl#md5=389d3cd088d7afec3a1133b1d8e15df0 (from http://[fd00:0:0:236::100]:8181/
	simple/setuptools/), version: 40.6.3
	  Using version 40.6.3 (newest of versions: 40.6.3)
        Could not install packages due to an EnvironmentError.
        InvalidURL: Failed to parse: %5bfd00:0:0:236::100%5d:8181
```

This change uses the vendored `urllib` library to split the host part
off of the url before URL quoting only the path part.

Fixes: #6285
Signed-off-by: Nicolas Bock <nicolasbock@gmail.com>
2019-04-07 05:57:03 -06:00
Clark Boylan 63ccc286a0 Consistently catch exceptions in index.py
In index.py we were catching requests.exceptions.RetryError and
requests.exceptions.SSLError but then also caught requests.HTTPError.
For consistency catch all of these requests exceptions using the
requests.exceptions path.
2019-04-03 11:49:07 -07:00
Pi Delport 5f3c56e188 Fix some typos 2019-03-12 21:54:18 +01:00
Daniele Esposti 729404d4c5 Redact the password from the extra index URL in log messages (#6295) 2019-03-01 04:21:45 -08:00
Maxim Kurnikov 7977443556 remove unused exc variable 2019-02-22 14:17:49 +03:00
Maxim Kurnikov f77b8ca051 remove #noqa: F401 2019-02-22 14:17:07 +03:00
Pradyun Gedam 7222cb8fdb
Remove --process-dependency-links and related support code 2019-01-02 17:27:06 +05:30
Pradyun Gedam 89ef777c18
Cleanup for issues fixed with mypy upgrade 2018-12-18 15:10:40 +05:30
Maxim Kurnikov 8fc393a2d1 Add type annotations for pip._internal.pyproject, pip._internal.build_env, pip._internal.index, pip._internal.resolve (#6072) 2018-12-17 16:43:23 +05:30
Pradyun Gedam fc62b5b677
Move wheel extension information to remove cycle imports 2018-11-30 12:46:08 +05:30
Benjamin Peterson 5f5415756d Add missing spaces to log message about skipping a link due python version incompatibility. (#5992) 2018-11-09 12:21:13 +05:30
Chris Jerdonek 5c93250fa9
Merge pull request #5875 from uranusjr/egg-info-canonical
Rewrite egg_info_matches with canonicalize_name
2018-10-30 01:30:40 -07:00
Tzu-ping Chung 033a47cbf2 More test cases 2018-10-29 15:48:43 +08:00
Tzu-ping Chung ad9cbf50ca More robust egg-info/name match
The idea is to use regex to scan for character sequences that would
be canonicalized into a dash, and skip the equal amount of sequences
to the given canonical name.
2018-10-22 16:48:24 +08:00
Tzu-ping Chung 3368819156 Split, simplify, and fix egg_info_matches 2018-10-22 16:46:42 +08:00
Tom Forbes 78371cc950 Redact basic authentication passwords from log messages (#5773)
Redact basic authentication passwords from URLs.
2018-10-19 02:06:10 -07:00
Chris Jerdonek 8dbbe165f8
Merge pull request #5838 from uranusjr/htmlpage-extract-breakdown-get-page
Refactor _get_html_page() to use exceptions for flow control
2018-10-11 12:27:17 -07:00
Tzu-ping Chung fc53f711b9 More tests on successful scenarios, fix docstrings 2018-10-11 17:47:08 +08:00
Tzu-ping Chung 65260d0449 Fix behavior if archive-like URL is not HTTP(S)
The original implementation erros out when this happens, and the new one
follows. The debug logging message is however changed to be clearer about
what happened.

Also fixed some minor typos.
2018-10-11 17:45:22 +08:00
Tzu-ping Chung 68cf77ac0b Only store what we need in _NotHTML 2018-10-11 17:45:22 +08:00
Tzu-ping Chung a9ebb795ed More detailed information on Content-Type error, fix typos 2018-10-11 17:45:11 +08:00
Tzu-ping Chung d4da76ceaa Move directory check out of _get_html_response()
This also "fixes" an edge case where a directory is dropped if it is
named like an archive.
2018-10-11 17:45:11 +08:00
Tzu-ping Chung 231e6165dd Group HEAD optimization logic into HTML getter, add docs 2018-10-11 17:44:59 +08:00
Tzu-ping Chung bad04d8549 Extract content type detection logic 2018-10-11 17:44:59 +08:00
Tzu-ping Chung 44713cafe5 Move VCS scheme check back out 2018-10-11 17:44:59 +08:00
Xavier Fernandez 3832020a1f
Merge pull request #5483 from popravich/retry_fix
Handle RetryError in HTMLPage (fixes #5270)
2018-10-08 23:12:34 +02:00
Chris Jerdonek 69b5917bc1
Merge pull request #5836 from uranusjr/bugfix-warn-directory-path-drop-index-url
Warn when dropping index URL value to directory
2018-10-08 11:20:35 -07:00
Pradyun Gedam 9e26002fcd
Bump deprecation version to unlock workflow 2018-10-08 20:46:17 +05:30
Alexey Popravka a853ca02b8 fix lint issues 2018-10-02 12:53:06 +03:00
Alexey Popravka 41a9d5e003 handle RetryError in HTMLPage/PackageFinder 2018-10-02 12:53:06 +03:00
Tzu-ping Chung 025dc45ad1 Don't need to unpack prematurely 2018-10-01 16:49:57 +08:00
Tzu-ping Chung bb6dae6e71 Inline PackageFinder._get_page() 2018-10-01 16:07:41 +08:00
Tzu-ping Chung 72779c674e Extract request part of get_page into helper
Also switch to use exceptions as flow control for VCS and Content-Type
detection. Hopefully this makes the flow much clearer.
2018-10-01 16:07:00 +08:00
Tzu-ping Chung 7a17a1f7dd Extract VCS scheme check into helper function 2018-10-01 15:54:04 +08:00
Tzu-ping Chung 8dcae5ba48 Warn when dropping index URL value to directory 2018-10-01 14:50:09 +08:00
Tzu-ping Chung bd6a7ea6c6 Pass the URL instead of the page itself into Link
This argument (comes_from) is only used for reporting, and it is enough
to pass in only the URL since that's what is actually used.
2018-09-30 17:46:21 +08:00
Tzu-ping Chung d275360745 Move static methods out of HTMLPage
Because the class is going away, but these functions will still be
needed by the thing replacing it.
2018-09-30 17:46:21 +08:00
Tzu-ping Chung 6f85fcdd7d Move clean_link out of HTMLPage 2018-09-28 23:58:24 +08:00
Tzu-ping Chung 47ba191d3a Rename HTMLPage.links to clarify its purpose 2018-09-28 16:53:02 +08:00
Tzu-ping Chung aa83222bf0 Rename base URL detection function 2018-09-28 16:52:57 +08:00
Tzu-ping Chung dc7e6b5950 Refactor _parse_base_url to use early return 2018-09-28 15:52:00 +08:00
Tzu-ping Chung 28ef0c2014 Convert HTMLPage.parsed into a local variable
This attribute is only used by HTMLPage.links, which is only used once
per instance in PackageFinder.find_all_candidates(), so this change does
not affect performance or behavior, but improves data locality.
2018-09-28 15:02:51 +08:00
Tzu-ping Chung 94d0428924 Extract encoding detection into helper function 2018-09-28 15:00:58 +08:00
Tzu-ping Chung 40bf3688b4 Convert base_url property into local variable
This property is only used in HTMLPage.links, which is only called once
per instance in PackageFinder.find_all_candidates(). This would not
affect performance or behavior, but improves data locality.

The unit test of this property is and modified to test the underlying
function instead.
2018-09-28 14:56:52 +08:00
Tzu-ping Chung 96a3254a1f Extract base URL parsing logic 2018-09-28 14:49:40 +08:00
Tzu-ping Chung d71f3311dc Fix egg_info_matches version split logic 2018-09-27 15:41:07 +08:00
Tzu-ping Chung 894f6558f1 Remove skip_archives argument 2018-09-27 15:41:02 +08:00
Donald Stufft dcc3c16b54 Only revalidate /simple/ pages instead of caching for 10 minutes 2018-09-18 06:54:51 -04:00
Nitesh Sharma 82b25ffe6c sort imports properly 2018-09-02 23:25:14 +05:30
Nitesh Sharma fd692f32ba move format control to models and write parametrized test 2018-09-02 23:08:07 +05:30
Nitesh Sharma b818b8324d refactor format control and rename test functions 2018-08-28 21:45:40 +05:30
Nitesh Sharma e10a613212 Refactoring: Move FormatControl to separate class
This moves FormatControl named tuple and it's all related
methods to separate class.

Closes https://github.com/pypa/pip/issues/5592
2018-08-28 21:12:42 +05:30
Pradyun Gedam afd3945089
Mention PEP 508 URL dependencies as a replacement for dependency links 2018-08-23 12:29:58 +05:30
Pradyun Gedam 4fc697847a
Update imports for the moved compat module 2018-07-29 18:32:20 +05:30
Pradyun Gedam 8df8e53901
Merge branch 'master' into refactor/introduce-models 2018-07-24 01:35:56 +05:30
Pradyun Gedam e027cd8449
Update deprecation utilities to specify versions
Also:
- Remove conditional warning/error level logging
- Remove now-obsolete class
- Update call sites as per new signature
2018-07-15 17:15:31 +05:30
Pradyun Gedam a8eaf1e0ff
Add a helper function for deprecation (and use it) 2018-07-15 17:02:03 +05:30
Pradyun Gedam 89223dd47c
Sort imports 2018-06-24 02:41:57 +05:30
Pradyun Gedam 39995b32db
Move Link to models 2018-06-24 02:38:21 +05:30
Pradyun Gedam f1cf9a06e9
Move InstallationCandidate to models + add tests 2018-06-24 02:38:21 +05:30
Pradyun Gedam aa146d5dc2
Kick the can down the road for dependency-links 2018-06-21 21:19:24 +05:30
Philip Molloy 8d3f5e7b76 Improve dependency links log message (#4936) 2018-05-30 23:01:14 +05:30
Pradyun Gedam 88e17b4aed
Update the import for PyPI Index model 2018-05-30 01:44:51 +05:30
Pradyun Gedam 144b42d799
Remove username/password from log message
Merge pull request #5339 from jzafran/remove-password-from-stdout
2018-05-22 11:03:10 +05:30
Daniel Shaulov d67d98dd91 Add a --prefer-binary flag. (#5370)
The flag makes pip prefer an older but valid binary distributions over a newer source distributions.

Fixes #3785.
2018-05-11 11:17:32 +05:30
Jeremy Zafran 7655893601 remove usernames and passwords for index URLs using basic auth from "Looking in indexes" log messages 2018-04-27 00:41:54 -04:00
Donald Stufft 275ab7c3f5 Switch pip to use Warehouse by default 2018-04-16 15:54:11 -04:00
Pradyun Gedam 729990c986
Round 1 of Cleanups (#4844)
* misc: fix typo
* misc: 🎨 cleanup parenthesis
* misc: 🎨 minor simplifications
* tests: fix test_console_to_str_warning
2017-12-25 15:23:27 +05:30
Anthony Sottile 9762eb02e3 Upgrade syntax in src/pip/_internal
Changes were automated via https://github.com/asottile/pyupgrade

See #4921
2017-12-14 21:59:22 -08:00
Pradyun Gedam 353a13ddff
isort: Include trailing commas 2017-11-21 13:23:59 +05:30
Ville Skyttä 8fb2b6318f Python 3.6 invalid escape sequence deprecation fixes
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2017-09-15 23:35:45 +03:00
Donald Stufft 95bcf8c5f6 Move all internal APIs to pip._internal 2017-08-31 14:53:00 -04:00
Renamed from pip/index.py (Browse further)