Skip to content

Commit 4c0bcb5

Browse files
author
Release Manager
committed
sagemathgh-40857: Fix pdf docbuild failure if destination file exists The destination of shutil.move must be the filename and not a directory to take advantage of move-overwrite filesystem semantic. Fixes sagemath#40854 URL: sagemath#40857 Reported by: Volker Braun Reviewer(s):
2 parents b588712 + ee36386 commit 4c0bcb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sage_docbuild/builders.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,10 @@ def pdf(self):
296296
# Move generated PDFs
297297
for pdf in tex_dir.glob("*.pdf"):
298298
try:
299-
shutil.move(str(pdf), pdf_dir)
299+
dst_pdf = os.path.join(pdf_dir, os.path.basename(pdf))
300+
shutil.move(str(pdf), dst_pdf)
300301
except Exception as e:
301-
logger.error(f"Failed moving {pdf} to {pdf_dir}: {e}")
302+
logger.error(f"Failed moving {pdf} to {dst_pdf}: {e}")
302303
raise
303304

304305
logger.info(f"Build finished. The built documents can be found in {pdf_dir}.")

0 commit comments

Comments
 (0)