
    09oehK                     :   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
mZmZmZmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZmZ e	rddlmZ eeej        f         Z ej        e           Z!dede"fdZ#de"dede$fdZ%	 d'dddeddfdZ&	 	 	 d(deded         fdZ'de"de"ded         de$fdZ(	 	 	 d)de"dee         de$ded         de"f
dZ) G d d          Z*d Z+ede$fd             Z, G d! d"ej-                  Z. G d# d$e/          Z0 G d% d&e/          Z1dS )*z
Load setuptools configuration from ``pyproject.toml`` files.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.
    N)contextmanager)partial)TYPE_CHECKINGCallableDictOptionalMappingUnion)	FileErrorOptionError   )expand)apply)_PREVIOUSLY_DEFINED_WouldIgnoreFieldDistributionfilepathreturnc                     ddl m} t          | d          5 }|                    |          cd d d            S # 1 swxY w Y   d S )Nr   )tomlirb)setuptools.externr   openload)r   r   files      XD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/config/pyprojecttoml.py	load_filer      s    ''''''	h		  zz$                                   s   9= =configc                    ddl m} |j                            d          }t	          |d          r|                                 	 |                    |           S # |j        $ r}d|j         }|j	        
                    d          dk    r9t                              |           t                              |j                   d|j	         d	}t          | d
