
    -Ph+,                    @   U d dl mZ d dlZddlmZmZmZ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mZmZmZ dd
lmZmZmZmZ ddlmZ ej        rDd dlmZ ddlmZ ddlmZ ddlmZm Z   G d de          Z! G d de          Z" G d de          Z# ed ee$e%e
j&        f          dg           Z'de(d<    G d dej)                  Z* G d dej)                  Z+ G d d           Z, G d! d"e,e          Z- G d# d$e          Z. G d% d&e          Z/d+d*Z0dS ),    )annotationsN   )ExtensionModuleModuleObjectMutableModuleObject
ModuleInfo   )build)dependencies)mesonlib)	noPosargsnoKwargsInterpreterExceptionInvalidArgumentsInvalidCode
FeatureNew)ContainerTypeInfo	KwargInfotyped_kwargstyped_pos_args)
OrderedSet)	TypedDict)ModuleState)Interpreter)TYPE_varTYPE_kwargsc                  .    e Zd ZU ded<   ded<   ded<   dS )	AddKwargs-T.List[T.Union[str, dependencies.Dependency]]whenzUT.List[T.Union[mesonlib.FileOrString, build.GeneratedTypes, dependencies.Dependency]]if_true<T.List[T.Union[mesonlib.FileOrString, build.GeneratedTypes]]if_falseN__name__
__module____qualname____annotations__     \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/modules/sourceset.pyr   r      s6         ;;;;ffffNNNNNNr*   r   c                  $    e Zd ZU ded<   ded<   dS )AddAllKwr   r    T.List[SourceSetImpl]r!   Nr$   r)   r*   r+   r-   r-      s*         ;;;;&&&&&&r*   r-   c                      e Zd ZU ded<   dS )ApplyKwboolstrictNr$   r)   r*   r+   r0   r0   $   s         r*   r0   r    Tlistifydefaultz8KwargInfo[T.List[T.Union[str, dependencies.Dependency]]]_WHEN_KWc                  V    e Zd ZU ded<   	 ded<   	 ded<   	 ded<   	 ded	<   	 ded
<   dS )SourceSetRulezT.List[str]keysT.List[dependencies.Dependency]depsr"   sources
extra_depsr.   
sourcesetsr#   Nr$   r)   r*   r+   r8   r8   1   sn         :))))4IIIIA////B &%%%EJJJJBBr*   r8   c                  $    e Zd ZU ded<   ded<   dS )SourceFilesz@OrderedSet[T.Union[mesonlib.FileOrString, build.GeneratedTypes]]r<   z#OrderedSet[dependencies.Dependency]r;   Nr$   r)   r*   r+   r@   r@   F   s*         MMMM------r*   r@   c                      e Zd ZdZdS )	SourceSetzBase class to avoid circular references.

    Because of error messages, this class is called SourceSet, and the actual
    implementation is an Impl.
    N)r%   r&   r'   __doc__r)   r*   r+   rB   rB   K   s           r*   rB   c                      e Zd Zd5 fdZd6dZd7dZ edeej	        e
j        e
j        e
j        ej        f           ede ed eeeej	        e
j        e
j        e
j        ej        f          dg            ed eeeej	        e
j        e
j        e
j        f          dg                     d8d                        Z ede           ede ed eee          dg                     d9d                        Z	 d:d;d%Zeed<d)                        Zee ed*d+          d=d-                                    Z ed.e
j        ef           ed. ed/e d0                    d>d4                        Z! xZ"S )?SourceSetImplinterpreterr   c                    t                                                       g | _        d| _        | j                            | j        | j        | j        | j	        | j
        d           d S )NF)addadd_allall_sourcesall_dependenciesapply)super__init__rulesfrozenmethodsupdate
add_methodadd_all_methodall_sources_methodall_dependencies_methodapply_methodselfrF   	__class__s     r+   rN   zSourceSetImpl.__init__T   sr    ,.
?*2 $ <&
 
 	 	 	 	 	r*   argsYT.Sequence[T.Union[mesonlib.FileOrString, build.GeneratedTypes, dependencies.Dependency]]returnfT.Tuple[T.List[T.Union[mesonlib.FileOrString, build.GeneratedTypes]], T.List[dependencies.Dependency]]c                   g }g }|D ]G}t          |t          j                  r|                    |           2|                    |           Hg }|D ]}t          |t                    r|                    |           -t          |t
          j                  r|                    |j                   b|                    |	                                           t          j
        |           ||fS N)
