File tree 3 files changed +25
-3
lines changed
3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change
1
+ Add support to install a PEP 508 URL-specified requirement as editable.
Original file line number Diff line number Diff line change @@ -71,11 +71,24 @@ def parse_editable(editable_req):
71
71
- a requirement name
72
72
- an URL
73
73
- extras
74
- - editable options
75
74
Accepted requirements:
76
- svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
77
- .[some_extra]
75
+ - svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
76
+ - local_path[some_extra]
77
+ - Foobar[extra] @ svn+http://blahblah@rev#subdirectory=subdir ; markers
78
78
"""
79
+ try :
80
+ req = Requirement (editable_req )
81
+ except InvalidRequirement :
82
+ pass
83
+ else :
84
+ if req .url :
85
+ # Join the marker back into the name part. This will be parsed out
86
+ # later into a Requirement again.
87
+ if req .marker :
88
+ name = f"{ req .name } ; { req .marker } "
89
+ else :
90
+ name = req .name
91
+ return (name , req .url , req .extras )
79
92
80
93
url = editable_req
81
94
Original file line number Diff line number Diff line change @@ -606,6 +606,14 @@ def test_parse_editable_vcs_extras():
606
606
)
607
607
608
608
609
+ def test_parse_editable_pep508 ():
610
+ assert parse_editable ('foo[extra] @ svn+http://foo ; os_name == "nt"' ) == (
611
+ 'foo ; os_name == "nt"' ,
612
+ 'svn+http://foo' ,
613
+ {'extra' },
614
+ )
615
+
616
+
609
617
@patch ('pip._internal.req.req_install.os.path.abspath' )
610
618
@patch ('pip._internal.req.req_install.os.path.exists' )
611
619
@patch ('pip._internal.req.req_install.os.path.isdir' )
You can’t perform that action at this time.
0 commit comments