File tree Expand file tree Collapse file tree 3 files changed +37
-8
lines changed
uv-distribution-types/src Expand file tree Collapse file tree 3 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -243,8 +243,12 @@ impl<'a> FlatIndexClient<'a> {
243
243
path : & Path ,
244
244
flat_index : & IndexUrl ,
245
245
) -> Result < FlatIndexEntries , FindLinksDirectoryError > {
246
+ // The path context is provided by the caller.
247
+ #[ allow( clippy:: disallowed_methods) ]
248
+ let entries = std:: fs:: read_dir ( path) ?;
249
+
246
250
let mut dists = Vec :: new ( ) ;
247
- for entry in fs_err :: read_dir ( path ) ? {
251
+ for entry in entries {
248
252
let entry = entry?;
249
253
let metadata = entry. metadata ( ) ?;
250
254
Original file line number Diff line number Diff line change 1
- use itertools:: Either ;
2
- use rustc_hash:: { FxHashMap , FxHashSet } ;
3
1
use std:: borrow:: Cow ;
4
2
use std:: fmt:: { Display , Formatter } ;
5
3
use std:: ops:: Deref ;
6
- use std:: path:: Path ;
7
4
use std:: str:: FromStr ;
8
5
use std:: sync:: { Arc , LazyLock , RwLock } ;
6
+
7
+ use itertools:: Either ;
8
+ use rustc_hash:: { FxHashMap , FxHashSet } ;
9
9
use thiserror:: Error ;
10
10
use url:: { ParseError , Url } ;
11
11
12
- use uv_pep508:: { VerbatimUrl , VerbatimUrlError } ;
12
+ use uv_pep508:: { split_scheme , VerbatimUrl , VerbatimUrlError } ;
13
13
14
14
use crate :: { Index , Verbatim } ;
15
15
@@ -114,10 +114,10 @@ impl FromStr for IndexUrl {
114
114
type Err = IndexUrlError ;
115
115
116
116
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
117
- let url = if Path :: new ( s) . exists ( ) {
118
- VerbatimUrl :: from_absolute_path ( std:: path:: absolute ( s) ?) ?
119
- } else {
117
+ let url = if split_scheme ( s) . is_some ( ) {
120
118
VerbatimUrl :: parse_url ( s) ?
119
+ } else {
120
+ VerbatimUrl :: from_absolute_path ( std:: path:: absolute ( s) ?) ?
121
121
} ;
122
122
Ok ( Self :: from ( url. with_given ( s) ) )
123
123
}
Original file line number Diff line number Diff line change @@ -79,6 +79,31 @@ fn missing_pyproject_toml() {
79
79
) ;
80
80
}
81
81
82
+ #[ test]
83
+ fn missing_find_links ( ) -> Result < ( ) > {
84
+ let context = TestContext :: new ( "3.12" ) ;
85
+ let requirements_txt = context. temp_dir . child ( "requirements.txt" ) ;
86
+ requirements_txt. write_str ( "flask" ) ?;
87
+
88
+ uv_snapshot ! ( context. filters( ) , context. pip_install( )
89
+ . arg( "-r" )
90
+ . arg( "requirements.txt" )
91
+ . arg( "--find-links" )
92
+ . arg( "./missing" )
93
+ . arg( "--strict" ) , @r###"
94
+ success: false
95
+ exit_code: 2
96
+ ----- stdout -----
97
+
98
+ ----- stderr -----
99
+ error: Failed to read `--find-links` directory: [TEMP_DIR]/missing
100
+ Caused by: No such file or directory (os error 2)
101
+ "###
102
+ ) ;
103
+
104
+ Ok ( ( ) )
105
+ }
106
+
82
107
#[ test]
83
108
fn invalid_pyproject_toml_syntax ( ) -> Result < ( ) > {
84
109
let context = TestContext :: new ( "3.12" ) ;
You can’t perform that action at this time.
0 commit comments