File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -59,24 +59,30 @@ def index_sources(line):
5959 ).strip ()
6060
6161 # Extract URL if present
62- url = ""
63- filename = ""
6462 if "@" in head :
6563 requirement = requirement_line
6664 # Extract URL from direct URL format
67- url = requirement .split ("@" )[1 ]. split ( "# " )[0 ].strip ()
65+ url = requirement .partition ("@" )[2 ]. strip (). partition ( " " )[0 ].strip ()
6866 # Extract filename from URL
6967 if url :
7068 filename = url .rpartition ("/" )[2 ]
7169 if not filename :
7270 filename = url .rpartition ("/" )[0 ].rpartition ("/" )[2 ]
7371
72+ return struct (
73+ requirement = requirement ,
74+ requirement_line = requirement_line ,
75+ version = version ,
76+ shas = sorted (shas ),
77+ marker = marker ,
78+ url = url ,
79+ filename = filename ,
80+ )
81+
7482 return struct (
7583 requirement = requirement ,
7684 requirement_line = requirement_line ,
7785 version = version ,
7886 shas = sorted (shas ),
7987 marker = marker ,
80- url = url ,
81- filename = filename ,
8288 )
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ def _test_no_simple_api_sources(env):
2424 "foo==0.0.1" : struct (
2525 requirement = "foo==0.0.1" ,
2626 marker = "" ,
27- url = "" ,
28- filename = "" ,
2927 ),
3028 "foo==0.0.1 @ https://someurl.org" : struct (
3129 requirement = "foo==0.0.1 @ https://someurl.org" ,
@@ -61,8 +59,10 @@ def _test_no_simple_api_sources(env):
6159 env .expect .that_str (got .requirement ).equals (want .requirement )
6260 env .expect .that_str (got .requirement_line ).equals (got .requirement )
6361 env .expect .that_str (got .marker ).equals (want .marker )
64- env .expect .that_str (got .url ).equals (want .url )
65- env .expect .that_str (got .filename ).equals (want .filename )
62+ if hasattr (want , "url" ):
63+ env .expect .that_str (got .url ).equals (want .url )
64+ if hasattr (want , "filename" ):
65+ env .expect .that_str (got .filename ).equals (want .filename )
6666
6767_tests .append (_test_no_simple_api_sources )
6868
You can’t perform that action at this time.
0 commit comments