Skip to content

Check in prepare_linked_requirement for an existing directory used by --src is setuptools-specific #8333

@pfmoore

Description

@pfmoore

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: build logicStuff related to metadata generation / wheel generationtype: deprecationRelated to deprecation / removal.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions