
    ϶vgG                       d Z ddlmZ ddlZddlZddl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 d	d
l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mZ erddl m!Z! ddl"m#Z#  ej$        e%          Z&d1dZ'd2dZ(	 d3d4dZ)	 	 	 d5d6d#Z*	 	 	 d7d8d&Z+ G d' d(          Z,d) Z-ed9d*            Z. G d+ d,ej/                  Z0 G d- d.e          Z1 G d/ d0e          Z2dS ):ac  
Load setuptools configuration from ``pyproject.toml`` files.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.

To read project metadata, consider using
``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
For simple scenarios, you can also try parsing the file directly
with the help of ``tomllib`` or ``tomli``.
    )annotationsN)Mapping)contextmanager)partial)TracebackType)TYPE_CHECKINGAnyCallable   )StrPath)	FileErrorInvalidConfigError)SetuptoolsWarning   )expand)_PREVIOUSLY_DEFINED_MissingDynamicapply)SelfDistributionfilepathr   returndictc                    ddl m} t          | d          5 }|                    |          cd d d            S # 1 swxY w Y   d S )Nr   )tomllibrb)compat.py310r   openload)r   r   files      \/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py	load_filer#   $   s    &&&&&&	h		 "||D!!" " " " " " " " " " " " " " " " " "s   9= =configboolc                   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exr3   errors          r"   r1   r1   +   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   ignore_option_errorsc                H    t          |d||           }t          | ||          S )zeApply the configuration from a ``pyproject.toml`` file into an existing
    distribution object.
    T)read_configuration_apply)r>   r   r?   r$   s       r"   apply_configurationrC   @   s*      $0DdKKF$)))    Tr   Distribution | Nonedict[str, Any]c                   t           j                            |           } t           j                            |           st	          d| d          t          |           pi }|                    di           }|                    di           }|                    di           }|r|s|si S d|                    di           v rt                                           d|v rt                              d	           |r#|j
        |                    d|j
                   n|                    dd           ||d<   ||d<   d|v rt                              d	           t          |          5  |d|id}t          ||            d
d
d
           n# 1 swxY w Y   |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 and 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
setuptoolstools	distutilsz[tool.distutils])subjectNzinclude-package-dataTzext-modulesz[tool.setuptools.ext-modules])r*   rH   )ospathabspathisfiler   r#   r/   _ToolsTypoInMetadataemit_ExperimentalConfigurationinclude_package_data
setdefault_ignore_errorsr1   dirnameexpand_configuration)
r   r   r?   r>   asdictproject_table
tool_tablesetuptools_tablesubsetroot_dirs
             r"   rA   rA   L   s;   6 wx((H7>>(## LJhJJJKKKx  &BFJJy"--MFB''J!~~lB77 - +; 	vzz'2....!!###j  "''0B'CCC  B)5##$:D<UVVVV##$:DAAAF6N/J|((("''0O'PPP	,	-	- # #*\CS4TUU"""# # # # # # # # # # # # # # #
  R7??8,,#FH6JDQQQMs   0FFFr^   StrPath | Nonec                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?   r>   s       r"   rX   rX      s%    ( 68-A4HHOOQQQrD   c                      e Zd Z	 	 	 d+d,dZd-dZd.dZd/dZd Zd Zd Z	d0dZ
d1dZd2dZd3d!Zd4d"Zd1d#Zd5d%Zd6d'Zd7d(Zd7d)Zd7d*ZdS )8ra   NFr$   r   r^   r_   r?   r%   r>   rE   r   Nonec                   || _         |pt          j                    | _        |                    di           | _        | j                            dg           | _        |                    di                               di           | _        | j                            di           | _        || _	        || _
        t                      | _        d S )Nr*   dynamicrH   rI   )r$   rM   getcwdr^   r/   project_cfgre   setuptools_cfgdynamic_cfgr?   _distset_referenced_files)selfr$   r^   r?   r>   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!
+.55rD   r   c                x    ddl m} | j        | j                            dd           d}| j        p
 ||          S )Nr   r   r4   )src_rootr4   )setuptools.distr   r^   rg   r/   rj   )rm   r   attrss      r"   _ensure_distz_ConfigExpander._ensure_dist   sN    000000!]D4D4H4HQU4V4VWWz0\\%000rD   	containerfieldstrfnr
   c                    ||v rCt          | j                  5   |||                   ||<   d d d            d S # 1 swxY w Y   d S d S N)rV   r?   )rm   rt   ru   rw   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 ry   )rh   r/   _expandcanonic_package_data)rm   ru   package_datas      r"   _canonic_package_dataz%_ConfigExpander._canonic_package_data   s+    *..ub99+L999rD   c                   |                                   |                                  |                     d           |                                 }t          || j        | j                  }|5 }|j        }|                                  |                     |           | 	                    ||           d d d            n# 1 swxY w Y   |j
                            | j
                   | j        S )Nzexclude-package-data)_expand_packagesr   rs   _EnsurePackagesDiscoveredrg   rh   package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicrl   updater$   )rm   r>   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 	%%d&<==={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 )rh   r/   
