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

345 commits

Author SHA1 Message Date
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
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 0b18e21cbe
Merge pull request #8752 from sbidoul/imp-8369-deprecation-sbi 2020-08-25 20:40:27 +05:30
Stéphane Bidoul 4c348cf3a0
Consider success flag instead of absence of exception 2020-08-13 09:38:56 +02:00
Stéphane Bidoul 9c4a88b0a0
Improve deprecation message for issue 8368 2020-08-12 11:07:36 +02: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
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
Tzu-ping Chung 1fd5098b24 Canonicalize name in check_if_exists
The previous implementation uses pkg_resources.get_distribution(), which
does not canonicalize the package name correctly, and fails when
combined with pip's own get_distribution(), which does canonicalize
names. This makes InstallRequirement.check_if_exists() only use pip's
own canonicalization logic so different package name forms are matched
as expected.
2020-07-30 22:04:51 +08:00
Devesh Kumar Singh ac624f1e4f Reword news entry 2020-07-06 13:42:09 +05:30
Devesh Kumar Singh 04fedfe53c Create custom get_distribution function 2020-07-06 13:42:05 +05:30
Devesh Kumar Singh 782913725f Canonicalize req name while doing pre-install package search 2020-07-06 13:32:09 +05:30
Pradyun Gedam 20431888cb
Move check_invalid_constraint_type to req_install.py 2020-07-04 18:01:28 +05:30
Pradyun Gedam fb68794188
Merge pull request #8026 from sbidoul/requested-sbi 2020-06-24 18:24:30 +05:30
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
Tzu-ping Chung 4ca684f3b8 Fix for source directory reuse 2020-06-04 00:32:57 +08:00
Stéphane Bidoul aa0c167498
Make sure user_supplied is propagated where needed 2020-05-31 18:33:51 +02:00
Stéphane Bidoul b9a19f6be0
Rename is_direct to user_supplied 2020-05-31 18:33:51 +02:00
Stéphane Bidoul c9a445762c
Mark top level requirements as REQUESTED 2020-05-31 18:33:51 +02:00
Stéphane Bidoul 58295d0df7
Remove InstallRequirement source_dir parameter
source_dir is only passed to the InstallRequirement constructor
in the case of editable requirements, and it is built from link,
which is also passed to the same constructor. So we let
InstallRequirement compute source_dir, to remove that burden
from call sites.
2020-04-12 11:39:09 +02:00
Pradyun Gedam 9cbe8fbdd0
Merge pull request #7978 from sbidoul/remove-pip-egg-info-sbi
Generate legacy metadata in temporary directory
2020-04-10 18:57:13 +05:30
Tzu-ping Chung d5e45bb59a Remove the version part from the dist-info stem 2020-04-09 20:28:28 +08:00
Stéphane Bidoul 030578ef04
Remove unused argument from generate_metadata 2020-04-07 17:01:08 +02:00
Stéphane Bidoul bf8e6bc785
Generate legacy metadata in temporary directory
Before it was generated in a pip-egg-info
subdirectory of the source dir. This will avoid
polluting source dir when we build in place.
2020-04-05 11:23:57 +02:00
Stéphane Bidoul a0ed759fb3
Add direct_url support to InstallRequirement
pass it to install_wheel via install
2020-04-01 22:57:00 +02:00
Tzu-ping Chung 6db0df928c Move wheel cache out of InstallRequirment 2020-03-30 17:36:03 +08:00
Pradyun Gedam 4f6bef6eb4
Merge pull request #7792 from pradyunsg/misc/utils-tags
Rename pep425tags -> utils.compatibility_tags
2020-03-12 14:46:52 +05:30
Jason R. Coombs 6282a307dc 👹 Feed the hobgoblins (delint). 2020-03-06 12:43:10 -05:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Pradyun Gedam 3fa356a772
Update references to pep425tags 2020-02-26 10:24:43 -08:00
Paul Moore 73d472bb87 Merge branch 'master' into refactor_legacy_install 2020-02-11 16:53:01 +00:00
Paul Moore 9f87f46ac3 Tidy up exception block 2020-02-10 18:50:58 +00:00
Paul Moore 89bf3b02db Record on the requirement whether it has been successfully downloaded 2020-02-07 16:40:27 +00:00
Paul Moore 1aa27c4595 Merge branch 'master' into refactor_legacy_install 2020-02-07 14:49:28 +00:00
Paul Moore a9f1d8562b Pass individual options to InstallRequirement rather than an options object 2020-02-06 16:05:11 +00:00
Paul Moore 98da0a680d Correctly preserve exception type 2020-02-06 13:48:36 +00:00
Paul Moore 0dd1c72715 Fix handling of rollback on failure 2020-02-06 11:40:37 +00:00
Chris Hunt 5cca8f10b3 Remove InstallRequirement.remove_temporary_source
Since all directories are now globally-managed, we don't need to be
concerned with resetting the member values.

