§
    _÷#d‰  ã                   ó  — d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 ddl
mZmZ ddlmZ erddlmZ 	 	 dded	ed
ee         ded         ddf
d„Zd„ dddfded	eded
ee         ded         deeeegdf                  ddfd„ZdS )z"File utility functions for Sphinx.é    N)ÚTYPE_CHECKINGÚCallableÚDictÚOptional)Úrelative_path)ÚcopyfileÚ	ensuredir)ÚPathMatcher)ÚBaseRendererÚsourceÚdestinationÚcontextÚrendererr   Úreturnc                 ó  — t           j                             | ¦  «        sdS t           j                             |¦  «        r=t           j                             |t           j                             | ¦  «        ¦  «        }|                      ¦   «                              d¦  «        rÖ|�Ô|€ddlm	}  |¦   «         }t          | d¬¦  «        5 }|                     ¦   «                              d¦  «        r
|dd…         }t          |dd¬¦  «        5 }|                     |                     |                     ¦   «         |¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y   ddd¦  «         dS # 1 swxY w Y   dS t          | |¦  «         dS )	aÂ  Copy an asset file to destination.

    On copying, it expands the template variables if context argument is given and
    the asset is a template file.

    :param source: The path to source file
    :param destination: The path to destination file or directory
    :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
    NÚ_tr   ©ÚSphinxRendererzutf-8)ÚencodingéþÿÿÿÚw)ÚosÚpathÚexistsÚisdirÚjoinÚbasenameÚlowerÚendswithÚsphinx.util.templater   ÚopenÚwriteÚrender_stringÚreadr   )r   r   r   r   r   ÚfsrcÚfdsts          ú6/usr/lib/python3/dist-packages/sphinx/util/fileutil.pyÚcopy_asset_filer(      s  € õ Œ7�>Š>˜&Ñ!Ô!ð Øˆå	„w‡}‚}�[Ñ!Ô!ð Jå”g—l’l ;µ´×0@Ò0@ÀÑ0HÔ0HÑIÔIˆà‡|‚|�~„~×Ò˜tÑ$Ô$ð &¨Ð)<ØÐØ;Ð;Ð;Ð;Ð;Ð;Ø%�~Ñ'Ô'ˆHå�& 7Ð+Ñ+Ô+ð 	I¨tØ× Ò Ñ"Ô"×+Ò+¨DÑ1Ô1ð /Ø)¨#¨2¨#Ô.�Ý�k 3°Ð9Ñ9Ô9ð I¸TØ—
’
˜8×1Ò1°$·)²)±+´+¸wÑGÔGÑHÔHÐHðIð Ið Iñ Iô Ið Ið Ið Ið Ið Ið Iøøøð Ið Ið Ið Ið	Ið 	Ið 	Iñ 	Iô 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Iøøøð 	Ið 	Ið 	Ið 	Ið 	Ið 	Iõ 	�˜Ñ%Ô%Ð%Ð%Ð%s7   Ã
AE.Ä<EÅ
E.ÅE	ÅE.ÅE	ÅE.Å.E2Å5E2c                 ó   — dS )NF© )r   s    r'   ú<lambda>r+   2   s   € ÐSX€ ó    ÚexcludedÚonerrorc           	      óD  — t           j                             | ¦  «        sdS |€ddlm}  |¦   «         }t          |¦  «         t           j                             | ¦  «        rt          | |||¦  «         dS t          j        | d¬¦  «        D �]\  }}}	t          | |¦  «        }
|dd…         D ]Y} |t          j        |
|¦  «        ¦  «        r|                     |¦  «         Œ6t          t          j        ||
|¦  «        ¦  «         ŒZ|	D ]”} |t          j        |
|¦  «        ¦  «        st	 t          t          j        ||¦  «        t          j        ||
¦  «        ||¦  «         ŒZ# t          $ r-}|r  |t          j        ||¦  «        |¦  «         n‚ Y d}~ŒŒd}~ww xY wŒ•�ŒdS )aM  Copy asset files to destination recursively.

    On copying, it expands the template variables if context argument is given and
    the asset is a template file.

    :param source: The path to source file or directory
    :param destination: The path to destination directory
    :param excluded: The matcher to determine the given path should be copied or not
    :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 onerror: The error handler.
    Nr   r   T)Úfollowlinks)r   r   r   r    r   r	   Úisfiler(   Úwalkr   Ú	posixpathr   ÚremoveÚ	Exception)r   r   r-   r   r   r.   r   ÚrootÚdirsÚfilesÚreldirÚdirÚfilenameÚexcs                 r'   Ú
copy_assetr=   2   sÿ  € õ Œ7�>Š>˜&Ñ!Ô!ð ØˆàÐØ7Ð7Ð7Ð7Ð7Ð7Ø!�>Ñ#Ô#ˆåˆkÑÔÐÝ	„w‡~‚~�fÑÔð Ý˜ ¨W°hÑ?Ô?Ð?ØˆåœW V¸Ð>Ñ>Ô>ð ñ Ñˆˆd�EÝ˜v tÑ,Ô,ˆØ˜˜˜”7ð 	Dð 	DˆCØˆx�	œ v¨sÑ3Ô3Ñ4Ô4ð DØ—’˜CÑ Ô Ð Ð å�)œ.¨°f¸cÑBÔBÑCÔCÐCÐCàð 
	ð 
	ˆHØ�8�IœN¨6°8Ñ<Ô<Ñ=Ô=ð 	ðÝ#¥I¤N°4¸Ñ$BÔ$BÝ$-¤N°;ÀÑ$GÔ$GØ$+¨Xñ7ô 7ð 7ð 7øõ !ð ð ð Øð Ø˜¥	¤¨t°XÑ >Ô >ÀÑDÔDÐDÐDàð EÐDÐDÐDÐDøøøøðøøøð	ñ
	ðð s   Ä*8E#Å#
FÅ-#FÆF)NN)Ú__doc__r   r3   Útypingr   r   r   r   Údocutils.utilsr   Úsphinx.util.osutilr   r	   Úsphinx.util.typingr
   r    r   Ústrr(   r5   r=   r*   r,   r'   ú<module>rD      ss  ðØ (Ð (à 	€	€	€	Ø Ð Ð Ð Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :à (Ð (Ð (Ð (Ð (Ð (à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø *Ð *Ð *Ð *Ð *Ð *àð 2Ø1Ð1Ð1Ð1Ð1Ð1ð /3Ø9=ð&ð &˜Cð &¨cð &Ø% dœ^ð&à& ~Ô6ð&àBFð&ð &ð &ð &ðD GYÐFXØ)-ÐTXØEIð-ð -�sð -¨ð -¸ð -Ø  œð-Ø9AÀ.Ô9Qð-à  ¨3°	Ð*:¸DÐ*@Ô!AÔBð-àNRð-ð -ð -ð -ð -ð -r,   