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

8814 commits

Author SHA1 Message Date
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
Chris Hunt c565d7a1b2 Switch to install_wheel in unit tests
Since it tests install_unpacked_wheel, the coverage should be the same.
2019-12-14 11:38:31 -05:00
Chris Hunt 3f912ad48e Add function to install directly from wheel files
This will help us avoid some complicated directory-changing logic in
WheelBuilder.
2019-12-14 11:38:31 -05:00
Christopher Hunt fedde5fa2c
Do not cleanup archive download tempdir immediately (#7479)
* Do not cleanup download tempdir immediately

The previous logic forced us to handle populating the download directory
in this function right next to the download and hash checking. By
extending the lifetime of the directory we can more easily separate the
code.

This also allows for additional optimizations later: by using metadata
from wheels directly instead of unpacking them, we can avoid extracting
wheels unnecessarily. Unpacked files can be easily 3x larger than the
archives themselves, so this should reduce disk utilization and general
IO significantly.
2019-12-14 23:19:25 +08:00
Stéphane Bidoul (ACSONE) 510970968f
Remove unused WheelBuilder attribute
Remnant of a reverted feature.
2019-12-14 12:47:23 +01:00
Stéphane Bidoul (ACSONE) c0d05dc6a3
Make _collect_buildset a standalone function 2019-12-14 12:47:23 +01:00
Stéphane Bidoul (ACSONE) b9faa61c8f
Remove incorrect os.path.join in WheelBuilder
The join is done in _build_one_inside_env.
The bug as undetected because the cache directory is absolute most of
the time.
2019-12-14 12:47:23 +01:00
Stéphane Bidoul (ACSONE) 32cabbf716
Add test for pip wheel with non-absolute cache dir 2019-12-14 12:47:14 +01:00
Chris Hunt 9faa9aef29 Make download_http_url existing bad file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt d3920f299f Make unpack_file_url existing bad file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt fe24c7fc16 Make unpack_file_url existing matching file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt d30f406c37 Check file actually used against hashes
This makes the behavior of this function easier to test, since we can
use a different file to distinguish the already-downloaded case from the
existing-file-hash-failed case.
2019-12-13 20:30:45 -05:00
Chris Hunt 30c2d979b0 Make unpack_file_url download test to functional
This and the next several changes will uncouple the tests from the
current implementation, allowing us to factor the actual file download
out of `unpack_file_url` and `unpack_http_url`.
2019-12-13 20:30:45 -05:00
Chris Hunt 50efb55072 Add tests.lib.path.Path.read_bytes
To be used in some upcoming tests.
2019-12-13 20:30:45 -05:00
Stéphane Bidoul (ACSONE) 98f6ff8661
Rename output_dir to cache_dir in WheelBuilder for clarity 2019-12-13 22:01:54 +01:00
Stéphane Bidoul (ACSONE) 9e737fe511
Extract buildset collection from WheelBuilder.build
Towards splitting the build method in two
for pip wheel and pip install cases.
2019-12-13 21:42:06 +01:00
Pradyun Gedam b9bdad23bc
Do not depend on cached download for copying downloaded file (#7474) 2019-12-13 10:19:56 +00:00
Pradyun Gedam b44c217aa9
Remove disallow_untyped_defs=False for some modules (#7475) 2019-12-13 10:02:50 +00:00
Maxim Kurnikov 3cb30385d8 remove disallow_untyped_defs=False for more modules 2019-12-13 10:22:21 +03:00
Maxim Kurnikov 58e2a99ccf remove disallow_untyped_defs=False for most of pip._internal.cli modules 2019-12-13 09:58:52 +03:00
Chris Hunt 7dea92e5b3 Replace already_downloaded_path with existence check
These statements are equivalent, so we exchange them. This will make it
easier to factor the download_dir concerns out of these functions.
2019-12-13 00:46:44 -05:00
Pradyun Gedam 8e7a87bf4b
Factor out pep517 wheel build function (#7473) 2019-12-13 04:26:44 +00:00
Chris Hunt 6b0a79501c Assert that target file does not exist
_check_download_dir will only return a falsy value if either:

* the provided path does not exist
* the hash does not match - in which case the file is unlinked

so the file cannot exist at either of these points.
2019-12-12 21:18:03 -05:00
Christopher Hunt d7eaede434
Revert "Add new option: pip wheel --save-wheel-names (#6377)" (#7420)
This reverts commit bcad1b1cb5, reversing
changes made to f86490317a.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
2019-12-13 07:57:05 +08:00
Stéphane Bidoul (ACSONE) 339e061e6b
Don't pass req to _build_wheel_pep517 2019-12-12 23:46:05 +01:00
Stéphane Bidoul (ACSONE) 2eff06e7cc
Make WheelBuilder should_unpack argument explicit 2019-12-12 23:46:05 +01:00
Stéphane Bidoul (ACSONE) deb322d7b7
Move pep517 wheel build method to standalone function 2019-12-12 23:45:45 +01: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
Chris Hunt fe320a3da0 Remove redundant build_dir normalization 2019-12-12 21:46:04 +08:00
Chris Hunt 95c3f632e3 Handle build dir normalization in cmdoptions
Technically this changes behavior in DownloadCommand, which does not
make build_dir absolute, but given that it is used the same way as in
InstallCommand and WheelCommand (which do make it absolute), it should
not have any visible impact.
2019-12-12 21:46:04 +08:00
Chris Hunt b6e007c6a8 Remove redundant src_dir normalization 2019-12-12 21:46:04 +08:00
Chris Hunt a046c4f0c3 Handle making --src-dir absolute at option declaration
This will let us reduce duplication of this option normalization in a
few of our commands.
2019-12-12 21:46:04 +08:00
Pradyun Gedam ce5edd4841
Better workaround for cache poisoning (#3025, #7319) 2019-12-12 11:28:57 +00:00
Paul Moore 8eb3bdbd69
Merge pull request #7471 from pfmoore/runpy_comment
Add a comment showing how to call main using runpy
2019-12-12 11:22:27 +00:00
Paul Moore 241a3cb6f2 Update wording based on review comments 2019-12-12 10:50:58 +00:00
Maxim Kurnikov 38fd95aa6a update to mypy==0.750 2019-12-12 11:08:36 +01:00
Paul Moore 80836a4cae Remove non-ASCII character in comment 2019-12-12 09:31:13 +00:00
Paul Moore 8b87f8728a Add a comment showing how to call main using runpy 2019-12-12 09:10:51 +00:00
Remi Rampin 04d8841ace Update links in docs 2019-12-11 22:23:34 +01:00
toonarmycaptain 17075cc17f Update README.rst correcting grammar.
`there is several` should be `there are several`
2019-12-11 09:26:54 +08:00
Chris Hunt 355c303e12 Lazy evaluate has_tls result
This avoids an unnecessary unconditional import of ssl and urllib3 in
compat.
2019-12-09 20:48:58 +08:00
Chris Hunt f4e40d7a09 Wrap HAS_TLS in a function
Next we'll refactor the value to be computed lazily.
2019-12-09 20:48:58 +08:00
Chris Hunt 6343e8093f Replace atexit with globally-managed tempdir 2019-12-09 06:06:37 +08:00
Chris Hunt d6b509d7c6 Set up global tempdir manager in BaseCommand
This ensures that the resource is available for the lifetime of the
program.
2019-12-09 06:06:37 +08:00
Chris Hunt 0457826bd0 Add global TempDirectory manager
In cases where there is not a clear scope, or where enforcing a scope
and passing a temp directory to callees creates unnecessary coupling
between components, this will let us tie the lifetime of temporary
directories to the lifetime of the application without using e.g.
atexit or finalizers.

This has the benefit of being easier to test and reason about.
2019-12-09 06:06:37 +08:00
Chris Hunt cf743dd245 Remove unnecessary unlink in unpack_http_url
The file is downloaded into a TempDirectory which will get cleaned up at
the end of the `with` block, so no need to explicitly unlink the file.
2019-12-08 22:33:51 +01:00
Christopher Hunt 2013753525
Read record file once during legacy install (#7452) 2019-12-09 04:55:51 +08:00
Pradyun Gedam a1b0b9274f
Update warning tense: the next pip will be released after Pytho… (#7448) 2019-12-07 17:33:24 +00:00
Pradyun Gedam edb59e12e9
Added a note about # noqa comments in the Getting Started Guide (#7446) 2019-12-07 17:29:53 +00:00