|           d d }~ww xY w)Nr   )_validate_pyprojectztrove-classifier_disable_downloadzconfiguration error: `projectzinvalid pyproject.toml config: .
) r!   FORMAT_FUNCTIONSgethasattrr"   validateValidationErrorsummarynamestrip_loggerdebugdetails
ValueError)r   r   	validatortrove_classifierexr-   errors          r   r+   r+   !   s   222222 1556HII!455 -**,,,
:!!&)))$ : : :6"*667==**MM'"""MM"*%%%<"'<<<E..W..//T9:s   A 
C+%BC&&C+Fdistr   c                 H    t          |d||           }t          | ||          S )zeApply the configuration from a ``pyproject.toml`` file into an existing
    distribution object.
    T)read_configuration_apply)r8   r   ignore_option_errorsr   s       r   apply_configurationr=   6   s*      $0DdKKF$)))    Tc                    t           j                            |           } t           j                            |           st	          d| d          t          |           pi }|                    di           }|                    di           }|                    di           }|r|s|si S |rd}t          j        |t                     |
                                }	|r,t          |d          |                    d	|j                   n|                    d	d
           ||d<   ||d<   	 |d|id}
t          |
|            n]# t          $ rP}t!          ||	|          ri cY d}~S |r+t"                              d|j        j         d|            n Y d}~nd}~ww xY w|r1t           j                            |           }t-          ||||          S |S )a  Read given configuration file and returns options from it as a dict.

    :param str|unicode filepath: Path to configuration file in the ``pyproject.toml``
        format.

    :param bool expand: Whether to expand directives and other computed values
        (i.e. post-process the given configuration)

    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.

    :param Distribution|None: Distribution object to which the configuration refers.
        If not given a dummy object will be created and discarded after the
        configuration is read. This is used for auto-discovery of packages in the case
        a dynamic configuration (e.g. ``attr`` or ``cmdclass``) is expanded.
        When ``expand=False`` this object is simply ignored.

    :rtype: dict
    zConfiguration file z does not exist.r$   tool
setuptoolszDSupport for `[tool.setuptools]` in `pyproject.toml` is still *beta*.include_package_dataNzinclude-package-dataT)r$   r@   ignored error:  - )ospathabspathisfiler   r   r)   warningswarn_BetaConfigurationcopygetattr
setdefaultrB   r+   	Exception_skip_bad_configr0   r1   	__class____name__dirnameexpand_configuration)r   r   r<   r8   asdictproject_table
tool_tablesetuptools_tablemsgorig_setuptools_tablesubsetr6   root_dirs                r   r:   r:   B   s4   6 wx((H7>>(## LJhJJJKKKx  &BFJJy"--MFB''J!~~lB77 - +; 	 /Tc-... -1133 B455A##$:D<UVVVV##$:DAAAF6N/J|*\CS4TUU"""" 	 	 	M+@$GG 	IIIIII   	MMJBL,AJJbJJKKKK LKKKK	  R7??8,,#FH6JDQQQMs$   .E 
F F"F (.FF project_cfgsetuptools_cfgc                    ||j         j        |j         j        	|j        dS |rdS t	          |                                           }h d}||k    r5t          j        t          	                                t          d           dS dS )z8Be temporarily forgiving with invalid ``pyproject.toml``NF>   requires-pythonr.   versionpython_requires   )
stacklevelT)
metadatar.   ra   install_requiressetkeysrI   rJ   _InvalidFilemessage)r]   r^   r8   given_configpopular_subsets        r   rP   rP      s     |"M!)!) u u{''))**LNNNN~%% 	l**,,lqIIIIt5r>   r\   r<   c                 J    t          | |||                                          S )a  Given a configuration with unresolved fields (e.g. dynamic, cmdclass, ...)
    find their final values.

    :param dict config: Dict containing the configuration for the distribution
    :param str root_dir: Top-level directory for the distribution/project
        (the same directory where ``pyproject.toml`` is place)
    :param bool ignore_option_errors: see :func:`read_configuration`
    :param Distribution|None: Distribution object to which the configuration refers.
        If not given a dummy object will be created and discarded after the
        configuration is read. Used in the case a dynamic configuration
        (e.g. ``attr`` or ``cmdclass``).

    :rtype: dict
    )_ConfigExpanderr   )r   r\   r<   r8   s       r   rT   rT      s%    ( 68-A4HHOOQQQr>   c            
          e Zd Z	 	 	 d!dedee         deded         fdZd"d
Zdede	de
fdZd#dZd Zd Zd Zdee	e	f         fdZdddee	e	f         fdZddde	fdZde	dee	e	f         fdZddde	dee	e	f         fdZdddee	e	f         fdZddd	eee	e	f                  fdZdddee	e	f         d	eee	ef                  fdZd$dZd$dZd$d ZdS )%rn   NFr   r\   r<   r8   r   c                 x   || _         |pt          j                    | _        |                    di           | _        | j                            dg           | _        |                    di                               di           | _        | j                            di           | _        || _	        || _
        d S )Nr$   dynamicr@   rA   )r   rE   getcwdr\   r)   r]   rq   r^   dynamic_cfgr<   _dist)selfr   r\   r<   r8   s        r   __init__z_ConfigExpander.__init__   s      /BIKK!::i44'++Ir::$jj4488rJJ.229bAA$8!


r>   r   c                 x    ddl m} | j        | j                            dd           d}| j        p
 ||          S )Nr   r   r.   )src_rootr.   )setuptools.distr   r\   r]   r)   rt   )ru   r   attrss      r   _ensure_distz_ConfigExpander._ensure_dist   sN    000000!]D4D4H4HQU4V4VWWz0\\%000r>   	containerfieldfnc                     ||v rCt          | j                  5   |||                   ||<   d d d            d S # 1 swxY w Y   d S d S N)_ignore_errorsr<   )ru   r|   r}   r~   s       r   _process_fieldz_ConfigExpander._process_field   s    I 9:: 8 8#%2i&6#7#7	% 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 s   ;??package-datac                 `    | j                             |i           }t          j        |          S r   )r^   r)   _expandcanonic_package_data)ru   r}   package_datas      r   _canonic_package_dataz%_ConfigExpander._canonic_package_data   s+    *..ub99+L999r>   c                    |                                   |                                  |                     d           |                                 }t          || j        | j                  }|5 }|j        }|                                  |                     |           | 	                    ||           d d d            n# 1 swxY w Y   | j
        S )Nzexclude-package-data)_expand_packagesr   r{   _EnsurePackagesDiscoveredr]   r^   package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicr   )ru   r8   ctxensure_discoveredr   s        r   r   z_ConfigExpander.expand   s   ""$$$""#9:::   ""'d.>@STT 	8%+7K##%%%!!+...$$T;777		8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 {s   /ACC	Cc                    | j                             d          }|t          |t          t          f          rd S |                    d          }t          |t
                    rp| j        |d<   | j                             di           |d<   t          | j	                  5  t          j        di || j         d<   d d d            d S # 1 swxY w Y   d S d S )Npackagesfindr\   package-dirfill_package_dir )r^   r)   
