-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Environment
- pip version: 20.1.1
- Python version: all
- OS: all
Description
In pip._internal.operations.prepare
, the method prepare_linked_requirement
checks for a previous build directory by looking for setup.py
. This check is setuptools-specific, and won't work for general PEP 517 backends.
As a result of various refactorings, this code is only called when --build
is specified. In all other cases, we use a temporary build directory.
Expected behavior
In practice, it's not clear that there is any benefit in trying to use the build directory here. We should drop this check and just use a temporary directory, so there's no chance of a clash.
Additional discussion occurred in #8283, here and here in particular.
Update
The --build-directory
option is now removed. This means that the only place where pip still uses a TemporaryDirectory
with an explicit pre-defined path is in support of editable installs, which are setuptools-specific. So checking for setup.py
is acceptable in that context.
Someone may wish to consider how we handle of the --src
option at some point. This is what leads to TemporaryDirectory
needing a path
argument, and ultimately to this check, and it may be possible to refactor that code path to avoid using the TemporaryDirectory
class for something which definitely isn't temporary...
When editable support is standardised, pip will need to implement the new standard. At that point, all of the code relating to editable installs will be reviewed, and this check (and the use of TemporaryDirectory
) can be cleaned up then, if it still remains.