From c96d8d43cdcc3ab12790f1ed9246d84de98b76ef Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 16 May 2025 09:17:48 +0200 Subject: [PATCH] Refactor as suggested by @miodvallat --- pdns/recursordist/rec-rust-lib/generate.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pdns/recursordist/rec-rust-lib/generate.py b/pdns/recursordist/rec-rust-lib/generate.py index 6638e31aff..d58aba1b77 100644 --- a/pdns/recursordist/rec-rust-lib/generate.py +++ b/pdns/recursordist/rec-rust-lib/generate.py @@ -846,14 +846,12 @@ def generate(): Path(gendir, 'rust', 'web.rs.h').unlink(True) Path(gendir, 'rust', 'cxx.h').unlink(True) Path(gendir, 'rust', 'misc.rs.h').unlink(True) - # Path.walk exist only in very new versions of Python + # Path.walk exists only in very recent versions of Python # With meson, target is in toplevel build dir - for root, dirs, files in os.walk('target', topdown=False): - for name in files: - os.remove(os.path.join(root, name)) # With autotools, target exists in rec-rust-lib/rust and this Python script is executed with cwd rec-rust-lib - for root, dirs, files in os.walk('rust/target', topdown=False): - for name in files: - os.remove(os.path.join(root, name)) + for topdir in ['target', 'rust/target']: + for root, dirs, files in os.walk(topdir, topdown=False): + for name in files: + os.remove(os.path.join(root, name)) generate() -- 2.47.2