isinstancelisttupledictr\   rN   r   r<   r   find_packages)ru   r   r   s      r   r   z _ConfigExpander._expand_packages   s8   &**:66z(T5MBBF||F##dD!! 	P#}D'+':'E'EmUW'X'XD#$ 9:: P P292G2O2O$2O2O#J/P P P P P P P P P P P P P P P P P P	P 	Ps   !CCCc                 ~    t          t          j        | j                  }|                     | j        d|           d S )N)r\   z
data-files)r   r   canonic_data_filesr\   r   r^   )ru   
data_filess     r   r   z"_ConfigExpander._expand_data_files  s:    W7$-PPP
D/zJJJJJr>   r   c                     | j         }t          t          j        ||          }|                     | j        d|           d S )N)r   r\   cmdclass)r\   r   r   r   r   r^   )ru   r   r\   r   s       r   r   z _ConfigExpander._expand_cmdclass  sA    =7+xXXXD/XFFFFFr>   c           
          d fd j         D             }|                                                   pi                                                                                                                                                                       d |                                D             } j	                            |           d S )N)ra   readmeentry-pointsscriptsgui-scriptsclassifiersdependenciesoptional-dependenciesc                 H    i | ]}|v|                     |          S r   )_obtain).0r}   r8   r   ru   specials     r   
