Optimize copy_asset()

Instantiate default renderer object only once to reduce the cost.
This commit is contained in:
Takeshi KOMIYA
2018-05-02 01:50:19 +09:00
parent b90c2576d6
commit 606dccec6a

View File

@@ -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)