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.
@@ -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