This will also let us remove several responsibilities from
RequirementSet, which will make integrating the new resolver easier.
2020-02-05 20:14:44 -05:00
Chris Hunt efe663d476 Remove unused utils.marker_files 2020-02-05 20:14:44 -05:00
Chris Hunt e6cc9e9351 Do not remove source directory in cleanup_temporary_source
Since nothing in our code writes the delete marker file, this block will
never execute.
2020-02-05 20:14:44 -05:00
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 470c39990e Wrap InstallRequirement.ensure_build_location in TempDirectory
Since we explicitly disable deletion this is a no-op, but we'll
parameterize the deletion soon.
2020-02-05 20:14:44 -05:00
Paul Moore 87217fbf2e Refactor legacy_install to not take an install_req 2020-02-05 16:07:45 +00:00
Chris Hunt 39d1c51fdb Globally-manage BuildEnvironment._temp_dir 2020-02-04 20:32:27 -05:00
Chris Hunt c35cb7819b Globally-manage InstallRequirement._temp_build_dir
InstallRequirement.remove_temporary_source was already being called at
the end of processing (as part of RequirementSet.cleanup()), so this
doesn't change behavior - cleanup still happens right after the command
finishes.
2020-02-04 20:29:57 -05:00
Chris Hunt 2f4bfc3efc Add InstallRequirement._temp_build_dir to tempdir registry
Now we can refactor this to be globally managed, and it will have the
same behavior as it does currently (if there is any
PreviousBuildDirError it will not be cleaned up).
2020-02-04 20:29:26 -05:00
Deepak Sharma d31cf696e8 string_formatting 2020-01-30 20:33:00 +05:30
Chris Hunt d028af98e3 Remove unnecessary write_delete_marker_file
InstallRequirement only checks for a delete marker file in source_dir.
Since the result of ensure_build_location is set to source_dir (in
ensure_has_source_dir), and ensure_build_location returns a subdirectory
of the build_directory to which we write the delete marker file, then
this delete marker file is never used.
2020-01-25 18:09:24 -05:00
Chris Hunt 3fac3d74ac Inline _make_build_dir in InstallRequirement
This untested function was only used in one place. Inlining it makes it
easier to see the symmetry between the writing of the delete marker file
in `ensure_build_location` and checking for it in
`remove_temporary_source`.
2020-01-08 20:34:28 -05:00
Stéphane Bidoul (ACSONE) 9cbe7f90d6
Reference the git+git@ removal issue
in the deprecation message
2020-01-04 12:50:38 +01:00
Stéphane Bidoul (ACSONE) 8415011774
Clarify git+git@ replacements 2020-01-04 12:50:06 +01:00
Stéphane Bidoul (ACSONE) cf071dee55
Deprecate git+git@ form of VCS url 2020-01-02 19:20:29 +01:00
Pradyun Gedam b375580132
Move logic for legacy installs to dedicated module 2019-12-18 16:11:12 +05:30
Pradyun Gedam 2e41be817a
Clarify that editable_legacy does editable installs 2019-12-18 15:47:45 +05:30
Pradyun Gedam 75f7f06ca7
Move assertions to calling functions 2019-12-18 11:53:34 +05:30
Pradyun Gedam 350a5986c9
Expand the arguments for modern metadata generation 2019-12-16 17:26:17 +05:30
Pradyun Gedam 00bc7d1727
Expand the arguments for legacy metadata generation 2019-12-16 17:26:17 +05:30
Pradyun Gedam 17428d9eab
Add an InstallRequirement._generate_metadata method 2019-12-16 17:26:12 +05:30
Chris Hunt 11472e1b12 Switch to install_wheel in InstallRequirement
This removes one of usages of the overloaded `source_dir` member.

