@@ -32,7 +32,6 @@ const REL_PY_PATH: &[&str] = &["Scripts", "python3.exe"];
3232const REL_PY_PATH : & [ & str ] = & [ "bin" , "python3" ] ;
3333
3434const RUFF_CONFIG_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "ruff.toml" ] ;
35- const BLACK_CONFIG_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "black.toml" ] ;
3635/// Location within build directory
3736const RUFF_CACHE_PATH : & [ & str ] = & [ "cache" , "ruff_cache" ] ;
3837const PIP_REQ_PATH : & [ & str ] = & [ "src" , "tools" , "tidy" , "config" , "requirements.txt" ] ;
@@ -124,33 +123,36 @@ fn check_impl(
124123 }
125124
126125 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 ( ) ;
129128
130129 if bless {
131130 eprintln ! ( "formatting python files" ) ;
132131 } else {
133132 eprintln ! ( "checking python file formatting" ) ;
134- cfg_args_black . push ( "--check" . as_ref ( ) ) ;
133+ cfg_args_ruff . push ( "--check" . as_ref ( ) ) ;
135134 }
136135
137136 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 ) ;
139140
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 ( ) ] ) ;
141142
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 ( ) ) ;
144145 }
145146
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) ;
148150
149151 if res. is_err ( ) && show_diff {
150152 eprintln ! ( "\n python formatting does not match! Printing diff:" ) ;
151153
152154 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) ;
154156 }
155157 // Rethrow error
156158 let _ = res?;
0 commit comments