<dictcomp>z7_ConfigExpander._expand_all_dynamic.<locals>.<dictcomp>  s@     
 
 
G## 4<<e[99###r>   )ra   r   r   r   optional_dependenciesc                     i | ]
\  }}|||S r   r   )r   kvs      r   r   z7_ConfigExpander._expand_all_dynamic.<locals>.<dictcomp>&  s    NNNDAq1ar>   )
rq   update_obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsr]   )ru   r8   r   obtained_dynamicupdatesr   s   ```  @r   r   z#_ConfigExpander._expand_all_dynamic  s   	

 
 
 
 
 
 

 
 

 	%%dK88>B(({;;&&t,,006622488"&"D"DT"J"J 	  	
 	
 	
 ON$4$:$:$<$<NNN(((((r>   c                 p    t          |         |          }|| j        sd|d}t          |          d S d S )Nz#No configuration found for dynamic z.
Some dynamic fields need to be specified via `tool.setuptools.dynamic`
others must be specified via the equivalent attribute in `setup.py`.)r   r<   r   )ru   r8   r}   previousrY   s        r   _ensure_previously_setz&_ConfigExpander._ensure_previously_set)  s_    &u-d33D$=Ye Y Y Y 
 c""" r>   	specifierc                 ,   t          | j                  5  | j        }d|v r't          j        |d         |          cd d d            S d|v r(t          j        |d         ||          cd d d            S t          d| d|          # 1 swxY w Y   d S )Nr   attrz	invalid `z`: )r   r<   r\   r   
read_files	read_attrr3   )ru   r   	directiver   r\   s        r   _expand_directivez!_ConfigExpander._expand_directive3  s$    D566 	F 	F}H""))F*;XFF	F 	F 	F 	F 	F 	F 	F 	F ""(6):KRR	F 	F 	F 	F 	F 	F 	F 	F DDDyDDEEE	F 	F 	F 	F 	F 	F 	F 	F ts   &B	B	4B		BBc                     || j         v r%|                     d| | j         |         |          S |                     ||           d S )Nztool.setuptools.dynamic.)rs   r   r   )ru   r8   r}   r   s       r   r   z_ConfigExpander._obtain?  s^    D$$$))2522 '  
 	##D%000tr>   c                 |    d| j         v r2d| j        v r)t          j        |                     |d|                    S d S )Nra   )rq   rs   r   ra   r   )ru   r8   r   s      r   r   z_ConfigExpander._obtain_versionI  sA    $$d6F)F)F?4<<i#M#MNNNtr>   c                     d| j         vrd S | j        }d|v r4|                     |di           |d                             dd          dS |                     |d           d S )Nr   content-typez
text/x-rst)textr   )rq   rs   r   r)   r   )ru   r8   rs   s      r   r   z_ConfigExpander._obtain_readmeO  s~    4<''4&{""T8R88 +H 5 9 9., W W  
 	##D(333tr>   c                     d}t           fd|D                       sd S                      |d|          }|d S t          j        |          didt          dt          f fd} |dd            |d	d
           S )N)r   r   r   c              3   *   K   | ]}|j         v V  d S r   )rq   )r   r}   ru   s     r   	<genexpr>z7_ConfigExpander._obtain_entry_points.<locals>.<genexpr>a  s*      ==U5DL(======r>   r   r}   groupc                     |v rT                     |          }| j        vr/t          j        | |          }t	          j        |t                     || <   d S d S r   )poprq   r   rj   rI   rJ   )r}   r   valuerY   expandedgroupsru   s       r   _set_scriptsz:_ConfigExpander._obtain_entry_points.<locals>._set_scriptsk  se    

5)),,+3E5AACM#'8999 #( r>   r   console_scriptsr   gui_scripts)anyr   r   entry_pointsstr)ru   r8   r   fieldsr   r   r   r   s   `     @@r   r   z$_ConfigExpander._obtain_entry_points]  s     <====f===== 	4||D.+>><4%d++"F+	( 	(C 	( 	( 	( 	( 	( 	( 	( 	( 	Y 1222]M222r>   c                 r    d| j         v r-|                     |di           }|r|                                S d S )Nr   )rq   r   
splitlinesru   r8   r   s      r   r   z#_ConfigExpander._obtain_classifiersz  sC    DL((LL}b99E *'')))tr>   c                 h    d| j         v r(|                     |di           }|rt          |          S d S )Nr   )rq   r   _parse_requirements_listr   s      r   r   z$_ConfigExpander._obtain_dependencies  s?    T\))LL~r::E 7/666tr>   c                      d j         vrd S d j        v rD j        d         }t          |t                    sJ  fd|                                D             S                      |d           d S )Nr   c           
      f    i | ]-\  }}|t                              d | |i                     .S )z.tool.setuptools.dynamic.optional-dependencies.)r   r   )r   r   r   ru   s      r   r   zA_ConfigExpander._obtain_optional_dependencies.<locals>.<dictcomp>  s_        %E9 /0F0FLULL1 1    r>   )rq   rs   r   r   r   r   )ru   r8   optional_dependencies_maps   `  r   r   z-_ConfigExpander._obtain_optional_dependencies  s    "$,664"d&666(,(89P(Q%7>>>>>    )B(G(G(I(I    	##D*ABBBtr>   NFN)r   r   )r   )r8   r   )rR   
__module____qualname__r   r   _Pathboolrv   r{   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r>   r   rn   rn      s        %)%*)-  5/ #	
 ~&    1 1 1 18 8S 8h 8 8 8 8
: : : :   
P 
P 
PK K KGGCH,= G G G G
) )WSRUXEV ) ) ) )<#> ## # # # #

6=c3h6G
 
 
 
N 3 WSRUXEV    N cAR    > htCH~6N    "18c1B	$sDy/	"   :           r>   rn   c                 >    d |                                  D             S )Nc                     g | ]?}|                                 |                                                     d           =|@S )#)r/   
startswith)r   lines     r   
<listcomp>z,_parse_requirements_list.<locals>.<listcomp>  sV       ::<< !%

 7 7 < <  r>   )r   )r   s    r   r   r     s/     $$&&   r>   c              #      K   | sd V  d S 	 d V  d S # t           $ r5}t                              d|j        j         d|            Y d }~d S d }~ww xY w)NrC   rD   )rO   r0   r1   rQ   rR   )r<   r6   s     r   r   r     s       H H H HF(=FF"FFGGGGGGGGGHs    
A*AAc                   @     e Zd Zdddedef fdZ fdZ fdZ xZS )r   distributionr   r]   r^   c                 f    t                                          |           || _        || _        d S r   )superrv   _project_cfg_setuptools_cfg)ru   r   r]   r^   rQ   s       r   rv   z"_EnsurePackagesDiscovered.__init__  s3     	&&&'-r>   c                    | j         | j        }}|                    di           }|                    |j        pi            ||_        |j                                         |j        j        $| j	        
                    d          |j        _        |j        |
                    d          |_        |j        |
                    d          |_        t                                                      S )zWhen entering the context, the values of ``packages``, ``py_modules`` and
        ``package_dir`` that are missing in ``dist`` are copied from ``setuptools_cfg``.
        r   Nr.   
py-modulesr   )rt   r   rN   r   r   set_defaults_ignore_ext_modulesre   r.   r   r)   
py_modulesr   r   	__enter__)ru   r8   cfgr   rQ   s       r   r   z#_EnsurePackagesDiscovered.__enter__  s     J 4c&)nn]B&G&G4+1r222&--/// =%!%!2!6!6v!>!>DM?"!ggl33DO= GGJ//DMww  """r>   c                     | j                             d| j        j                   | j                             d| j        j                   t                                          |||          S )zWhen exiting the context, if values of ``packages``, ``py_modules`` and
        ``package_dir`` are missing in ``setuptools_cfg``, copy from ``dist``.
        r   r   )r   rN   rt   r   r   r   __exit__)ru   exc_type	exc_value	tracebackrQ   s       r   r   z"_EnsurePackagesDiscovered.__exit__  s]    
 	''
DJ4GHHH''dj6KLLLww)Y???r>   )rR   r   r   r   rv   r   r   __classcell__)rQ   s   @r   r   r     s        .*.9=.OS. . . . . .# # # # #,@ @ @ @ @ @ @ @ @r>   r   c                       e Zd ZdZdS )rK   zJExplicitly inform users that some `pyproject.toml` configuration is *beta*N)rR   r   r   __doc__r   r>   r   rK   rK     s        TTTTr>   rK   c                   (    e Zd ZdZed             ZdS )ri   a  The given `pyproject.toml` file is invalid and would be ignored.
    !!


    ############################
    # Invalid `pyproject.toml` #
    ############################

    Any configurations in `pyproject.toml` will be ignored.
    Please note that future releases of setuptools will halt the build process
    if an invalid file is given.

    To prevent setuptools from considering `pyproject.toml` please
    DO NOT include the `[project]` or `[tool.setuptools]` tables in your file.
    

!!
    c                 .    ddl m}  || j                  S )Nr   )cleandoc)inspectr  r  )clsr  s     r   rj   z_InvalidFile.message  s&    $$$$$$x$$$r>   N)rR   r   r   r  classmethodrj   r   r>   r   ri   ri     s9          % % [% % %r>   ri   )F)TFNr   )2r  loggingrE   rI   
contextlibr   	functoolsr   typingr   r   r   r   r	   r
   setuptools.errorsr   r   r'   r   r   _apply_pyprojecttomlr   r;   r   r   ry   r   r   PathLiker   	getLoggerrR   r0   r   r   r   r+   r=   r:   rP   rT   rn   r   r   EnsurePackagesDiscoveredr   UserWarningrK   ri   r   r>   r   <module>r     s~   
  				  % % % % % %       J J J J J J J J J J J J J J J J 4 4 4 4 4 4 4 4       1 1 1 1 1 1 H H H H H H H H -,,,,,,c2;
'
H
%
%   $        :T :U :t : : : :0 	* 	*
	*	* 		* 	* 	* 	* %)	L LL >
"	L L L L^'+3;N3K	   @ !%!&%)	R RRuoR R >
"	R
 
R R R R.Q Q Q Q Q Q Q Qh   H H H H H%@ %@ %@ %@ %@ @ %@ %@ %@PU U U U U U U U% % % % %; % % % % %r>   