Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy_asset{_file} to doc/extdev/utils #13077

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
('py:class', 'Path'), # sphinx.application.Sphinx.connect
('py:class', 'RoleFunction'), # sphinx.domains.Domain
('py:class', 'RSTState'), # sphinx.utils.parsing.nested_parse_to_nodes
('py:class', 'BaseRenderer'), # sphinx.utils.fileutil.copy_asset_file
('py:class', 'Theme'), # sphinx.application.TemplateBridge
('py:class', 'SearchLanguage'), # sphinx.application.Sphinx.add_search_language
('py:class', 'StringList'), # sphinx.utils.parsing.nested_parse_to_nodes
Expand Down
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_file

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

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
Loading