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

2165 commits

Author SHA1 Message Date
Pradyun Gedam 025e99ec61
Merge pull request #7719 from uranusjr/virtualenv-20-detection
Swap venv and virtualenv checks
2020-02-12 12:16:43 +05:30
Paul Moore 73d472bb87 Merge branch 'master' into refactor_legacy_install 2020-02-11 16:53:01 +00:00
Tzu-ping Chung 6104060580 Swap venv and virtualenv checks
Environments created by pypa/virtualenv >=20 can pass both real_prefix
and base_prefix checks, but are only able to use the pyvenv.cfg values,
not the legacy `no-global-site-packages.txt`. So we need to check for
venv (PEP 405) first.
2020-02-11 17:56:40 +08:00
Paul Moore 9f87f46ac3 Tidy up exception block 2020-02-10 18:50:58 +00:00
Pradyun Gedam 313740f6ee
Merge pull request #7593 from uranusjr/hg-under-git
Detect all registered VCS and choose inner-most
2020-02-08 17:34:31 +05:30
Tzu-ping Chung 8b0146b748
Use double backtick in comments
Co-Authored-By: Christopher Hunt <chrahunt@gmail.com>
2020-02-08 17:53:58 +08: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 6f154f5546
Merge pull request #7707 from pfmoore/refactor_options
Pass individual options to InstallRequirement rather than an options object
2020-02-07 14:22:10 +00:00
Xavier Fernandez 8b20443224
Merge pull request #7704 from chrahunt/refactor/simpler-resolver-interface
Reduce usage of RequirementSet in commands
2020-02-06 23:19:19 +01: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
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
Paul Moore 0dd1c72715 Fix handling of rollback on failure 2020-02-06 11:40:37 +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 e872d2bfb6 Make new RequirementSet in populate_requirement_set
Concentrates use of RequirementSet in individual commands so we can
eventually break it up.
2020-02-05 22:30:07 -05:00
Chris Hunt 9c58aa7eb5 Do not use InstallRequirement in warn_deprecated_install_options
This only needed a list of requirements, so give it just that.
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 a814dc9f1f Centralize logic for getting 'all requirements' 2020-02-05 22:29:48 -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 441b211048 Remove old comment from Resolver.resolve
This was moved to RequirementCommand.populate_requirement_set, so it's
no longer applicable in this context.
2020-02-05 21:08:58 -05:00
Chris Hunt 85ab574dc1 Remove unused RequirementSet.reqs_to_cleanup 2020-02-05 20:16:05 -05:00
Chris Hunt 4a93045be1 Remove no-op RequirementSet.cleanup_files 2020-02-05 20:16:05 -05: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
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
Xavier Fernandez 19665791fa
Merge pull request #7694 from chrahunt/refactor/move-up-file-unpacking
Move file unpacking out of lower level functions in operations.prepare
2020-02-05 23:08:25 +01:00
Paul Moore 87217fbf2e Refactor legacy_install to not take an install_req 2020-02-05 16:07:45 +00:00
Chris Hunt 0410535ef2 Remove unused WheelCache.cleanup 2020-02-04 23:11:27 -05:00
Chris Hunt 77e9b79d0e Remove no-op calls to WheelCache.cleanup 2020-02-04 23:11:27 -05:00
Chris Hunt eead579049 Remove no-op calls to WheelCache.cleanup 2020-02-04 23:11:27 -05:00
Chris Hunt 34df623016 Globally manage EphemWheelCache temp directory 2020-02-04 23:11:25 -05:00
Chris Hunt 63743fcc30 Make ephem-wheel-cache tempdir name globally accessible 2020-02-04 23:01:24 -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
Chris Hunt 791725aad9 Move directory handling from unpack_file_url to unpack_url 2020-02-04 21:49:42 -05:00
Chris Hunt 395787bebc Inline link.file_path in unpack_file_url 2020-02-04 21:49:42 -05:00
Chris Hunt 062ccf9dba Use early-return style in unpack_url
This will make it easier to move directory handling up to unpack_url.
2020-02-04 21:49:42 -05:00
Chris Hunt e800cb1604 Make BuildEnvironment._temp_dir a local variable 2020-02-04 20:32:58 -05:00
Chris Hunt d99462a067 Remove unused BuildEnvironment.cleanup 2020-02-04 20:32:29 -05:00
Chris Hunt 39d1c51fdb Globally-manage BuildEnvironment._temp_dir 2020-02-04 20:32:27 -05:00
Chris Hunt bdde27bfd8 Add BuildEnvironment._temp_dir to tempdir registry
Similar to the InstallRequirement temp build dir, now we'll be able to
refactor this to be globally managed.
2020-02-04 20:31:34 -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
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
Christoph Reiter 9be7454fd6 fix un-vendored support; add missing entry for appdirs
pip has started to use the vendored appdirs directly since #7501
but didn't add an alias for the unbundled case.