isinstancelisttupler   r^   rU   rV   r?   r}   find_packages)rm   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^   rz   rh   )rm   
data_filess     r"   r   z"_ConfigExpander._expand_data_files   s:    W7$-PPP
D/zJJJJJrD   r   Mapping[str, str]c                    | j         }t          t          j        ||          }|                     | j        d|           d S )N)r   r^   cmdclass)r^   r   r}   r   rz   rh   )rm   r   r^   r   s       r"   r   z _ConfigExpander._expand_cmdclass   sA    =7+xXXXD/XFFFFFrD   c           
         d fd j         D             }|                                                   pi                                                                                                                                                                       d |                                D             } j	                            |           d S )N)versionreadmeentry-pointsscriptsgui-scriptsclassifiersdependenciesoptional-dependenciesc                H    i | ]}|v|                     |          S r   )_obtain).0ru   r>   r   rm   specials     r"   
<dictcomp>z7_ConfigExpander._expand_all_dynamic.<locals>.<dictcomp>   s@     
 
 
G## 4<<e[99###rD   )r   r   r   r   optional_dependenciesc                    i | ]
\  }}|||S ry   r   )r   kvs      r"   r   z7_ConfigExpander._expand_all_dynamic.<locals>.<dictcomp>  s    NNNDAq1arD   )
re   r   _obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsrg   )rm   r>   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(((((rD   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   )rm   r>   ru   previousmsgs        r"   _ensure_previously_setz&_ConfigExpander._ensure_previously_set  s_    &u-d33D$=Ye Y Y Y 
 %S))) rD   	specifierc                   ddl m} t          | j                  5  | j        }d|v rP| j                             ||d                              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   )always_iterabler!   attrz	invalid `z`: )more_itertoolsr   rV   r?   r^   rl   r   r}   
read_files	read_attrr9   )rm   r   	directiver   r   r^   s         r"   _expand_directivez!_ConfigExpander._expand_directive  s\    	322222D566 	F 	F}H""&--ooi>O.P.PQQQ))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   AB87B8#B88B<?B<c                    || j         v r%|                     d| | j         |         |          S |                     ||           d S )Nztool.setuptools.dynamic.)ri   r   r   )rm   r>   ru   r   s       r"   r   z_ConfigExpander._obtain*  s^    D$$$))2522 '  
 	##D%000trD   c                |    d| j         v r2d| j        v r)t          j        |                     |d|                    S d S )Nr   )re   ri   r}   r   r   )rm   r>   r   s      r"   r   z_ConfigExpander._obtain_version4  sJ    $$d6F)F)F?T9k::   trD   dict[str, str] | Nonec                    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   )re   ri   r   r/   r   )rm   r>   ri   s      r"   r   z_ConfigExpander._obtain_readme=  s    4<''4&{"" T8R88 +H 5 9 9., W W   	##D(333trD    dict[str, dict[str, Any]] | Nonec                     d}t           fd|D                       sd S                      |d|          }|d S t          j        |          did fd} |dd	            |d
d           S )N)r   r   r   c              3  *   K   | ]}|j         v V  d S ry   )re   )r   ru   rm   s     r"   	<genexpr>z7_ConfigExpander._obtain_entry_points.<locals>.<genexpr>P  s*      ==U5DL(======rD   r   ru   rv   groupc                    |v rG                     |          }| j        vr"t          t          j        | |                    || <   d S d S ry   )popre   r   r   r8   )ru   r   valueexpandedgroupsrm   s      r"   _set_scriptsz:_ConfigExpander._obtain_entry_points.<locals>._set_scripts[  sY    

