Skip to content

Commit

Permalink
DOC: Add copy_asset and copy_asset_file to extdev/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jdillard committed Oct 28, 2024
1 parent 62e9606 commit 2615366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/extdev/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Utility functions

.. autofunction:: sphinx.util.parsing.nested_parse_to_nodes

.. autofunction:: sphinx.util.fileutil.copy_asset

.. autofunction:: sphinx.util.fileutil.copy_asset_file

Utility types
-------------
Expand Down
6 changes: 5 additions & 1 deletion sphinx/util/fileutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def copy_asset_file(
:param context: The template variables. If not given, template files are simply copied
:param renderer: The template engine. If not given, SphinxRenderer is used by default
:param bool force: Overwrite the destination file even if it exists.
.. versionadded:: 1.5
"""
if not os.path.exists(source):
return
Expand Down Expand Up @@ -115,7 +117,7 @@ def copy_asset(
On copying, it expands the template variables if context argument is given and
the asset is a template file.
Use ``copy_asset_file`` instead to copy a single file.
Use :func:`copy_asset_file` instead to copy a single file.
:param source: The path to source file or directory
:param destination: The path to destination directory
Expand All @@ -124,6 +126,8 @@ def copy_asset(
:param renderer: The template engine. If not given, SphinxRenderer is used by default
:param onerror: The error handler.
:param bool force: Overwrite the destination file even if it exists.
.. versionadded:: 1.5
"""
if not os.path.exists(source):
return
Expand Down

0 comments on commit 2615366

Please sign in to comment.