We know the local_file_path must be set at this point because it is set
in the only 3 places that wheels are added to InstallRequirement.
2019-12-14 12:15:33 -05:00
Chris Hunt 327c295554 Keep path to downloaded archive on InstallRequirement
Now we'll be able to transition other parts of the code to use
pre-existing archives directly instead of relying on unpacked sources.
2019-12-14 11:59:42 -05:00
Maxim Kurnikov b69560661b remove disallow_untyped_defs=False for pip._internal.distributions, pip._internal.operations.prepare 2019-12-12 21:35:37 +01:00
Christopher Hunt 2013753525
Read record file once during legacy install (#7452) 2019-12-09 04:55:51 +08:00
Xavier Fernandez 58435d1efe
Merge pull request #7434 from chrahunt/refactor/remove-conflicts-with-1
Replace InstallRequirement.conflicts_with with InstallRequirement.should_reinstall
2019-12-05 12:56:41 +01:00
Xavier Fernandez 9ccbfcefcc
Merge pull request #7433 from chrahunt/refactor/extract-editable-legacy
Extract InstallRequirement.install_editable into operations.install
2019-12-05 11:17:01 +01:00
Chris Hunt 65ac79571b Justify lack of encoding when reading record file 2019-12-05 10:32:37 +01:00
Chris Hunt 48ddd0b111 Inline InstallRequirement.move_wheel_files
This makes InstallRequirement simpler and will make it easier to
refactor InstallRequirement.install.
2019-12-05 10:17:49 +01:00
Chris Hunt ce42b132ba Remove unused member InstallRequirement.conflicts_with 2019-12-04 22:57:05 -05:00
Chris Hunt d098f27d3f Use should_reinstall flag instead of conflicts_with
A boolean flag is simpler to reason about than a complex type like
`conflicts_with`.

In all of these situations `conflicts_with` was being assigned a
non-None value and only being checked for truthyness, so a bool is
sufficient to capture the required usages.
2019-12-04 22:53:58 -05:00
Chris Hunt 331716a439 Don't use conflicts_with in logging
InstallRequirement.uninstall doesn't actually use conflicts_with, so
don't log it. Instead we output the requirement name so we still have
something that looks like a heading before indenting the log, and log
what we actually uninstall inside the function.

This will also enable us to get rid of conflicts_with.
2019-12-04 22:43:33 -05:00
Chris Hunt 83b2acf032 Move InstallRequirement.install_editable into operations.install
This makes InstallRequirement simpler and overall makes it easier to
track how the parts of InstallRequirement are being used for the phases
of package processing.
2019-12-04 22:23:33 -05:00
Chris Hunt a4fc8d0e7e Parameterize InstallRequirement.install_editable
This makes it easier to extract the function without keeping references
to InstallRequirement.
2019-12-04 22:03:10 -05:00
Pradyun Gedam 128a8b3b5a
Merge pull request #7425 from chrahunt/refactor/cleanup-check-if-exists
Remove unused return value from check_if_exists
2019-12-04 14:29:32 +00:00
Christopher Hunt b714904285
Update src/pip/_internal/req/req_install.py 2019-12-04 21:31:24 +08:00
Chris Hunt c718994c5d Move install_succeeded for editable installs
This aligns it with wheel installation and reinforces that it is the
very last thing that happens before we return (so we can potentially
refactor it out later).
2019-12-03 19:45:55 -05:00
Chris Hunt e3cd8922f2 Remove unused return value from check_if_exists
After refactoring InstallRequirement.uninstall to not call this
function, none of the remaining callers require the return value.
2019-12-03 18:54:22 -05:00
Christopher Hunt d3419a4b7e
Don't use check_if_exists in InstallRequirement.uninstall (#7422)
Previously InstallRequirement.uninstall was using
InstallRequirement.check_if_exists, which is a very overloaded
function with several callers that operate at different phases in
pip processing, not to mention that it mutates InstallRequirement itself.

Now we don't use that function for InstallRequirement.uninstall.

There should be no behavior change here.
2019-12-04 07:20:00 +08:00
Christopher Hunt 830e29e189
Move wheel to operations.install.wheel (#7421)
* Update documentation

For now just fixing the paths and adding a sub-package docstring.
2019-12-04 06:02:39 +08:00
Chris Hunt ca43dac401 Move wheel version check to install_unpacked_wheel
This helps in several ways:

1. makes it easier to test the correct behavior of wheel installation via
   `install_unpacked_wheel` independent of `InstallRequirement`
2. is easier to understand, since `install_unpacked_wheel` itself should
   know which Wheel version(s) it supports
3. reduces the scope of `check_compatibility` and `wheel_version`, which
   will make it easier to move `wheel` to `operations.install.wheel`
2019-12-03 06:53:02 +08:00
Christopher Hunt e13c1f1e8f
Minimize scope of try block (#7415)
This more clearly separates the flow control in the function, which will
make refactoring easier.
2019-12-01 05:39:57 +08:00
Chris Hunt dbd80ec2c0 Remove unused code related to moving build directory 2019-11-26 18:47:12 -05:00
Chris Hunt 99c7598eb9 Remove dead code from move_to_correct_build_directory 2019-11-26 18:41:25 -05:00
Chris Hunt 9886e8dea1 Assert that we aren't using most of "move_to_correct_build_directory"
Since self._ideal_build_dir is only either None or a string, we must
have always been returning from this function.

This goes back to pip 10.0.0, so this code has been dead for some time.
2019-11-26 18:39:19 -05:00
Thomas Kluyver dd7b1ee5c3 Fix building packages with backend-path in pyproject.toml
Closes gh-6599
2019-11-23 14:38:27 +00:00
Christopher Hunt 1b4c0866ab
Remove untyped defs (#7382) 2019-11-19 11:46:26 +08:00
Chris Hunt 19397d0d2e Prefer six.ensure_str over our own version 2019-11-10 18:05:10 -05:00
Christopher Hunt c21fd4a70c
Merge pull request #7305 from chrahunt/maint/deprecate-non-egg-info-legacy-builds
Deprecate setup.py-based builds that do not make .egg-info
2019-11-09 09:58:43 +08:00
Chris Hunt 89f6e4fcd5 Deprecate setup.py-based builds that do not make .egg-info 2019-11-07 18:31:04 -05:00
Chris Hunt 6fa64a6b28 Calculate header directories in one place
This was already happening in locations.distutils_scheme, we're just
reusing the existing work instead of doing it again.
2019-11-07 12:43:39 -05:00
Chris Hunt e03a71aff8 Use new Scheme model for wheel installation 2019-11-07 12:43:39 -05:00
Chris Hunt 9de8a6d598 Create scheme unconditionally on install 2019-11-07 12:43:39 -05:00
Christopher Hunt 8341f87046
Merge pull request #7287 from pradyunsg/refactor/simplify-metadata-generation-flow
Simplify metadata generation flow, to be a lot more "linear"
2019-11-06 11:51:49 +08:00
Chris Hunt 431727a4e4 Set home in setuptools args functions 2019-11-04 19:48:24 -05:00
Chris Hunt b28d05bb50 Set user and prefix in setuptools args functions
Previously we were adding arguments to install_options in response to
command-line parameters, which leads to spooky action at a distance.
Now we provide the arguments explicitly.
2019-11-04 19:40:00 -05:00
Chris Hunt 3ed3f41c3e Make InstallRequirement.install_editable arguments mandatory 2019-11-04 19:34:40 -05:00
Pradyun Gedam f137aef12e
Choose metadata generator in prepare_metadata 2019-11-04 21:16:14 +05:30
Pradyun Gedam 528d27a2fe
Nicer comments in prepare_distribution_metadata 2019-11-04 14:30:21 +05:30
Pradyun Gedam 67ae8fdc28
Move call to assert_source_matches_version 2019-11-04 14:30:20 +05:30
Pradyun Gedam 33ccea2e0c
Reduce operations.build.metadata's API to 1 function
Why: There isn't any state being maintained, or multiple uses of the
metadata generator for a single requirement. The additional complexity
does not help in any significant manner.
2019-11-04 14:30:15 +05:30
Pradyun Gedam 3cb4bdd5e9
Move generate metadata into operations.build.metadata (#7283) 2019-11-03 10:11:35 +05:30
Pradyun Gedam 7256207df7
Move _clean_zip_name into a nested function
Why: Better models how it's used
2019-11-02 20:55:52 +05:30