From: Otto Moerbeek Date: Fri, 16 May 2025 07:17:48 +0000 (+0200) Subject: Refactor as suggested by @miodvallat X-Git-Tag: dnsdist-2.0.0-alpha2~17^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c96d8d43cdcc3ab12790f1ed9246d84de98b76ef;p=thirdparty%2Fpdns.git Refactor as suggested by @miodvallat --- 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()