def copy_asset_file(source, destination, context=None, renderer=None):
 if (not os.path.exists(source)):
  return
 if (os.path.exists(destination) and os.path.isdir(destination)):
  destination = os.path.join(destination, os.path.basename(source))
 if (source.lower().endswith('_t') and context):
  if (renderer is None):
   from sphinx.util.template import SphinxRenderer
   renderer = SphinxRenderer()
  with codecs.open(source, 'r', encoding='utf-8') as fsrc:
   if destination.lower().endswith('_t'):
    destination = destination[:(-2)]
   with codecs.open(destination, 'w', encoding='utf-8') as fdst:
    fdst.write(renderer.render_string(fsrc.read(), context))
 else:
  copyfile(source, destination)

def copy_asset_file ( source , destination , context = None , renderer = None ) : if ( not os . path . exists ( source ) ) : return if ( os . path . exists ( destination ) and os . path . isdir ( destination ) ) : destination = os . path . join ( destination , os . path . basename ( source ) ) if ( source . lower ( ) . endswith ( '_t' ) and context ) : if ( renderer is None ) : from sphinx . util . template import SphinxRenderer renderer = SphinxRenderer ( ) with codecs . open ( source , 'r' , encoding = 'utf-8' ) as fsrc : if destination . lower ( ) . endswith ( '_t' ) : destination = destination [ : ( - 2 ) ] with codecs . open ( destination , 'w' , encoding = 'utf-8' ) as fdst : fdst . write ( renderer . render_string ( fsrc . read ( ) , context ) ) else : copyfile ( source , destination )
copy an asset file to destination .