]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Refactor as suggested by @miodvallat 15546/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 16 May 2025 07:17:48 +0000 (09:17 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 16 May 2025 07:19:18 +0000 (09:19 +0200)
pdns/recursordist/rec-rust-lib/generate.py

index 6638e31aff6ebd7d96b88e8c2a06c91dac68c591..d58aba1b77a8bc21a86fccfebbb4d12469796c89 100644 (file)
@@ -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()