Skip to content

Commit bd377b2

Browse files
committed
Factor path inspection into separate function.
1 parent fa99d70 commit bd377b2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/pip/_internal/req/constructors.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ def convert_extras(extras):
8282
return set()
8383

8484

85+
def looks_like_path(text):
86+
# type: (str) -> bool
87+
return (
88+
os.path.sep in text or
89+
os.path.altsep is not None and os.path.altsep in text or
90+
text.startswith('.')
91+
)
92+
93+
8594
def parse_editable(editable_req):
8695
# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]
8796
"""Parses an editable requirement into:
@@ -263,11 +272,7 @@ def install_req_from_line(
263272
link = Link(name)
264273
else:
265274
p, extras_as_string = _strip_extras(path)
266-
looks_like_dir = os.path.isdir(p) and (
267-
os.path.sep in name or
268-
(os.path.altsep is not None and os.path.altsep in name) or
269-
name.startswith('.')
270-
)
275+
looks_like_dir = os.path.isdir(p) and looks_like_path(name)
271276
if looks_like_dir:
272277
if not is_installable_dir(p):
273278
raise InstallationError(

0 commit comments

Comments
 (0)