Commit Graph

451 Commits

Author SHA1 Message Date
Nguyễn Gia Phong b28e2c4928 New resolver: Avoid polluting dest dir
Previously, during dependency resolution for `pip download -d <dir>`
or `pip wheel -w <dir>`, distributions downloaded are always saved
to <dir>, even for those are only used in backtracking and are not
part of the returned requirement set.
2020-10-07 13:42:21 +07:00
Nguyễn Gia Phong 6887b0795b Merge usage of download_dir and wheel_download_dir
In every cases, at least one of them is None.  By doing this,
it is also possible to simplify wrapper codes around download_dir.
2020-10-07 13:42:21 +07:00
Nguyễn Gia Phong 78b294e746 Remove download_dir exist check
Both pip download and wheel call endure_dir on the directory.
2020-10-07 13:42:21 +07:00
Pradyun Gedam d0f80a44c9
Merge pull request #8804 from McSinyx/fast-deps-check-dl-dir 2020-10-02 03:41:43 +05:30
Nguyễn Gia Phong 2ef8040495 Comment and rework conditionals in download dir check
Co-authored-by: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com>
2020-10-01 22:00:47 +07:00
Tzu-ping Chung 806c112ed0 Don't crash on 'check' when METADATA is missing 2020-09-28 14:28:53 +08:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Pradyun Gedam 67ab116f00
Merge pull request #8861 from pradyunsg/nicer-output-try-1 2020-09-17 11:00:23 +05:30
Nguyễn Gia Phong c947d00882 [fast-deps] Check download directory before making requests 2020-09-17 10:38:27 +07:00
Nguyễn Gia Phong 8f8a1d65b2 Dedent late download logs 2020-09-13 21:09:57 +07:00
Pradyun Gedam cc472fd54a
Use a symmetric type and make mypy happy 2020-09-10 17:32:58 +05:30
Pradyun Gedam 3d32960c80
Only Print "Collecting ..." when the requirement changes 2020-09-10 17:21:42 +05:30
Pradyun Gedam 963e390abe
Improve how cached wheels are presented
This is specifically for the case of look ups done in the new resolver.
2020-09-10 17:21:04 +05:30
Pradyun Gedam c07ef581e7
Factor out logger.into into a single call
This makes it easier to conditionally print this information.
2020-09-10 17:15:32 +05:30
Nguyễn Gia Phong b46576d933 Give batch downloader a separate class 2020-08-12 16:07:27 +07:00
Nguyễn Gia Phong a1aeb4ce01 Check download folder for files to be downloaded in batch 2020-08-12 16:02:28 +07:00
Nguyễn Gia Phong 18c803a413 Check hashes of memoized downloads 2020-08-11 22:40:42 +07:00
Nguyễn Gia Phong 39d296eeb8 Clean up code style and internal interface
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Chris Hunt <chrahunt@gmail.com>
2020-08-11 22:40:39 +07:00
Nguyễn Gia Phong 078e0effb7 Add memoization mechanism for file download
This is intentionally dependent from caching, which relies on cache dir.
2020-08-11 22:39:42 +07:00
Nguyễn Gia Phong e62f16e969 Make Downloader perform the download 2020-08-11 22:36:08 +07:00
Nguyễn Gia Phong 11f7994a66 Revise method fetching metadata using lazy wheels
* Rename it to fit the fact that it no longer handle
  fetching _not_ using lazy wheels
* Use self as the first parameter
* Unnest the checks with additional logs showing reason
  when lazy wheel is not used
2020-08-06 18:43:02 +07:00
Nguyễn Gia Phong 487d00295c Define RequirementPreparer._session 2020-08-06 18:42:59 +07:00
Pradyun Gedam ee4371c386
Merge pull request #8685 from chrahunt/use-preparer-for-lazy-wheels 2020-08-04 18:46:56 +05:30
Tzu-ping Chung a12e2f1479 PEP 427 mandates UTF-8, we don't need the fallback 2020-08-03 15:00:58 +08:00
Tzu-ping Chung d4995cb89e Implement heuristics to get non-ASCII ZIP entries 2020-08-03 09:29:19 +08:00
Chris Hunt 8b838ebb89 Prepare lazy wheels more so they are downloaded
This keeps all knowledge about preparation and types of requirements in
`RequirementPreparer`, so there's one place to look when we're ready to
start breaking it apart later.
2020-08-02 19:36:29 -04:00
Chris Hunt c7ade159d4 Pass link to _fetch_metadata instead of req
Removes dependence on `InstallRequirement`.
2020-08-02 19:36:29 -04:00
Chris Hunt 21db4f3096 Log in one common location
Reduces dependence on `InstallRequirement` being passed to
`_fetch_metadata`.
2020-08-02 19:36:29 -04:00
Chris Hunt 6c4d4f3b78 Move _fetch_metadata to RequirementPreparer
The fact that all of this functionality can be put in terms of the
`RequirementPreparer` indicates that, at least at this point, this is
the cleanest place to put this functionality.
2020-08-02 19:36:29 -04:00
Chris Hunt f0d4df10eb Propagate lazy_wheel option through RequirementPreparer
Reduces dependence on Candidate (and Resolver (and Factory)).
2020-08-02 18:40:11 -04:00
Chris Hunt 89d8cba55b
Merge pull request #8629 from McSinyx/abstract-abstract
Abstract away AbstractDistribution in higher-level resolver code
2020-08-02 14:41:24 -04:00
Chris Hunt 3f9b326c11 Provide a reasonable error on invalid scheme keys
Originally we would throw an `AttributeError` if a bad scheme key was
used. After refactoring we would throw a `KeyError`, which isn't much
better. Now we call out the wheel being processed, scheme key we didn't
recognize, and provide a list of the valid scheme keys. This would
likely be useful for people developing/testing the wheel.
2020-07-29 22:24:09 -04:00
Chris Hunt 864f0e0efa Explicitly handle incorrect .data paths during wheel install
Previously our wheel installation process allowed wheels which contained
non-conforming contents in a contained .data directory.

After the refactoring to enable direct-from-wheel installation, pip
throws an exception when encountering these wheels, but does not include
any helpful information to pinpoint the cause.

Now if we encounter such a wheel, we trace an error that includes the
name of the requirement we're trying to install, the path to the wheel
file, the path we didn't understand, and a hint about what we expect.
2020-07-29 18:12:16 -04:00
Pradyun Gedam 7056132f6f
Merge pull request #8601 from rouge8/use-feature-requirements-file 2020-07-27 13:19:51 +05:30
Nguyễn Gia Phong b795c9a7d6 Abstract away AbstractDistribution in higher-level resolver code 2020-07-26 17:13:04 +07:00
Pradyun Gedam 3c20d5bfbd
Reject setup.py projects that don't generate .egg-info
This finalizes a deprecation, since we've not recieved any reports from
users in responses to the deprecation.
2020-07-23 22:32:46 +05:30
Andy Freeland d6b0481c8c Add --use-feature to pip freeze requirements parsing 2020-07-19 02:35:50 -07:00
Nguyễn Gia Phong f8b06a3906 Enable flake8-logging-format 2020-07-17 14:33:19 +07:00
Nguyễn Gia Phong cb8d81d135 Nitpick logging calls 2020-07-17 14:33:19 +07:00
Pradyun Gedam 2a07a2444c
Merge pull request #8590 from pradyunsg/install-conflict-warning-move
Change when we warn about dependency conflicts during `pip install`
2020-07-17 05:35:53 +05:30
Chris Hunt af89994eb3
Merge pull request #8574 from chrahunt/refactor/simpler-exception-handling
Simplify wheel install entrypoint exception handling
2020-07-15 16:53:25 -04:00
Pradyun Gedam e3e916be8d
Add a dedicated type for check_install_conflicts 2020-07-16 01:38:36 +05:30
Pradyun Gedam fa2fceecf1
Merge pull request #8189 from gutsytechster/remove_raise_for_status 2020-07-15 18:06:27 +05:30
Chris Hunt 677b4e7f11 Remove redundant try ... except 2020-07-11 15:34:06 -04:00
Chris Hunt 145b7add7e Move error message construction into MissingCallableSuffix
Now, we are free to throw MissingCallableSuffix from anywhere and don't
have to worry about catching it in the middle of our processing.
2020-07-11 15:34:06 -04:00
Chris Hunt f48c44e203 Add req description to error in install_wheel
Moving this value up from `_install_wheel` means that we do not need to
pass `req_description` anymore. This will also let us move our
entrypoint error handling around without worrying about losing the
context from the previous message.
2020-07-11 15:34:06 -04:00
Chris Hunt d13ec25361 Prevent path traversal when installing wheels directly 2020-07-09 21:21:35 -04:00
Chris Hunt 4605b32c49 Don't unpack wheel before installing 2020-07-09 18:25:11 -04:00
Chris Hunt 483213a318 Drop unused wheeldir parameter 2020-07-09 18:25:11 -04:00