Skip to content

Commit 4c97abb

Browse files
committed
chore(librarian): Only add header to files in .librarian/generator-input
1 parent 29f70b8 commit 4c97abb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.generator/cli.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,19 @@ def _copy_files_needed_for_post_processing(
413413
destination_dir = f"{output}/{path_to_library}"
414414

415415
if Path(source_dir).exists():
416-
shutil.copytree(
417-
source_dir,
418-
destination_dir,
419-
dirs_exist_ok=True,
420-
)
421-
# Apply headers only to the generator-input files copied above.
422-
_add_header_to_files(destination_dir)
416+
with tempfile.TemporaryDirectory() as tmp_dir:
417+
shutil.copytree(
418+
source_dir,
419+
tmp_dir,
420+
dirs_exist_ok=True,
421+
)
422+
# Apply headers only to the generator-input files copied above.
423+
_add_header_to_files(tmp_dir)
424+
shutil.copytree(
425+
tmp_dir,
426+
destination_dir,
427+
dirs_exist_ok=True,
428+
)
423429

424430
# We need to create these directories so that we can copy files necessary for post-processing.
425431
os.makedirs(

0 commit comments

Comments
 (0)