File: //usr/lib/python3/dist-packages/sphinx/__pycache__/project.cpython-310.pyc
o
�$�a�
� @ s� d Z ddlZddlmZ ddlmZmZmZmZ ddlm Z ddl
mZmZm
Z
ddlmZ ddlmZmZ e�e�Zg d �ZG d
d� d�ZdS )z�
sphinx.project
~~~~~~~~~~~~~~
Utility function and classes for Sphinx projects.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�glob)�Dict�List�Optional�Set)�__)�get_matching_files�logging�path_stabilize)�compile_matchers)�SEP�relpath)z**/_sourcesz.#*z**/.#*z
*.lproj/**c @ s� e Zd ZdZdedeeef ddfdd�Zdd d
�Zg fdee de e fdd
�Z
dedee fdd�Zddede
defdd�ZdS )�Projectz;A project is the source code set of the Sphinx document(s).�srcdir�
source_suffix�returnNc C s || _ || _t� | _d S )N)r r �set�docnames)�selfr r � r �0/usr/lib/python3/dist-packages/sphinx/project.py�__init__ s zProject.__init__�otherc C s |j | _ dS )z!Take over a result of last build.N)r )r r r r r �restore% s zProject.restore�
exclude_pathsc s� t � � _t|t �}t� j|�D ]P}� �|�}|r`|� jv rCtj� � j|�d }� fdd�t
|�D �}tjt
d�||� �|�dd� qt�tj� � j|�tj�rW� j�|� qtjt
d�|d� q� jS ) zbFind all document files in the source directory and put them in
:attr:`docnames`.
z.*c s g | ]}t |� j��qS r )r
r )�.0�f�r r r �
<listcomp>4 s z$Project.discover.<locals>.<listcomp>zDmultiple files found for the document "%s": %r
Use %r for the build.T)�oncezdocument not readable. Ignored.)�location)r r r �
EXCLUDE_PATHSr r �path2doc�os�path�joinr �logger�warningr �doc2path�access�R_OK�add)r r �excludes�filename�docname�pattern�filesr r r �discover) s
��zProject.discoverr- c C sP |� | j�rt|| j�}| jD ]}|�|�r%t|�}|dt|� � S qdS )z�Return 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 r- �suffixr r r r"