Commit Graph

59 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 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
Nguyễn Gia Phong 4f210f3608 [2020-resolver] List downloaded distributions before exiting
This unifies the behavior of pip download for both legacy and new
resolvers.  InstallRequirement.successfully_download is no longer needed
for this task and is thus retired.
2020-08-06 16:52:31 +07:00
gutsytechster b82516c9ca fix(_internal/commands): Define a default add_option to child commands 2020-05-23 14:55:37 +05:30
gutsytechster 72a42197a4 refactor(commands): Add method add_options and remove __init__
This removes the __init__ method of child classes and defines
explicit method for adding command options.
2020-05-23 14:50:57 +05:30
Devesh Kumar Singh e8b842389c Always return SUCCESS from download.run 2020-05-22 19:44:29 +05:30
Devesh Kumar Singh 5e33373a07 Remove req.name check 2020-05-22 00:42:37 +05:30
Devesh Kumar Singh 716a067335 Return int status code from download.run 2020-05-22 00:32:37 +05:30
Devesh Kumar Singh 2da7a2b077 Type annotations for pip._internal.commands.download 2020-05-19 12:45:22 +05:30
Tzu-ping Chung 6db0df928c Move wheel cache out of InstallRequirment 2020-03-30 17:36:03 +08:00
Chris Hunt 60a2fa4dce Inline unconditionally-executed blocks 2020-02-23 18:05:09 -05:00
Chris Hunt 45911713db Globally manage temp build dir
This will let us remove the indentation associated with the `with`
statement and eventually refactor these functions more easily.
2020-02-23 18:04:46 -05:00
Chris Hunt eb91e8ca39 Use Command context helper to cleanup requirement tracker
The lifetime of the requirement tracker will be essentially the same,
but now we have more flexibility on where in the code we create it.

In a followup we can do the same thing with build_dir and remove the
`with` statement (and its indentation) entirely from these commands.
2020-02-23 14:37:01 -05:00
Paul Moore 89bf3b02db Record on the requirement whether it has been successfully downloaded 2020-02-07 16:40:27 +00:00
Chris Hunt e7998a3617 Rename populate_requirement_set to get_requirements 2020-02-05 22:30:07 -05:00
Chris Hunt 543c84402d Remove unused requirement_set in commands 2020-02-05 22:30:07 -05:00
Chris Hunt de5ec7e884 Remove unused requirement_set argument 2020-02-05 22:30:07 -05:00
Chris Hunt 779d8df5e6 Inline check_supported_wheels
Reduces our dependency on RequirementSet in individual commands.

The default value for this is True, used everywhere except
InstallCommand.
2020-02-05 22:30:07 -05:00
Chris Hunt 5dcc562616 Return a list of InstallRequirement from populate_requirement_set
Next we can hide RequirementSet from the setup phase of the individual
commands.
2020-02-05 22:30:07 -05:00
Chris Hunt fd815bc1fa Pass in a plain list of InstallRequirement to Resolver.resolve
Further simplifies the Resolver interface, and will give us the
opportunity to remove any knowledge of RequirementSet from the
individual commands.
2020-02-05 22:30:05 -05:00
Chris Hunt 550ae907bd Parameterize check_supported_wheels to Resolver.resolve
This reduces our dependence on the input RequirementSet.
2020-02-05 22:29:46 -05:00
Chris Hunt 58c06299db Return a different RequirementSet from Resolver.resolve
This makes the resolver interface simpler by returning a brand new
RequirementSet vs mutating the one that was input to the function, and
will let us specialize RequirementSet for the different use cases.
2020-02-05 22:29:30 -05:00
Chris Hunt 4a93045be1 Remove no-op RequirementSet.cleanup_files 2020-02-05 20:16:05 -05:00
Chris Hunt 7068e58b6f Configure tempdir registry
This mirrors the current logic within the individual requirement-related
commands (install, wheel) for setting options.no_clean, which is used to
determine whether we need to delete directories.

