
    O&i^                         d Z ddlZddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZmZ  ej        e          Zg d	Z G d
 d          ZdS )z1Utility function and classes for Sphinx projects.    N)glob)DictIterableOptionalSet)__)logging)get_matching_files)SEPpath_stabilizerelpath)z**/_sourcesz.#*z**/.#*z
*.lproj/**c                       e Zd ZdZdedeeef         ddfdZddZ	 	 ddee         dee         de	e         fdZ
dedee         fdZddededefdZdS )Projectz;A project is the source code set of the Sphinx document(s).srcdirsource_suffixreturnNc                 H    || _         || _        t                      | _        d S )N)r   r   setdocnames)selfr   r   s      [/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/sphinx/project.py__init__zProject.__init__   s$     + #&%%    otherc                     |j         | _         dS )z!Take over a result of last build.N)r   )r   r   s     r   restorezProject.restore   s    r    z**exclude_pathsinclude_pathsc           	          t                       _        t           j        |g |t          z             D ].}                     |          }|r| j        v rt          j                             j        |          dz   } fdt          |          D             }t                              t          d          ||                     |          d           t          j        t          j                             j        |          t          j                  r j                            |           t                              t          d          |           0 j        S )zbFind all document files in the source directory and put them in
        :attr:`docnames`.
        z.*c                 :    g | ]}t          |j                  S r   )r   r   ).0fr   s     r   
<listcomp>z$Project.discover.<locals>.<listcomp>0   s%    LLLWQ44LLLr   zDmultiple files found for the document "%s": %r
Use %r for the build.T)oncezdocument not readable. Ignored.)location)r   r   r
   r   EXCLUDE_PATHSpath2docospathjoinr   loggerwarningr   doc2pathaccessR_OKadd)r   r   r    filenamedocnamepatternfiless   `      r   discoverzProject.discover!   s\   
 *Km},
 
 	\ 	\H
 mmH--G 
\dm++ gll4;@@4GGLLLLd7mmLLLENN2 '> $? $?#*E4==3I3IPT # V V V V Yrw||DKBBBGLL \M%%g....NN2&G#H#HSZN[[[}r   r3   c                     |                     | j                  rt          || j                  }| j        D ]@}|                    |          r)t          |          }|dt          |                    c S AdS )zReturn the docname for the filename if the file is a document.

        *filename* should be absolute or relative to the source directory.
        N)
startswithr   r   r   endswithr   len)r   r3   suffixs      r   r)   zProject.path2doc;   s    
 t{++ 	6x55H( 	/ 	/F  (( /)(33#f++..../
 tr   Tr4   basedirc                 H   |                     t          t          j        j                  }t          j                            | j        |          }| j        D ]&}t          j                            ||z             r n't          | j                  d         }|r||z   S ||z   S )zReturn the filename for the document name.

        If *basedir* is True, return as an absolute path.
        Else, return as a relative path to the source directory.
        r   )
replacer   r*   r+   sepr,   r   r   isfilelist)r   r4   r=   basenamer<   s        r   r/   zProject.doc2pathJ   s     //#rw{337<<W55( 	1 	1Fw~~h/00  $,--a0F 	$f$$V##r   )r   r   r   N)r   r   )T)__name__
__module____qualname____doc__strr   r   r   r   r   r7   r   r)   boolr/   r   r   r   r   r      s        EE(s (4S> (d ( ( ( (' ' ' ' 7907 hsm  (<?H   4 #    $ $ $d $c $ $ $ $ $ $r   r   )rG   r*   r   typingr   r   r   r   sphinx.localer   sphinx.utilr	   sphinx.util.matchingr
   sphinx.util.osutilr   r   r   	getLoggerrD   r-   r(   r   r   r   r   <module>rP      s    7 7 				       0 0 0 0 0 0 0 0 0 0 0 0             3 3 3 3 3 3 ; ; ; ; ; ; ; ; ; ;		8	$	$>>>L$ L$ L$ L$ L$ L$ L$ L$ L$ L$r   