
    ǆiD                       S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
JrJr  SSKJr  SS	KJrJr  SS
KJr  SSKJr  SSKJrJr  SSKJr  \
(       a  SSKJr  SSKJr  \R@                  " \!5      r"S S jr#S!S jr$ S"     S#S jjr%   S$   S%S jjr&   S&         S'S jjr' " S S5      r(S r)\S(S j5       r* " S S\RV                  5      r, " S S\5      r- " S S\5      r.g))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)contextmanager)partial)TYPE_CHECKINGCallableMapping   )StrPath)	FileErrorInvalidConfigError)SetuptoolsWarning   )expand)_PREVIOUSLY_DEFINED_MissingDynamic)applyDistribution)Selfc                ~    SSK Jn  [        U S5       nUR                  U5      sS S S 5        $ ! , (       d  f       g = f)Nr	   )tomllibrb)compat.py310r   openload)filepathr   files      o/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/setuptools/config/pyprojecttoml.py	load_filer   "   s)    &	h	||D! 
		s   .
<c                   SSK Jn  UR                  R                  S5      n[	        US5      (       a  UR                  5          UR                  U 5      $ ! UR                   a  nSUR                   3nUR                  R                  S5      S:w  a4  [        R                  U5        [        R                  UR                  5        SUR                   S	3n[        U S
U 35      S eS nAff = f)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)configr   	validatortrove_classifierexr-   errors          r   r+   r+   )   s    2 11556HI!455**,
:!!&))$$ :)"**677==*MM'"MM"**%1"''!<E7"WI./T9:s   A C-%BC((C-c                4    [        USX 5      n[        XU5      $ )z]Apply the configuration from a ``pyproject.toml`` file into an existing
distribution object.
T)read_configuration_apply)distr   ignore_option_errorsr4   s       r   apply_configurationr>   >   s       $0DKF$))    c                ^   [         R                  R                  U 5      n [         R                  R                  U 5      (       d  [	        SU < S35      e[        U 5      =(       d    0 nUR                  S0 5      nUR                  S0 5      nUR                  S0 5      nU(       a  U(       d	  U(       d  0 $ SUR                  S0 5      ;   a  [        R                  5         SU;   a  [        R                  SS	9  U(       a+  [        US
S5      b  UR                  SUR                  5        OUR                  SS5        XdS'   XvS'   [        U5         USU0S.n[        X5        SSS5        U(       a+  [         R                  R                  U 5      n	[!        XIX#5      $ U$ ! , (       d  f       NB= f)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])subjectinclude_package_dataNzinclude-package-dataT)r$   rA   )ospathabspathisfiler   r   r)   _ToolsTypoInMetadataemit_ExperimentalConfigurationgetattr
setdefaultrF   _ignore_errorsr+   dirnameexpand_configuration)
r   r   r=   r<   asdictproject_table
tool_tablesetuptools_tablesubsetroot_dirs
             r   r:   r:   J   si   6 wwx(H77>>(##-h\9IJKKx &BFJJy"-MFB'J!~~lB7-+;	vzz'2..!!#j "''0B'C 4d;G##$:D<U<UV##$:DA6N/|	,	-*\CS4TU" 
.
 77??8,#F6JQQM 
.	-s   F
F,c                6    [        XX#5      R                  5       $ )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   )r4   rX   r=   r<   s       r   rR   rR      s    ( 6-AHOOQQr?   c                      \ rS rSr   S       SS jjrSS jrSS jrSS jrS rS r	S	 r
SS
 jrSS jrSS jr    SS jrSS jrSS jrS S jr      S!S jrS"S jrS"S jrS"S jrSrg)#rZ      Nc                   Xl         U=(       d    [        R                  " 5       U l        UR	                  S0 5      U l        U R
                  R	                  S/ 5      U l        UR	                  S0 5      R	                  S0 5      U l        U R                  R	                  S0 5      U l        X0l	        X@l
        [        5       U l        g )Nr$   dynamicrA   rB   )r4   rG   getcwdrX   r)   project_cfgr^   setuptools_cfgdynamic_cfgr=   _distset_referenced_files)selfr4   rX   r=   r<   s        r   __init___ConfigExpander.__init__   s      /BIIK!::i4''++Ir:$jj488rJ..229bA$8!
+.5r?   c                    SSK Jn  U R                  U R                  R	                  SS 5      S.nU R
                  =(       d    U" U5      $ )Nr   r   r.   )src_rootr.   )setuptools.distr   rX   r`   r)   rc   )rf   r   attrss      r   _ensure_dist_ConfigExpander._ensure_dist   s;    0!]]D4D4D4H4HQU4VWzz0\%00r?   c                    X!;   a+  [        U R                  5         U" X   5      X'   S S S 5        g g ! , (       d  f       g = fN)rP   r=   )rf   	containerfieldfns       r   _process_field_ConfigExpander._process_field   s:     9 9:#%i&6#7	  ;: ::s	   2
A c                f    U R                   R                  U0 5      n[        R                  " U5      $ rp   )ra   r)   _expandcanonic_package_data)rf   rr   package_datas      r   _canonic_package_data%_ConfigExpander._canonic_package_data   s+    **..ub9++L99r?   c                   U R                  5         U R                  5         U R                  S5        U R                  5       n[        XR                  U R
                  5      nU nUR                  nU R                  5         U R                  U5        U R                  X5        S S S 5        UR                  R                  U R                  5        U R                  $ ! , (       d  f       N?= f)Nzexclude-package-data)_expand_packagesrz   rm   _EnsurePackagesDiscoveredr`   ra   package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicre   updater4   )rf   r<   ctxensure_discoveredr   s        r   r   _ConfigExpander.expand   s    ""$""#9:   "'.>.>@S@ST%+77K##%!!+.$$T7	  	%%d&<&<={{ Ss   $?C
C*c                   U R                   R                  S5      nUb  [        U[        [        45      (       a  g UR                  S5      n[        U[
        5      (       ap  U R                  US'   U R                   R                  S0 5      US'   [        U R                  5         [        R                  " S0 UD6U R                   S'   S S S 5        g g ! , (       d  f       g = f)NpackagesfindrX   package-dirfill_package_dir )ra   r)   
isinstancelisttupledictrX   rO   rP   r=   rw   find_packages)rf   r   r   s      r   r}    _ConfigExpander._expand_packages   s    &&**:6z(T5MBB||F#dD!!#}}D'+':':'E'EmUW'XD#$ 9 9:292G2G2O$2O##J/ ;: " ;:s   $$C
C c                    [        [        R                  U R                  S9nU R	                  U R
                  SU5        g )N)rX   z
data-files)r   rw   canonic_data_filesrX   rt   ra   )rf   
data_filess     r   r   "_ConfigExpander._expand_data_files   s0    W77$--P
D//zJr?   c                    U R                   n[        [        R                  XS9nU R	                  U R
                  SU5        g )N)r   rX   cmdclass)rX   r   rw   r   rt   ra   )rf   r   rX   r   s       r   r    _ConfigExpander._expand_cmdclass   s5    ==7++XD//XFr?   c           
        SnU R                    Vs0 s H  nXC;  d  M
  X@R                  XU5      _M     nnUR                  U R                  X5      =(       d    0 U R	                  X5      U R                  U5      U R                  U5      U R                  U5      U R                  U5      S9  UR                  5        VVs0 s H  u  pgUc  M
  Xg_M     nnnU R                  R                  U5        g s  snf s  snnf )N)versionreadmeentry-pointsscriptsgui-scriptsclassifiersdependenciesoptional-dependencies)r   r   r   r   optional_dependencies)r^   _obtainr   _obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsr`   )	rf   r<   r   specialrr   obtained_dynamickvupdatess	            r   r   #_ConfigExpander._expand_all_dynamic   s    	
 
%# :E<<[99% 	 

 	%%d8>B((;&&t,0062248"&"D"DT"J 	  	
 %5$:$:$<N$<DA414$<N(!
 Os   	C2C2 	C7C7c                p    [         U   " U5      nUc$  U R                  (       d  SU< S3n[        U5      eg g )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   )rf   r<   rr   previousmsgs        r   _ensure_previously_set&_ConfigExpander._ensure_previously_set  sL    &u-d3D$=$=5eY ?Y Y 
 %S)) %>r?   c                   SSK Jn  [        U R                  5         U R                  nSU;   aG  U R
                  R                  U" US   5      5        [        R                  " US   U5      sS S S 5        $ SU;   a#  [        R                  " US   X55      sS S S 5        $ [        SU SU< 35      e! , (       d  f       g = f)Nr   )always_iterabler   attrz	invalid `z`: ) setuptools.extern.more_itertoolsr   rP   r=   rX   re   r   rw   
read_files	read_attrr3   )rf   	specifier	directiver   r   rX   s         r   _expand_directive!_ConfigExpander._expand_directive  s     	ED556}}H"&&--oi>O.PQ)))F*;XF	 76
 "((6):KR 76 y3ymDEE 76 s   AB16B1B11
B?c                    X R                   ;   a#  U R                  SU 3U R                   U   U5      $ U R                  X5        g )Nztool.setuptools.dynamic.)rb   r   r   )rf   r<   rr   r   s       r   r   _ConfigExpander._obtain%  sO    $$$))*5'2  ' 
 	##D0r?   c                    SU R                   ;   a7  SU R                  ;   a'  [        R                  " U R	                  USU5      5      $ g )Nr   )r^   rb   rw   r   r   )rf   r<   r   s      r   r   _ConfigExpander._obtain_version/  s:    $d6F6F)F??4<<i#MNNr?   c                    SU R                   ;  a  g U R                  nSU;   a)  U R                  US0 5      US   R                  SS5      S.$ U R	                  US5        g )Nr   content-typez
text/x-rst)textr   )r^   rb   r   r)   r   )rf   r<   rb   s      r   r   _ConfigExpander._obtain_readme5  sh    4<<'&&{"T8R8 +H 5 9 9., W 
 	##D(3r?   c                   ^ ^^ Sn[        U 4S jU 5       5      (       d  g T R                  USU5      nUc  g [        R                  " U5      mST0mS	UUU 4S jjnU" SS5        U" SS5        T$ )
N)r   r   r   c              3  @   >#    U  H  oTR                   ;   v   M     g 7frp   )r^   ).0rr   rf   s     r   	<genexpr>7_ConfigExpander._obtain_entry_points.<locals>.<genexpr>G  s     =fUDLL(fs   r   c                   > UT;   aF  TR                  U5      nU TR                  ;  a  [        [        R                  " X5      5      eUTU '   g g rp   )popr^   r   r   r2   )rr   groupvalueexpandedgroupsrf   s      r   _set_scripts:_ConfigExpander._obtain_entry_points.<locals>._set_scriptsQ  sH    

5),,_-D-DU-RSS"'	 r?   r   console_scriptsr   gui_scripts)rr   strr   r   )anyr   rw   entry_points)rf   r<   r   fieldsr   r   r   r   s   `     @@r   r   $_ConfigExpander._obtain_entry_pointsC  sx     <=f===||D.+><%%d+"F+	( 	( 	Y 12]M2r?   c                x    SU R                   ;   a*  U R                  US0 5      nU(       a  UR                  5       $ g )Nr   )r^   r   
splitlinesrf   r<   r   s      r   r   #_ConfigExpander._obtain_classifiers]  s5    DLL(LL}b9E''))r?   c                n    SU R                   ;   a%  U R                  US0 5      nU(       a  [        U5      $ g )Nr   )r^   r   _parse_requirements_listr   s      r   r   $_ConfigExpander._obtain_dependenciesd  s1    T\\)LL~r:E/66r?   c                H   SU R                   ;  a  g SU R                  ;   ai  U R                  S   n[        U[        5      (       d   eUR	                  5        VVs0 s H%  u  p4U[        U R                  SU 3U0 5      5      _M'     snn$ U R                  US5        g s  snnf )Nr   z.tool.setuptools.dynamic.optional-dependencies.)r^   rb   r   r   r   r   r   r   )rf   r<   optional_dependencies_mapr   r   s        r   r   -_ConfigExpander._obtain_optional_dependenciesk  s    "$,,6"d&6&66(,(8(89P(Q%7>>>> )B(G(G(I	 )J$E /**HP!  )J	 	 	##D*AB	s   ,B)	rc   re   r4   r^   rb   r=   r`   rX   ra   NFN)r4   r   rX   StrPath | Noner=   boolr<   Distribution | None)returnr   )rq   r   rr   r   rs   r   )zpackage-data)r   Mapping[str, str])r<   r   r   r   )r<   r   rr   r   )r   r   r   r   )r<   r   rr   r   r   r   )r<   r   r   zdict[str, str] | None)r<   r   r   r   r   zdict[str, dict] | None)r<   r   )__name__
__module____qualname____firstlineno__rg   rm   rt   rz   r   r}   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r?   r   rZ   rZ      s     $(%*$(11 !1 #	1
 "1"18
:"
PKG
)<*6G /@	4r?   rZ   c                    U R                  5        Vs/ s HB  nUR                  5       (       d  M  UR                  5       R                  S5      (       a  M@  UPMD     sn$ s  snf )N#)r   r/   
startswith)r   lines     r   r   r     sT     $$&&D::< 	 $

 7 7 < 	&  s   A"AAc              #     #    U (       d  S v   g  S v   g ! [          a9  n[        R                  SUR                  R                   SU 35         S nAg S nAff = f7f)Nzignored error: z - )	Exceptionr0   r1   	__class__r   )r=   r7   s     r   rP   rP     sO     H H(=(='>c"FGGHs*   A A
A/AAAAc                  T   ^  \ rS rSr      SU 4S jjrSU 4S jjrU 4S jrSrU =r$ )r~   i  c                <   > [         TU ]  U5        X l        X0l        g rp   )superrg   _project_cfg_setuptools_cfg)rf   distributionr`   ra   r   s       r   rg   "_EnsurePackagesDiscovered.__init__  s     	&'-r?   c                  > U R                   U R                  p!UR                  S0 5      nUR                  UR                  =(       d    0 5        X1l        UR
                  R                  5         UR                  R                  c*  U R                  R                  S5      UR                  l        UR                  c  UR                  S5      Ul        UR                  c  UR                  S5      Ul        [        TU ]9  5       $ )zWhen entering the context, the values of ``packages``, ``py_modules`` and
``package_dir`` that are missing in ``dist`` are copied from ``setuptools_cfg``.
r   r.   
py-modulesr   )rc   r   rO   r   r   set_defaults_ignore_ext_modulesmetadatar.   r   r)   
py_modulesr   r   	__enter__)rf   r<   cfgr   r   s       r   r  #_EnsurePackagesDiscovered.__enter__  s     JJ 4 4c&)nn]B&G4++1r2&--/ ==%!%!2!2!6!6v!>DMM??"!ggl3DO== GGJ/DMw ""r?   c                   > U R                   R                  SU R                  R                  5        U R                   R                  SU R                  R                  5        [
        TU ]  XU5      $ )zWhen exiting the context, if values of ``packages``, ``py_modules`` and
``package_dir`` are missing in ``setuptools_cfg``, copy from ``dist``.
r   r  )r   rO   rc   r   r  r   __exit__)rf   exc_type	exc_value	tracebackr   s       r   r
  "_EnsurePackagesDiscovered.__exit__  sW    
 	''
DJJ4G4GH''djj6K6KLwY??r?   )r   r   )r   r   r`   r   ra   r   )r   r   )	r   r   r   r   rg   r  r
  r   __classcell__)r   s   @r   r~   r~     s1    .(.7;.MQ.#,@ @r?   r~   c                      \ rS rSrSrSrg)rM   i  z``{subject}` in `pyproject.toml` is still *experimental* and likely to change in future releases.r   Nr   r   r   r   _SUMMARYr   r   r?   r   rM   rM     s    	3 r?   rM   c                      \ rS rSrSrSrg)rK   i  zNIgnoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?r   Nr  r   r?   r   rK   rK     s
    X r?   rK   )r   r
   r   r   )r4   r   r   r
   r   r   )F)r<   r   r   r
   r   r   )TFN)r   r
   r<   r   r   )
r4   r   rX   r   r=   r   r<   r   r   r   )r=   r   )/__doc__
__future__r   loggingrG   
contextlibr   	functoolsr   typingr   r   r   _pathr
   errorsr   r   warningsr   r'   r   rw   _apply_pyprojecttomlr   r   r   r;   rk   r   typing_extensionsr   	getLoggerr   r0   r   r+   r>   r:   rR   rZ   r   rP   EnsurePackagesDiscoveredr~   rM   rK   r   r?   r   <module>r!     s;  	 #  	 %  3 3  2 (  F 1,&


H
%":0 	*
	*	* 		*  $	CC 	CP  $!& $	RRR R 	R
 
R.U Up H H%@ @ @ %@P!2 , r?   