5)),,,_-DUE-R-RSSS"'	 rD   r   console_scriptsr   gui_scripts)ru   rv   r   rv   )anyr   r}   entry_points)rm   r>   r   fieldsr   r   r   r   s   `     @@r"   r   z$_ConfigExpander._obtain_entry_pointsL  s     <====f===== 	4||D.+>><4%d++/=v.F	( 	( 	( 	( 	( 	( 	( 	( 	Y 1222]M222rD   c                r    d| j         v r-|                     |di           }|r|                                S d S )Nr   )re   r   
splitlinesrm   r>   r   s      r"   r   z#_ConfigExpander._obtain_classifiersg  sC    DL((LL}b99E *'')))trD   c                h    d| j         v r(|                     |di           }|rt          |          S d S )Nr   )re   r   _parse_requirements_listr   s      r"   r   z$_ConfigExpander._obtain_dependenciesn  s?    T\))LL~r::E 7/666trD   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   rm   s      r"   r   zA_ConfigExpander._obtain_optional_dependencies.<locals>.<dictcomp>{  s`     	 	 	 %E9 /**PPP!  	 	 	rD   )re   ri   r   r   r   r   )rm   r>   optional_dependencies_maps   `  r"   r   z-_ConfigExpander._obtain_optional_dependenciesu  s    "$,664"d&666(,(89P(Q%7>>>>>	 	 	 	 )B(G(G(I(I	 	 	 	 	##D*ABBBtrD   NFN)
r$   r   r^   r_   r?   r%   r>   rE   r   rc   )r   r   )rt   r   ru   rv   rw   r
   )r{   )r   r   )r>   r   r   r   )r>   r   ru   rv   )r   rv   r   r   )r>   r   ru   rv   r   r   )r>   r   r   r   )r>   r   r   r   r   r   )r>   r   )__name__
__module____qualname__rn   rs   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rD   r"   ra   ra      s        $(%*$(1 1 1 1 1"1 1 1 18 8 8 8
: : : :  "
P 
P 
PK K KG G G G
) ) ) )<* * * *               6           rD   ra   c                >    d |                                  D             S )Nc                    g | ]?}|                                 |                                                     d           =|@S )#)r5   
startswith)r   lines     r"   
<listcomp>z,_parse_requirements_list.<locals>.<listcomp>  sV       ::<< !%

 7 7 < <  rD   )r   )r   s    r"   r   r     s/     $$&&   rD   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)Nzignored error: z - )	Exceptionr6   r7   	__class__r   )r?   r<   s     r"   rV   rV     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                  8     e Zd Zd fdZd fd
Zd fdZ xZS )r   distributionr   rg   r   rh   r   rc   c                f    t                                          |           || _        || _        d S ry   )superrn   _project_cfg_setuptools_cfg)rm   r   rg   rh   r   s       r"   rn   z"_EnsurePackagesDiscovered.__init__  s3     	&&&'-rD   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   Nr4   
py-modulesr   )rj   r   rU   r   r   set_defaults_ignore_ext_modulesmetadatar4   r   r/   
py_modulesr   r   	__enter__)rm   r>   cfgr   r   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  """rD   exc_typetype[BaseException] | None	exc_valueBaseException | None	tracebackTracebackType | Nonec                    | 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   rU   rj   r   r   r   __exit__)rm   r   r   r   r   s       r"   r  z"_EnsurePackagesDiscovered.__exit__  s]     	''
DJ4GHHH''dj6KLLLww)Y???rD   )r   r   rg   r   rh   r   r   rc   )r   r   )r   r   r   r   r   r  r   rc   )r   r   r   rn   r   r  __classcell__)r   s   @r"   r   r     s        . . . . . .# # # # # #,@ @ @ @ @ @ @ @ @ @rD   r   c                      e Zd ZdZdS )rS   z``{subject}` in `pyproject.toml` is still *experimental* and likely to change in future releases.Nr   r   r   _SUMMARYr   rD   r"   rS   rS     s        	3 HHrD   rS   c                      e Zd ZdZdS )rQ   zNIgnoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?Nr  r   rD   r"   rQ   rQ     s        X HHrD   rQ   )r   r   r   r   )r$   r   r   r   r   r%   )F)r>   r   r   r   r?   r%   r   r   )TFN)
r   r   r   r%   r?   r%   r>   rE   r   rF   r   )
r$   r   r^   r_   r?   r%   r>   rE   r   r   )r?   r%   )3__doc__
__future__r   loggingrM   collections.abcr   
contextlibr   	functoolsr   typesr   typingr   r	   r
   _pathr   errorsr   r   warningsr   r-   r   r}   _apply_pyprojecttomlr   r   r   rB   typing_extensionsr   rq   r   	getLoggerr   r6   r#   r1   rC   rA   rX   ra   r   rV   EnsurePackagesDiscoveredr   rS   rQ   r   rD   r"   <module>r     s  	 	 # " " " " "  				 # # # # # # % % % % % %             / / / / / / / / / /       2 2 2 2 2 2 2 2 ( ( ( ( ( (       W W W W W W W W W W -&&&&&&,,,,,,
'
H
%
%" " " ": : : :0 "'	* 	* 	* 	* 	* !& $	F F F F FV  $!& $	R R R R R.Z Z Z Z Z Z Z Zz   H H H H*@ *@ *@ *@ *@ @ *@ *@ *@Z    !2       ,     rD   