@@ -32,7 +32,6 @@ const REL_PY_PATH: &[&str] = &["Scripts", "python3.exe"];
32
32
const REL_PY_PATH : & [ & str ] = & [ "bin" , "python3" ] ;
33
33
34
34
const RUFF_CONFIG_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "ruff.toml" ] ;
35
- const BLACK_CONFIG_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "black.toml" ] ;
36
35
/// Location within build directory
37
36
const RUFF_CACHE_PATH : & [ & str ] = & [ "cache" , "ruff_cache" ] ;
38
37
const PIP_REQ_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "requirements.txt" ] ;
@@ -124,33 +123,36 @@ fn check_impl(
124
123
}
125
124
126
125
if python_fmt {
127
- let mut cfg_args_black = cfg_args. clone ( ) ;
128
- let mut file_args_black = file_args. clone ( ) ;
126
+ let mut cfg_args_ruff = cfg_args. clone ( ) ;
127
+ let mut file_args_ruff = file_args. clone ( ) ;
129
128
130
129
if bless {
131
130
eprintln ! ( "formatting python files" ) ;
132
131
} else {
133
132
eprintln ! ( "checking python file formatting" ) ;
134
- cfg_args_black . push ( "--check" . as_ref ( ) ) ;
133
+ cfg_args_ruff . push ( "--check" . as_ref ( ) ) ;
135
134
}
136
135
137
136
let mut cfg_path = root_path. to_owned ( ) ;
138
- cfg_path. extend ( BLACK_CONFIG_PATH ) ;
137
+ cfg_path. extend ( RUFF_CONFIG_PATH ) ;
138
+ let mut cache_dir = outdir. to_owned ( ) ;
139
+ cache_dir. extend ( RUFF_CACHE_PATH ) ;
139
140
140
- cfg_args_black . extend ( [ "--config" . as_ref ( ) , cfg_path. as_os_str ( ) ] ) ;
141
+ cfg_args_ruff . extend ( [ "--config" . as_ref ( ) , cfg_path. as_os_str ( ) ] ) ;
141
142
142
- if file_args_black . is_empty ( ) {
143
- file_args_black . push ( root_path. as_os_str ( ) ) ;
143
+ if file_args_ruff . is_empty ( ) {
144
+ file_args_ruff . push ( root_path. as_os_str ( ) ) ;
144
145
}
145
146
146
- let mut args = merge_args ( & cfg_args_black, & file_args_black) ;
147
- let res = py_runner ( py_path. as_ref ( ) . unwrap ( ) , true , None , "black" , & args) ;
147
+ let mut args = merge_args ( & cfg_args_ruff, & file_args_ruff) ;
148
+ args. insert ( 0 , "format" . as_ref ( ) ) ;
149
+ let res = py_runner ( py_path. as_ref ( ) . unwrap ( ) , true , None , "ruff" , & args) ;
148
150
149
151
if res. is_err ( ) && show_diff {
150
152
eprintln ! ( "\n python formatting does not match! Printing diff:" ) ;
151
153
152
154
args. insert ( 0 , "--diff" . as_ref ( ) ) ;
153
- let _ = py_runner ( py_path. as_ref ( ) . unwrap ( ) , true , None , "black " , & args) ;
155
+ let _ = py_runner ( py_path. as_ref ( ) . unwrap ( ) , true , None , "ruff " , & args) ;
154
156
}
155
157
// Rethrow error
156
158
let _ = res?;
0 commit comments