File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11fn main ( ) {
2- rerun_if_changed ( "../Lib/python_builtins/*" ) ;
2+ process_python_libs ( "../Lib/python_builtins/*" ) ;
33
44 #[ cfg( not( feature = "stdlib" ) ) ]
5- rerun_if_changed ( "../Lib/core_modules/*" ) ;
5+ process_python_libs ( "../Lib/core_modules/*" ) ;
66
77 #[ cfg( feature = "stdlib" ) ]
8- rerun_if_changed ( "../../Lib/**/*" ) ;
8+ process_python_libs ( "../../Lib/**/*" ) ;
99
1010 if cfg ! ( windows) {
1111 if let Ok ( real_path) = std:: fs:: read_to_string ( "Lib" ) {
@@ -14,14 +14,18 @@ fn main() {
1414 }
1515}
1616
17- fn rerun_if_changed ( pattern : & str ) {
17+ // remove *.pyc files and add *.py to watch list
18+ fn process_python_libs ( pattern : & str ) {
1819 let glob = glob:: glob ( pattern) . unwrap_or_else ( |e| panic ! ( "failed to glob {pattern:?}: {e}" ) ) ;
1920 for entry in glob. flatten ( ) {
2021 if entry. is_dir ( ) {
2122 continue ;
2223 }
2324 let display = entry. display ( ) ;
2425 if display. to_string ( ) . ends_with ( ".pyc" ) {
26+ if std:: fs:: remove_file ( & entry) . is_err ( ) {
27+ println ! ( "cargo:warning=failed to remove {display}" )
28+ }
2529 continue ;
2630 }
2731 println ! ( "cargo:rerun-if-changed={display}" ) ;
You can’t perform that action at this time.
0 commit comments