Assert req.source_dir is None during linked requirement preparation

req.source_dir is only set by:

1. `InstallRequirement.__init__`
2. `InstallRequirement.ensure_has_source_dir`

`InstallRequirement.__init__` is only called with source_dir for
editable requirements, for which we would not call
`RequirementPreparer.prepare_linked_requirement` (only
`prepare_editable_requirement`).

We will use this assertion for justifying later refactoring.
This commit is contained in:
Chris Hunt 2020-01-08 20:11:28 -05:00
parent fe3e892a93
commit 71e0ea19af
1 changed files with 2 additions and 0 deletions

View File

@ -420,6 +420,8 @@ class RequirementPreparer(object):
# editable in a req, a non deterministic error
# occurs when the script attempts to unpack the
# build directory
# Since source_dir is only set for editable requirements.
assert req.source_dir is None
req.ensure_has_source_dir(self.build_dir)
# If a checkout exists, it's unwise to keep going. version
# inconsistencies are logged later, but do not fail the