Commit Graph

182 Commits

Author SHA1 Message Date
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +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 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
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
Nguyễn Gia Phong b795c9a7d6 Abstract away AbstractDistribution in higher-level resolver code 2020-07-26 17:13:04 +07:00
gutsytechster 8c267e6e39
feat(pip/_internal/*): Use custom raise_for_status method 2020-07-08 18:08:55 +05:30
Chris Hunt c9f87a645b Inline constant variable 2020-07-06 21:19:43 -04:00
Chris Hunt d3955e7837 Don't unpack wheels during preparation
For some time we have not needed to pre-emptively unpack wheels as part
of metadata processing, but kept the existing logic because the
behavior would start to diverge more for different package types. In
this case, though, removing the special cases for wheels makes this
logic a bit simpler, so it is worth doing.
2020-07-06 21:15:35 -04:00
Pradyun Gedam 343f863785
Apply suggestions from code review 2020-06-17 23:20:55 +05:30
Nguyễn Gia Phong 8b5ff72a13 Make linked req hashes an independant method 2020-06-17 23:11:46 +07:00
Nguyễn Gia Phong eb2deab2f6 Move req.source_dir ensure out 2020-06-17 23:07:29 +07:00
Nguyễn Gia Phong 6bb0d289f8 Move link log from prepare_linked_requirement 2020-06-17 23:03:08 +07:00
Tzu-ping Chung 09a7f271c7 Only attach UUID to build dir for spec candidates
These are the only cases where backtracking can happen. This approach
also accounts for VCS requirements relying on the same ensure function
to do cloning :/
2020-06-04 23:26:19 +08:00
Pradyun Gedam 0bd624275d
Revert "build in place"
This reverts commit 88e6e6bc5c.
2020-05-13 02:50:10 +05:30
Pradyun Gedam 1b90e1bccf
Revert "remove _copy_source_tree and friends"
This reverts commit 873f1e6332.
2020-05-13 02:50:10 +05:30
Stéphane Bidoul 873f1e6332
remove _copy_source_tree and friends 2020-04-12 12:00:57 +02:00
Stéphane Bidoul 88e6e6bc5c
build in place 2020-04-12 12:00:57 +02:00
Miro Hrončok 98aa09cf88 Prevent infinite recursion with pip wheel with $TMPDIR in $PWD
During a build of extension module within `pip wheel` the source directory is
recursively copied in a temporary directory.

See https://github.com/pypa/pip/issues/7555

When the temporary directory is inside the source directory
(for example by setting `TMPDIR=$PWD/tmp`) this caused an infinite recursion
that ended in:

    [Errno 36] File name too long

We prevent that buy never copying the target to the target in _copy_source_tree.

Fixes https://github.com/pypa/pip/issues/7872
2020-03-19 18:07:56 +01:00
Chris Hunt fad99dce4a Inline _copy_file 2020-03-08 18:10:17 -04:00
Chris Hunt cd5d8b7865 Inline unconditional block 2020-03-08 18:10:17 -04:00
Chris Hunt 36d52edeb4 Inline variable 2020-03-08 18:10:17 -04:00
Chris Hunt e1d1b1c192 Remove dead code
Since download_location doesn't exist, this block could've never been
executed.
2020-03-08 18:10:16 -04:00
Chris Hunt b0cd7a7a0b Assert that download_location doesn't exist in _copy_file 2020-03-08 18:04:43 -04:00
Chris Hunt 420a6d26de Pass combined download_location to _copy_file
This makes the function arguments look more like `src` and `dest`,
which makes more sense for a file copying function.
2020-03-08 18:01:49 -04:00
Pradyun Gedam 3c684b5910
Merge pull request #7695 from chrahunt/refactor/remove-confusing-comment
Remove confusing comment from operations.prepare
2020-02-06 18:50:18 +05:30
Chris Hunt 8197a4bbc5 Do not write delete marker file to track source_dir delete preference
Previously we were writing a delete marker file which is checked in
InstallRequirement.remove_temporary_source which is only invoked if the
user did not pass --no-clean (and a PreviousBuildDirError was not
raised). Since our TempDirectory machinery now respects these conditions
we can just wrap our source directory in that instead of using this
ad-hoc mechanism for tracking our delete preference.

This will let us clean up a lot of dead code that only existed for this
use case.
2020-02-05 20:14:44 -05:00
Chris Hunt c7cb3cd81d Calculate autodelete_unpacked earlier in prepare_linked_requirement
We want to use this value to determine whether a globally-managed
source_dir should delegate choosing deletion to the global tempdir
manager, so it needs to be above our call to
InstallRequirement.ensure_has_source_dir.
2020-02-05 20:14:44 -05:00
Chris Hunt e69d10637b Remove confusing comment from operations.prepare
prepare_linked_requirements only handles non-editable requirements, so
this comment seems like its been misplaced over several years of
refactoring.
2020-02-04 21:57:43 -05:00
Chris Hunt 4acc059cfd Remove unused argument 2020-02-04 21:55:42 -05:00
Chris Hunt c825c53f76 Rename unpack_{file,http}_url since they no longer unpack 2020-02-04 21:55:12 -05:00
Chris Hunt ada2f55f13 Inline file variable 2020-02-04 21:49:42 -05:00
Chris Hunt 135f2ac0ef Move unpacking into unpack_url 2020-02-04 21:49:42 -05:00
Chris Hunt 35a52c1397 Hold file in intermediate variable in unpack_url 2020-02-04 21:49:42 -05:00
Chris Hunt 71eaa4658f Return File from unpack_* functions
Since we need both the file path and content type to unpack, and we want
to move unpacking out of the lower-level functions, return all the
information needed so it's easier to move the unpacking out.
2020-02-04 21:49:42 -05:00