
    c                     l    d dl Zd dlmZ d dlmZ d dlZda ej                  e
      Zd Zd Zd Zd Zy)    N)configparser)loggingc                 .   t         j                  j                  | t         j                  d      t         j                  j                  | t         j                  t         j                  d      fD ]%  }t         j                  j	                  |      s#|c S  y)zFind the 'setup.cfg' file, if it exists.

    This assumes we're using 'doc/source' for documentation, but also allows
    for single level 'doc' paths.
    z	setup.cfgN)ospathjoinpardirexists)srcdirr   s     //usr/lib/python3/dist-packages/pbr/sphinxext.py_find_setup_cfgr      sh     GGLLK8GGLLBII{CE  77>>$K	     c                    t         t        j                         }t        |       }|r|j	                  |      st
        j                  d       y	 |j                  dd      }t        |j                               dk(  r t        |      dkD  r|j                  dd      }|a t         S # t        j                  $ r t
        j                  d       Y yw xY w)	zReturn string name of project name, or None.

    This extracts metadata from 'setup.cfg'. We don't rely on
    distutils/setuptools as we don't want to actually install the package
    simply to build docs.
    Nz7Could not find a setup.cfg to extract project name frommetadataname       summaryz1Could not extract project metadata from setup.cfg)_projectr   ConfigParserr   readloggerinfogetlensplitError)r   parserr   projects       r   _get_project_namer    -   s     **,v&6;;t,KK   		 jjV4G7==?#q(S\B-> **Z;
 O !! 	KKKL	s   AB& &(CCc                 n   t        | j                        }	 t        j                  j	                  |      }|rm| j                  j                  sV| j                  j                  s?|j                         | j                  _        |j                         | j                  _        y y y y # t
        $ r d }Y }w xY w)N)
r    r   pbrversionVersionInfo	Exceptionconfigreleasecanonical_version_stringversion_string_with_vcs)appproject_nameversion_infos      r   _builder_initedr-   O   s     %SZZ0L{{..|< CJJ..szz7I7I)BBD

)AAC

 8J.|  s   B& &B43B4c                 8    | j                  dt               dddS )Nzbuilder-initedT)parallel_read_safeparallel_write_safe)connectr-   )r*   s    r   setupr2   ^   s!    KK /2"# r   )os.pathr   	six.movesr   sphinx.utilr   pbr.versionr"   r   	getLogger__name__r   r   r    r-   r2    r   r   <module>r:      s@      "  			8	$$DDr   