
    -Phm                       d dl mZ d dlZd dlZddl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 ej        rdd
lmZ ddlmZ ddlmZ ddlmZ ej        g ef         Zej        deej        eej        f         ej        e         gej        e         f         Zej        deej        eej        f         gej        e         f         Z ej        def         Z! G d d          Z"ddZ#dS )    )annotationsN   )DependencyExceptionDependencyMethodsprocess_method_kw)BuiltinDependencySystemDependency)CMakeDependency)ExtraFrameworkDependency)PkgConfigDependency)ExternalDependency)ConfigToolDependency   )Environment)MachineChoicer   .c                  R    e Zd ZdZddededdeeed
d(dZ	e
d)d#            Zd*d'ZdS )+DependencyFactorya2  Factory to get dependencies from multiple sources.

    This class provides an initializer that takes a set of names and classes
    for various kinds of dependencies. When the initialized object is called
    it returns a list of callables return Dependency objects to try in order.

    :name: The name of the dependency. This will be passed as the name
        parameter of the each dependency unless it is overridden on a per
        type basis.
    :methods: An ordered list of DependencyMethods. This is the order
        dependencies will be returned in unless they are removed by the
        _process_method function
    :*_name: This will overwrite the name passed to the corresponding class.
        For example, if the name is 'zlib', but cmake calls the dependency
        'Z', then using `cmake_name='Z'` will pass the name as 'Z' to cmake.
    :*_class: A *type* or callable that creates a class, and has the
        signature of an ExternalDependency
    :system_class: If you pass DependencyMethods.SYSTEM in methods, you must
        set this argument.
    N)
extra_kwargspkgconfig_namepkgconfig_class
cmake_namecmake_classconfigtool_classframework_nameframework_classbuiltin_classsystem_classnamestrmethodsT.List[DependencyMethods]r   T.Optional[T.Dict[str, T.Any]]r   T.Optional[str]r   'T.Type[PkgConfigDependency]'r   r   7'T.Union[T.Type[CMakeDependency], CmakeDependencyFunc]'r   *'T.Optional[T.Type[ConfigToolDependency]]'r   r   "'T.Type[ExtraFrameworkDependency]'r   'T.Type[BuiltinDependency]'r   'T.Type[SystemDependency]'c       
        "   t           j        |v r|st          d          |pi | _        || _        t           j        t          j        |
|	p|          t           j        t          j        ||p|          t           j	        t          j        ||p|          t           j
        t          j        ||          t           j        t          j        ||          t           j        d i| _        |)t          j        ||          | j        t           j        <   d S d S )Nz%A configtool must have a custom class)r   CONFIG_TOOLr   r   r!   EXTRAFRAMEWORK	functoolspartial	PKGCONFIGCMAKESYSTEMBUILTINclasses)selfr   r!   r   r   r   r   r   r   r   r   r   r   s                _/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/dependencies/factory.py__init__zDependencyFactory.__init__F   s    (G33<L3%&MNNN(.B ,i.?Q_Qgcg.h.h'):?NLb^b)c)c#Y%6{JDVRV%W%W$i&7d&K&K%y'8'M'M)4	
 	 ':C:KL\^b:c:cDL*6777 ('    methodr   env'Environment'for_machiner   returnboolc                d    | t           j        u r!|j        |                                         sdS dS )a%  Report whether a method is valid or not.

        If the method is valid, return true, otherwise return false. This is
        used in a list comprehension to filter methods that are not possible.

        By default this only remove EXTRAFRAMEWORK dependencies for non-mac platforms.
        FT)r   r-   machines	is_darwin)r9   r:   r<   s      r6   _process_methodz!DependencyFactory._process_methodg   s8     '666L-7799 75tr8   kwargsT.Dict[str, T.Any]T.List['DependencyGenerator']c                     t           j        |          } j                                                            |            fd|D             S )zBReturn a list of Dependencies with the arguments already attached.c                    g | ]:}                     |          t          j        j        |                   ;S  )rB   r.   r/   r4   ).0mr:   r<   nwargsr5   s     r6   
<listcomp>z.DependencyFactory.__call__.<locals>.<listcomp>}   sT     > > >A''3<<>	!$,q/3?? > > >r8   )r   r!   r   copyupdate)r5   r:   r<   rC   r!   rK   s   ```  @r6   __call__zDependencyFactory.__call__v   sx     $DL&99"''))f> > > > > > > > > > 	>r8   )r   r    r!   r"   r   r#   r   r$   r   r%   r   r$   r   r&   r   r'   r   r$   r   r(   r   r)   r   r*   )r9   r   r:   r;   r<   r   r=   r>   r:   r;   r<   r   rC   rD   r=   rE   )__name__
__module____qualname____doc__r   r   r   r	   r
   r7   staticmethodrB   rO   rH   r8   r6   r   r   /   s         , AE37BU/3XgPT37G_>O<Ld d d d d dB    \> > > > > >r8   r   r!   T.Set[DependencyMethods]r=   1T.Callable[['FactoryFunc'], 'WrappedFactoryFunc']c                     d fd}|S )a  Decorator for handling methods for dependency factory functions.

    This helps to make factory functions self documenting
    >>> @factory_methods([DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE])
    >>> def factory(env: Environment, for_machine: MachineChoice, kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyGenerator']:
    >>>     pass
    func'FactoryFunc'r=   'WrappedFactoryFunc'c                L     t          j                   d
 fd	            }|S )Nr:   r;   r<   r   rC   rD   r=   rE   c           	     <     | ||t          |                    S )Nr   )r:   r<   rC   rY   r!   s      r6   wrappedz/factory_methods.<locals>.inner.<locals>.wrapped   s$    4[&2CGV2T2TUUUr8   rP   )r.   wraps)rY   r^   r!   s   ` r6   innerzfactory_methods.<locals>.inner   sJ    				V 	V 	V 	V 	V 	V 
		V r8   )rY   rZ   r=   r[   rH   )r!   r`   s   ` r6   factory_methodsra      s(          Lr8   )r!   rV   r=   rW   )$
__future__r   r.   typingTbaser   r   r   r	   r
   cmaker   	frameworkr   	pkgconfigr   TYPE_CHECKINGr   
configtoolr   environmentr   mesonlibr   CallableDependencyGeneratorDictr    AnyListFactoryFuncWrappedFactoryFuncCmakeDependencyFuncr   ra   rH   r8   r6   <module>ru      s  
 # " " " " "         8 8 8 8 8 8 8 8 # # # # # # 5 5 5 5 5 5 5 5 " " " " " " / / / / / / * * * * * *? ;((((((000000))))))((((((*R);%;<*F3:F$%		
 	
"#	$K F3:	

 	
"#	$ *S/%9:O> O> O> O> O> O> O> O>d     r8   