diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-05-01 19:50:19 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-05-01 19:50:22 +0300 |
commit | 606dccec6ada96004825ed1972b742078e17ddbb (patch) | |
tree | 621307c7fafbd942b1967ea5463fb4e1c67afa31 /sphinx | |
parent | b90c2576d69cb7c9cff1caff60d43dc8543fe4f9 (diff) |
Optimize copy_asset()
Instantiate default renderer object only once to reduce the cost.
Diffstat (limited to 'sphinx')
-rw-r--r-- | sphinx/util/fileutil.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py index 7caf40275..fcbc8abe6 100644 --- a/sphinx/util/fileutil.py +++ b/sphinx/util/fileutil.py @@ -74,6 +74,10 @@ def copy_asset(source, destination, excluded=lambda path: False, context=None, r if not os.path.exists(source): return + if renderer is None: + from sphinx.util.template import SphinxRenderer + renderer = SphinxRenderer() + ensuredir(destination) if os.path.isfile(source): copy_asset_file(source, destination, context, renderer) |