Commit Graph

82 Commits

Author SHA1 Message Date
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