This adds the missing alias.
2020-02-04 10:49:40 +01:00
Christian Clauss f58ec8365b
NEWS.rst: Fix typos discovered by codespell (#7642)
https://github.com/codespell-project/codespell
2020-02-03 01:14:08 +08:00
Pradyun Gedam e060970d51
Merge pull request #7675 from deepak1725/string-format2
Updated string_formatting to .format
2020-02-02 02:05:34 +05:30
Deepak Sharma 61e1721b80 msg formatting updated 2020-01-30 21:57:31 +05:30
Deepak Sharma d31cf696e8 string_formatting 2020-01-30 20:33:00 +05:30
Chris Hunt f2af7df453 Use tempdir_registry to control auto-deleted files globally
Next we can actually transition some files to be globally-managed that
are only deleted conditionally.
2020-01-29 23:04:26 -05:00
Chris Hunt 45991bcc1e Use explicit default value for TempDirectory delete flag
Now we can opt-in to globally-managed + globally-configured file
deletion for pre-existing directories by passing an explicit `None`.
2020-01-29 23:04:14 -05:00
Christopher Hunt b6ecc3917e
Merge pull request #7653 from chrahunt/refactor/remove-unnecessary-marker-file
Remove unnecessary write_delete_marker_file
2020-01-29 08:59:23 +08:00
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
Christopher Hunt 153e22ae34
Merge pull request #7614 from deepak1725/string-formatting
Updated string formatting
2020-01-26 02:40:40 +08:00
Pradyun Gedam a4fac3f882
Bump for development 2020-01-24 20:17:38 +05:30
Pradyun Gedam 931749f871
Bump for release 2020-01-24 20:17:34 +05:30
Pradyun Gedam 78a77229b4
Upgrade packaging to 20.1 2020-01-24 16:37:38 +05:30
Deepak Sharma b242c3979a String formatting updated 2020-01-23 18:09:59 +05:30
Christopher Hunt f1cd4cb48e
Merge pull request #7608 from uranusjr/global-cleanup
Delay TempDirectory.delete resolution to cleanup
2020-01-22 18:25:05 +08:00
Pradyun Gedam b47903e5bb
Merge pull request #7621 from pradyunsg/hotfix/importerrors-in-distributions
Rename pip._internal.distributions.{source -> sdist}
2020-01-21 18:09:30 +05:30
Pradyun Gedam 8f3687cfd9
Rename pip._internal.distributions.{source -> sdist}
Certain environments seem to be leaving behind empty folders in this
directory -- There was an older pip release that included a source/
folder here which isn't getting deleted for some reason. I have not
figured out the root cause why this happens yet. This is resulting in
ImportErrors since Python imports have a higher precedence for packages
compared to modules.

This commit changes the name we're trying to import from, which should
help prevent this mode of failure.
2020-01-21 17:53:24 +05:30
Pradyun Gedam d9a315eaf6
Bump for development 2020-01-21 16:15:22 +05:30
Pradyun Gedam 8ad871a6bb
Bump for release 2020-01-21 16:15:21 +05:30
Pradyun Gedam 7b2f0aa00d
Upgrade pkg_resources (via setuptools) to 44.0.0 2020-01-21 13:51:30 +05:30
Pradyun Gedam 947fceb0f9
Upgrade six to 1.14.0 2020-01-21 13:42:05 +05:30
Pradyun Gedam 501e00cec4
Upgrade urllib3 to 1.25.7 2020-01-21 13:37:47 +05:30
Pradyun Gedam 022f0e265b
Upgrade certifi to 2019.11.28 2020-01-21 13:37:42 +05:30
Pradyun Gedam 7770dc204e
Upgrade pyparsing to 2.4.6 2020-01-21 13:16:34 +05:30
Pradyun Gedam 9bce54e54a
Upgrade ipaddress to 1.0.23 2020-01-21 13:13:27 +05:30
Pradyun Gedam dd07badf20
Upgrade distlib to 0.3.0 2020-01-21 13:11:38 +05:30
Pradyun Gedam 744d0ebbd4
Upgrade colorama to 0.4.3 2020-01-21 13:10:01 +05:30
Pradyun Gedam ac42c232ce
Update CacheControl to 0.12.6 2020-01-21 12:48:59 +05:30
Stéphane Bidoul (ACSONE) 0e1e0ef566 _should_cache does not depend on check_binary_allowed
_should_cache is only called by _get_cache_dir.

In pip install mode, _get_cache_dir is never called when
check_binary_allowed returns False because in that case
should_build_for_install_command has returned False before
and the build was skipped.

In pip wheel mode, check_binary_allowed always returns True
(because it is not passed to the build function).

So _should_cache can use _always_true for check_binary_allowed.

*Alternative*

Alternatively, we could have passed check_binary_allowed
to build in pip wheel mode. The only difference is that wheels built
locally from *legacy* packages would then not be cached,
when pip wheel is used with --no-binary.
2020-01-20 10:41:48 +01:00
Pradyun Gedam f1cf84e2f8
Merge pull request #7542 from sbidoul/normalize-cache-dir-sbi
Eagerly normalize cache directory
2020-01-18 22:38:59 +05:30
Tzu-ping Chung ffa6d9d3d0 Delay TempDirectory.delete resolution to cleanup 2020-01-17 21:06:13 +08:00
Tzu-ping Chung 6e2e74ac29 Normalize path returned by VCS on return 2020-01-15 16:37:05 +08:00
Tzu-ping Chung 9d1e1ed8ae Whitespace 2020-01-15 16:26:58 +08:00
Tzu-ping Chung 62ffc7b165 Clarify why the max(key=len) logic works 2020-01-14 22:19:33 +08:00
Tzu-ping Chung 85654a9eb8 Minor code formatting and logging 2020-01-14 18:08:00 +08:00
Tzu-ping Chung e0781159c6 Strip the repo root output 2020-01-14 16:40:48 +08:00
Tzu-ping Chung 5fb0957219 Add required type hints 2020-01-14 16:24:45 +08:00
Tzu-ping Chung cdd7821d92 Fix incorrect quoting Link.url
Cherry-picked manually from atugushev:fix-issue-6446.

Co-Authored-By: Albert Tugushev <albert@tugushev.ru>
2020-01-14 16:12:11 +08:00
Tzu-ping Chung 2d3e8f72e6 Detect all registered VCS and choose inner-most 2020-01-14 00:30:27 +08:00
Chris Hunt 0a57e4e9f2 Manage temp directory deletion centrally
This gives us a global toggle that we can use to control whether
temporary directories get deleted from one place (ideally, in the
commands taking --no-clean).
2020-01-10 11:08:05 +01: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