isinstancer   
Dependencyappendstrr   Filefnameextendget_outputscheck_direntry_issues)rY   r[   r<   r;   xto_checkss          r+   check_source_filesz SourceSetImpl.check_source_files`   s    PR02 	" 	"A!\455 "Aq!!!! "  	1 	1A!S!! 1""""Ax}-- 1((((0000&x000}r*   1T.Sequence[T.Union[str, dependencies.Dependency]]5T.Tuple[T.List[str], T.List[dependencies.Dependency]]c                    g }g }|D ]B}t          |t                    r|                    |           -|                    |           C||fS r`   )ra   rd   rc   )rY   r[   r9   r;   rj   s        r+   check_conditionszSourceSetImpl.check_conditionsv   sY    02 	 	A!S!! AATzr*   zsourceset.add)varargsr!   Tr3   r#   stater   ^T.Tuple[T.List[T.Union[mesonlib.FileOrString, build.GeneratedTypes, dependencies.Dependency]]]kwargsr   Nonec           
        | j         rt          d          |d         }|d         }|d         }t          |||g          s	|d         }n|d         rt          d          |                     |          \  }}|                     |          \  }	}
|                     |          \  }}| j                            t          |||	|
g |                     d S )Nz0Tried to use 'add' after querying the source setr    r!   r#   r   z5add called with both positional and keyword arguments)	rP   r   anyr   rq   rm   rO   rc   r8   )rY   rs   r[   ru   r    r!   r#   r9   r   r<   r=   _s               r+   rS   zSourceSetImpl.add_method   s    ( ; 	TRSSSf~#*%D'8,-- 	`1gGG!W 	`&'^___!22488l"55g>>--h77!
-lGZQSU]^^_____r*   zsourceset.add_allT.Tuple[T.List[SourceSetImpl]]r-   c           
     :   | j         rt          d          |d         }|d         }|s|s	|d         }n|d         rt          d          |                     |          \  }}|D ]	}d|_         
| j                            t          ||g g |g                      d S )Nz4Tried to use 'add_all' after querying the source setr    r!   r   z9add_all called with both positional and keyword argumentsT)rP   r   r   rq   rO   rc   r8   )	rY   rs   r[   ru   r    r!   r9   r   rl   s	            r+   rT   zSourceSetImpl.add_all_method   s     ; 	XVWWWf~# 	dG 	d1gGG!W 	d&'bccc!22488l 	 	AAHH
-lBGRPPQQQQQr*   N
enabled_fnT.Callable[[str], bool]rJ   r1   intoT.Optional['SourceFiles']r@   c                ,   |s(t          t                      t                                }| j        D ]}t          d |j        D                       rt          fd|j        D                       r|j                            |j                   |j                            |j                   |j                            |j                   |j	        D ]}|
                    ||           |s|j                            |j                   |S )Nc              3  >   K   | ]}|                                 V  d S r`   )found).0rj   s     r+   	<genexpr>z(SourceSetImpl.collect.<locals>.<genexpr>   s*      1117799111111r*   c              3  .   K   | ]} |          V  d S r`   r)   )r   keyr|   s     r+   r   z(SourceSetImpl.collect.<locals>.<genexpr>   s+      99s::c??999999r*   )r@   r   rO   allr;   r9   r<   rR   r=   r>   collectr#   )rY   r|   rJ   r~   entrysss    `    r+   r   zSourceSetImpl.collect   s     	;z||Z\\::DZ 
	0 
	0E11ej11111 9999ej99999##EM222	  ,,,	  !1222* > >BJJz;====" L////r*   T.List[TYPE_var]r   r"   c                f    d| _         |                     d d          }t          |j                  S )NTc                    dS NTr)   rj   s    r+   <lambda>z2SourceSetImpl.all_sources_method.<locals>.<lambda>       t r*   )rP   r   listr<   rY   rs   r[   ru   filess        r+   rU   z SourceSetImpl.all_sources_method   s0     ^^T22EM"""r*   z$source_set.all_dependencies() methodz0.52.0r:   c                f    d| _         |                     d d          }t          |j                  S )NTc                    dS r   r)   r   s    r+   r   z7SourceSetImpl.all_dependencies_method.<locals>.<lambda>   r   r*   )rP   r   r   r;   r   s        r+   rV   z%SourceSetImpl.all_dependencies_method   s0    
 ^^T22EJr*   zsourceset.applyr2   )r5   @T.Tuple[T.Union[build.ConfigurationData, T.Dict[str, TYPE_var]]]r0   SourceFilesObjectc                   	 |d         d| _         |d         	t          t                    rd	fd}n
i d	fd	}|                     |d
          }t	          |          }|S )Nr   Tr2   r   rd   r]   r1   c                    t          t                    s
