From 4c97abba10531c190386bcdbc26de0cd1c972b97 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 16 Dec 2025 18:42:17 +0000 Subject: [PATCH] chore(librarian): Only add header to files in .librarian/generator-input --- .generator/cli.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.generator/cli.py b/.generator/cli.py index f1a23885cd46..4559c73fc27e 100644 --- a/.generator/cli.py +++ b/.generator/cli.py @@ -413,13 +413,19 @@ def _copy_files_needed_for_post_processing( destination_dir = f"{output}/{path_to_library}" if Path(source_dir).exists(): - shutil.copytree( - source_dir, - destination_dir, - dirs_exist_ok=True, - ) - # Apply headers only to the generator-input files copied above. - _add_header_to_files(destination_dir) + with tempfile.TemporaryDirectory() as tmp_dir: + shutil.copytree( + source_dir, + tmp_dir, + dirs_exist_ok=True, + ) + # Apply headers only to the generator-input files copied above. + _add_header_to_files(tmp_dir) + shutil.copytree( + tmp_dir, + destination_dir, + dirs_exist_ok=True, + ) # We need to create these directories so that we can copy files necessary for post-processing. os.makedirs(