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.
* 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.
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.
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`.
_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.
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.
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.
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.