J d            r| vrt          d|  d          t                              | d                    S )Nfor mypyzEntry z! not in configuration dictionary.F)ra   dictr   r1   get)r   config_datar2   s    r+   _get_from_config_dataz9SourceSetImpl.apply_method.<locals>._get_from_config_data   sj    !+t44@@j@@@ `c44./^/^/^/^___KOOC77888r*   c                    t          t          j                  s
J d            | vrJ| v r,t                              |           d                   | <   nrt          d|  d          d| <   |          S )Nr   r   zsourceset.apply: key "z." not in passed configuration, and strict set.F)ra   r
   ConfigurationDatar1   r   r   )r   config_cacher   r2   s    r+   r   z9SourceSetImpl.apply_method.<locals>._get_from_config_data   s    !+u/FGGSSSSSl**k)),01E1Ea1H,I,IS)) 2./{/{/{/{|||,1S)#C((r*   F)r   rd   r]   r1   )rP   ra   r   r   r   )
rY   rs   r[   ru   r   r   resr   r   r2   s
          @@@r+   rW   zSourceSetImpl.apply_method   s     1g!k4(( 	)9 9 9 9 9 9 9 9 /1L	) 	) 	) 	) 	) 	) 	) 	) 2E::&&
r*   rF   r   )r[   r\   r]   r^   )r[   rn   r]   ro   )rs   r   r[   rt   ru   r   r]   rv   )rs   r   r[   rz   ru   r-   r]   rv   r`   )r|   r}   rJ   r1   r~   r   r]   r@   rs   r   r[   r   ru   r   r]   r"   rs   r   r[   r   ru   r   r]   r:   )rs   r   r[   r   ru   r0   r]   r   )#r%   r&   r'   rN   rm   rq   r   rd   r   re   r
   GeneratedListCustomTargetCustomTargetIndexr   rb   r   r6   r   r   r   rS   rB   rT   r   r   r   rU   r   rV   r   r   r1   rW   __classcell__rZ   s   @r+   rE   rE   S   s        
 
 
 
 
 
   ,	 	 	 	 ^Oc8=%BUW\Wikp  lC  EQ  E\  .]  ^  ^  ^\	dS(-9LeN`bgby  |H  |S  %T  U  U		
 	
 	
 		dS(-9LeN`bgby$z{{		
 	
 	
  ` ` `!  ^  ^"`" ^';;;\	dI..		
 	
 	
	 	R R R	 	 <;R" 37    $ # # # Y X# Z6AA      BA Y X  ^%(?'FGG\#YYxt%L%L%LMM   NM HG    r*   rE   c                  p     e Zd Zd fdZeedd                        Zeedd                        Z xZS )r   r   r@   c                    t                                                       || _        | j                            | j        | j        d           d S )N)r<   r   )rM   rN   r   rQ   rR   sources_methoddependencies_method)rY   r   rZ   s     r+   rN   zSourceFilesObject.__init__   sZ    
* 4
 
 	 	 	 	 	r*   rs   r   r[   r   ru   r   r]   r"   c                4    t          | j        j                  S r`   )r   r   r<   rY   rs   r[   ru   s       r+   r   z SourceFilesObject.sources_method  s     DJ&'''r*   r:   c                4    t          | j        j                  S r`   )r   r   r;   r   s       r+   r   z%SourceFilesObject.dependencies_method  s     DJO$$$r*   )r   r@   r   r   )	r%   r&   r'   rN   r   r   r   r   r   r   s   @r+   r   r      s              ( ( ( X Y( % % % X Y% % % % %r*   r   c                  `     e Zd Z edd          Zd fdZeedd                        Z xZ	S )SourceSetModule	sourcesetz0.51.0rF   r   c                    t                                          |           | j                            d| j        i           d S )N
source_set)rM   rN   rQ   rR   r   rX   s     r+   rN   zSourceSetModule.__init__  sK    %%%$/
 	 	 	 	 	r*   rs   r   r[   r   ru   r   r]   rE   c                *    t          | j                  S r`   )rE   rF   r   s       r+   r   zSourceSetModule.source_set  s     T-...r*   r   )rs   r   r[   r   ru   r   r]   rE   )
r%   r&   r'   r   INFOrN   r   r   r   r   r   s   @r+   r   r     sx        :k8,,D      / / / Y X/ / / / /r*   r   interpr   r]   c                     t          |           S r`   )r   )r   s    r+   
initializer   "  s    6"""r*   )r   r   r]   r   )1
__future__r   typingT r   r   r   r   r
   r   r   interpreterbaser   r   r   r   r   r   interpreterbase.decoratorsr   r   r   r   r   TYPE_CHECKINGtyping_extensionsr   r   rF   r   r   r   r   r-   r0   r   rd   rb   r6   r(   
NamedTupler8   r@   rB   rE   r   r   r   r)   r*   r+   <module>r      sk   # " " " " " "     L L L L L L L L L L L L                                  d c c c c c c c c c c c ! ! ! ! ! !? ++++++))))))77777777O O O O OI O O O' ' ' ' '9 ' ' '
    )   
 FOY
dS,"9:;;	F F F    C C C C CAL C C C*. . . . .!, . . .
       i i i i iI2 i i iV% % % % % % % %*/ / / / /o / / /# # # # # #r*   