§
    ™æVc`  ã                  óâ  — 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        r d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                úA/usr/lib/python3/dist-packages/mesonbuild/dependencies/factory.pyÚ__init__zDependencyFactory.__init__P   s  € õ Ô(¨GÐ3Ð3Ð<LÐ3Ý%Ð&MÑNÔNÐNà(Ð.¨BˆÔØˆŒõ Ô,­iÔ.?ÀÐQ_ÐQgÐcgÑ.hÔ.hÝÔ'­Ô):¸?ÈNÐLbÐ^bÑ)cÔ)cÝÔ#¥YÔ%6°{ÀJÐDVÐRVÑ%WÔ%WÝÔ$¥iÔ&7¸ÀdÑ&KÔ&KÝÔ%¥yÔ'8¸ÈÑ'MÔ'MÝÔ)¨4ð	
ð 	Œð Ð'Ý:CÔ:KÐL\Ð^bÑ:cÔ:cˆDŒLÕ*Ô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_methodq   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__€   sx   øøøø€ õ $ D¤L°&Ñ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   9   s™   € € € € € ðð ð, AEØ37ØBUØ/3ØXgØPTØ37ØG_Ø>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˜˜[¨&Õ2CÀGÈVÑ2TÔ2TÑ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Ð);Ð%;Ô<ÐØ”*àØØŒF�3˜œ�:ÔØŒFÐ$Ô%ð		
ð 	
ŒÐ"Ô#ð	$ô€Kð œàØØŒF�3˜œ�:Ôð	
ð
 	
ŒÐ"Ô#ð	$ôÐð œ* S¨/Ð%9Ô:ÐðO>ð O>ð O>ð O>ð O>ñ O>ô O>ð O>ðdð ð ð ð ð r8   