mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix `IsADirectoryError`
This commit is contained in:
@@ -478,14 +478,22 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
def build_mimetype(self) -> None:
|
||||
"""Write the metainfo file mimetype."""
|
||||
logger.info(__('writing mimetype file...'))
|
||||
copyfile(path.join(self.template_dir, 'mimetype'), self.outdir, force=True)
|
||||
copyfile(
|
||||
path.join(self.template_dir, 'mimetype'),
|
||||
self.outdir / 'mimetype',
|
||||
force=True,
|
||||
)
|
||||
|
||||
def build_container(self, outname: str = 'META-INF/container.xml') -> None:
|
||||
"""Write the metainfo file META-INF/container.xml."""
|
||||
logger.info(__('writing META-INF/container.xml file...'))
|
||||
outdir = path.join(self.outdir, 'META-INF')
|
||||
outdir = self.outdir / 'META-INF'
|
||||
ensuredir(outdir)
|
||||
copyfile(path.join(self.template_dir, 'container.xml'), outdir, force=True)
|
||||
copyfile(
|
||||
path.join(self.template_dir, 'container.xml'),
|
||||
outdir / 'container.xml',
|
||||
force=True,
|
||||
)
|
||||
|
||||
def content_metadata(self) -> dict[str, Any]:
|
||||
"""Create a dictionary with all metadata for the content.opf
|
||||
|
||||
@@ -14,7 +14,7 @@ from sphinx.theming import HTMLThemeFactory
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.console import bold
|
||||
from sphinx.util.fileutil import copy_asset_file
|
||||
from sphinx.util.osutil import copyfile, ensuredir, os_path
|
||||
from sphinx.util.osutil import ensuredir, os_path
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.application import Sphinx
|
||||
@@ -147,9 +147,9 @@ class ChangesBuilder(Builder):
|
||||
renderer=self.templates,
|
||||
force=True,
|
||||
)
|
||||
copyfile(
|
||||
copy_asset_file(
|
||||
path.join(package_dir, 'themes', 'basic', 'static', 'basic.css'),
|
||||
self.outdir,
|
||||
self.outdir / 'basic.css',
|
||||
force=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -432,9 +432,10 @@ class LaTeXBuilder(Builder):
|
||||
def copy_latex_additional_files(self) -> None:
|
||||
for filename in self.config.latex_additional_files:
|
||||
logger.info(' ' + filename, nonl=True)
|
||||
source = self.confdir / filename
|
||||
copyfile(
|
||||
self.confdir / filename,
|
||||
self.outdir,
|
||||
source,
|
||||
self.outdir / source.name,
|
||||
force=True,
|
||||
)
|
||||
|
||||
@@ -457,9 +458,10 @@ class LaTeXBuilder(Builder):
|
||||
if self.config.latex_logo:
|
||||
if not path.isfile(path.join(self.confdir, self.config.latex_logo)):
|
||||
raise SphinxError(__('logo file %r does not exist') % self.config.latex_logo)
|
||||
source = self.confdir / self.config.latex_logo
|
||||
copyfile(
|
||||
self.confdir / self.config.latex_logo,
|
||||
self.outdir,
|
||||
source,
|
||||
self.outdir / source.name,
|
||||
force=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -203,7 +203,11 @@ class TexinfoBuilder(Builder):
|
||||
try:
|
||||
with progress_message(__('copying Texinfo support files')):
|
||||
logger.info('Makefile ', nonl=True)
|
||||
copyfile(os.path.join(template_dir, 'Makefile'), self.outdir, force=True)
|
||||
copyfile(
|
||||
os.path.join(template_dir, 'Makefile'),
|
||||
self.outdir / 'Makefile',
|
||||
force=True,
|
||||
)
|
||||
except OSError as err:
|
||||
logger.warning(__("error writing file Makefile: %s"), err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user