Next, we'll add the actual directories to track and remove them from
being managed by other objects.
2020-02-04 20:22:39 -05:00
Chris Hunt 0b4ec28a39 Centralize addition of no_clean argument
We want to rely on --no-clean being a valid option for
RequirementCommand types, so move it to one place close to the code that
will depend on it.
2020-02-04 20:22:39 -05:00
Stéphane Bidoul (ACSONE) 1ee270a8d4
Check that the cache is writable in _main()
This avoid code duplication (for the wheel and http
cache) and repeated warnings.
2019-12-28 13:04:54 +01:00
Chris Hunt b6e007c6a8 Remove redundant src_dir normalization 2019-12-12 21:46:04 +08:00
Pradyun Gedam 1405a403fe
Merge branch 'master' into add-use-user-site-to-preparer 2019-11-11 08:40:20 +05:30
Pradyun Gedam c9606b86e1
Add use_user_site to RequirementPreparer 2019-11-10 13:51:29 +05:30
Pradyun Gedam c40a9d332d
Update callsites for RequirementTracker 2019-11-10 12:33:25 +05:30
Chris Hunt deac2343dc Don't pass PackageFinder to Preparer from Resolver
Preparer's overall responsibilities align more with having its own
reference to finder, which will help us remove it from resolver later.
2019-11-05 20:57:14 -05:00
Chris Hunt f305f66eb2 Trace common finder info outside resolver
There's no reason for Resolver to trace this information about our
PackageFinder, we just need a common one-time function to trace useful
information.
2019-11-05 20:57:14 -05:00
Chris Hunt 3076c39f25 Remove unused Resolver.session 2019-11-03 14:31:38 -05:00
Chris Hunt 44cc3aeb0a Use session from RequirePreparer, not Resolver 2019-11-03 14:26:47 -05:00
Chris Hunt b8fb97a815 Remove unused RequirementSet.require_hashes 2019-10-13 13:19:49 -04:00
Maxim Kurnikov 3692097cca add per-file disallow_untyped_defs=False, and set it to True globally 2019-09-29 23:31:15 +02:00
Chris Hunt 81d8005bd1 Change argument name to better reflect purpose.
Also assert on provided path, since it should have been created in all
cases.
2019-09-11 19:03:57 -04:00
Chris Hunt 82be4ee76a Use application context manager for PipSession.
This removes a level of indentation from all commands without
introducing any dummy functions.
2019-09-07 09:46:48 -04:00
A_Rog 70027b2f50 Address #6876: Make command output go through a single function (#6881) 2019-08-22 17:29:22 -07:00
Chris Jerdonek 23446f6d0e Remove the unneeded name argument from populate_requirement_set(). 2019-08-08 17:29:02 -07:00
Chris Jerdonek da9ebed9df Move RequirementCommand to req_command.py. 2019-08-04 02:05:33 -07:00
Prabakaran Kumaresshan b562531cc5 Add make_resolver() to RequirementCommand base class (#6826). 2019-08-03 23:47:50 -07:00
Prabakaran Kumaresshan 82dbcdae87 Add make_requirement_preparer() to RequirementCommand base class (#6810) 2019-08-01 20:29:44 -07:00
Chris Jerdonek 1f09e67f34 Only import a Command class when it is actually needed.
This resulted in an approximate 24% speed-up of a vanilla `pip`
invocation on one system (0.477 secs before, 0.363 secs after).
2019-07-26 23:30:26 -04:00
Chris Jerdonek db213c04d7 Add add_target_python_options() and make_target_python(). 2019-06-23 09:28:54 -07:00
Chris Jerdonek 8dbf88dff7 Update pip-download to respect --python-version. 2019-06-06 13:20:29 -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
Pradyun Gedam b05c66722e
Move Resolver to a legacy_resolve module 2019-05-25 12:35:31 -04:00
Paul Moore 9d2b17854d Add --[no-]use-pep517 command line flag 2018-10-29 23:33:21 +01:00
Loren Carvalho cddcb1407f Open up plat/abi/impl options to `install --target`
* Move dist restriction options to be re-usable (between install/download)
* Make dist restriction options usable in `install` (exclusively with --target)
* Add a check_supported_wheels bool to RequiriementSet for non-resolved (full path) dependencies
2018-08-05 16:13:20 -05:00