Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34bc4e6

Browse files
committed
Fix IsADirectoryError
1 parent eb21864 commit 34bc4e6

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

sphinx/builders/_epub_base.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,22 @@ def handle_page(
478478
def build_mimetype(self) -> None:
479479
"""Write the metainfo file mimetype."""
480480
logger.info(__('writing mimetype file...'))
481-
copyfile(path.join(self.template_dir, 'mimetype'), self.outdir, force=True)
481+
copyfile(
482+
path.join(self.template_dir, 'mimetype'),
483+
self.outdir / 'mimetype',
484+
force=True,
485+
)
482486

483487
def build_container(self, outname: str = 'META-INF/container.xml') -> None:
484488
"""Write the metainfo file META-INF/container.xml."""
485489
logger.info(__('writing META-INF/container.xml file...'))
486-
outdir = path.join(self.outdir, 'META-INF')
490+
outdir = self.outdir / 'META-INF'
487491
ensuredir(outdir)
488-
copyfile(path.join(self.template_dir, 'container.xml'), outdir, force=True)
492+
copyfile(
493+
path.join(self.template_dir, 'container.xml'),
494+
outdir / 'container.xml',
495+
force=True,
496+
)
489497

490498
def content_metadata(self) -> dict[str, Any]:
491499
"""Create a dictionary with all metadata for the content.opf

sphinx/builders/changes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from sphinx.util import logging
1515
from sphinx.util.console import bold
1616
from sphinx.util.fileutil import copy_asset_file
17-
from sphinx.util.osutil import copyfile, ensuredir, os_path
17+
from sphinx.util.osutil import ensuredir, os_path
1818

1919
if TYPE_CHECKING:
2020
from sphinx.application import Sphinx
@@ -147,9 +147,9 @@ def hl(no: int, line: str) -> str:
147147
renderer=self.templates,
148148
force=True,
149149
)
150-
copyfile(
150+
copy_asset_file(
151151
path.join(package_dir, 'themes', 'basic', 'static', 'basic.css'),
152-
self.outdir,
152+
self.outdir / 'basic.css',
153153
force=True,
154154
)
155155

sphinx/builders/latex/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,10 @@ def copy_support_files(self) -> None:
432432
def copy_latex_additional_files(self) -> None:
433433
for filename in self.config.latex_additional_files:
434434
logger.info(' ' + filename, nonl=True)
435+
source = self.confdir / filename
435436
copyfile(
436-
self.confdir / filename,
437-
self.outdir,
437+
source,
438+
self.outdir / source.name,
438439
force=True,
439440
)
440441

@@ -457,9 +458,10 @@ def copy_image_files(self) -> None:
457458
if self.config.latex_logo:
458459
if not path.isfile(path.join(self.confdir, self.config.latex_logo)):
459460
raise SphinxError(__('logo file %r does not exist') % self.config.latex_logo)
461+
source = self.confdir / self.config.latex_logo
460462
copyfile(
461-
self.confdir / self.config.latex_logo,
462-
self.outdir,
463+
source,
464+
self.outdir / source.name,
463465
force=True,
464466
)
465467

sphinx/builders/texinfo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ def copy_support_files(self) -> None:
203203
try:
204204
with progress_message(__('copying Texinfo support files')):
205205
logger.info('Makefile ', nonl=True)
206-
copyfile(os.path.join(template_dir, 'Makefile'), self.outdir, force=True)
206+
copyfile(
207+
os.path.join(template_dir, 'Makefile'),
208+
self.outdir / 'Makefile',
209+
force=True,
210+
)
207211
except OSError as err:
208212
logger.warning(__("error writing file Makefile: %s"), err)
209213

0 commit comments

Comments
 (0)