Add guard clause.
@@ -173,7 +173,10 @@ class FrozenRequirement(object):
"""
location = os.path.normcase(os.path.abspath(dist.location))
from pip._internal.vcs import vcs, get_src_requirement
- if dist_is_editable(dist) and vcs.get_backend_name(location):
+ if not dist_is_editable(dist) or not vcs.get_backend_name(location):
+ req = dist.as_requirement()
+ return (req, False, [])
+
try:
req = get_src_requirement(dist, location)
except InstallationError as exc:
@@ -193,10 +196,6 @@ class FrozenRequirement(object):
return (req, False, comments)
- req = dist.as_requirement()
-
- return (req, False, [])
-
@classmethod
def from_dist(cls, dist, dependency_links):
args = cls._init_args_from_dist(dist, dependency_links)
