+
    ‘°³jr$  ã                  óÞ  a € 0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHtHtHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ]'       d   ^ RIHt ]	 ! R R4      4       t]R.]R,          3,          tR R lt R R lt!R R lt"R R lt#R R lt$R R lt%R R lt&R R  lt'R! R" lt(]#]$]%]&]'](3t)R#]*R$&   R% R& lt+]PX                  R' R( l4       t-R) R* lt.R# )+é    )ÚannotationsN)ÚCallable)Ú	dataclass)ÚTYPE_CHECKING)Ú-_resolve_system_loaded_abs_path_in_subprocess)Úderive_ctk_root)ÚHEADER_DESCRIPTORSÚplatform_include_subdirsÚresolve_conda_anchorÚsystem_install_dir_patterns)ÚCTK_ROOT_CANARY_ANCHOR_LIBNAMES)Úget_cuda_path_or_home)Úfind_sub_dirs_all_sitepackages)Únumeric_aware_path_sort_key)ÚHeaderDescriptorc                  ó8   € ] tR t^$t$ R]R&   R]R&   R R ltRtR# )	ÚLocatedHeaderDirú
str | NoneÚabs_pathÚstrÚ	found_viac               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚNone© )Úformats   "Úm/home/luca/screen-checking/.venv/lib/python3.14/site-packages/cuda/pathfinder/_headers/find_nvidia_headers.pyÚ__annotate__ÚLocatedHeaderDir.__annotate__)   s   € ÷ 1ñ 1˜tñ 1ó    c                	ó:   € \        V P                  4      V n        R # ©N)Ú	_abs_normr   )Úselfs   &r   Ú__post_init__ÚLocatedHeaderDir.__post_init__)   s   € Ü! $§-¡-Ó0ˆŽr!   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r&   Ú__static_attributes__r   r!   r   r   r   $   s   ‡ àÓØƒN÷1ñ 1r!   r   r   c               ó    € V ^8„  d   QhRRRR/# )r   Úpathr   r   r   )r   s   "r   r   r   5   s   € ÷ ñ �Jð  :ñ r!   c                óŽ   € V '       d=   \         P                  P                  \         P                  P                  V 4      4      # R # r#   )Úosr/   ÚnormpathÚabspath)r/   s   &r   r$   r$   5   s*   € ßÜ�w‰w×Ñ¤§¡§¡°Ó 5Ó6Ð6Ùr!   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Údirpathr   Úbasenamer   Úboolr   )r   s   "r   r   r   ;   s!   € ÷ ;ñ ;˜Cð ;¨3ð ;°4ñ ;r!   c                óz   € \         P                  P                  \         P                  P                  W4      4      # r#   )r1   r/   ÚisfileÚjoin)r5   r6   s   &&r   Ú_joined_isfiler;   ;   s"   € Ü�7‰7�>‰>œ"Ÿ'™'Ÿ,™, wÓ9Ó:Ð:r!   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Údescr   Úanchor_pointr   r   r   r   )r   s   "r   r   r   ?   s"   € ÷ ñ Ð#3ð À3ð È:ñ r!   c                ó<  € V P                   pV P                   F  p\        P                  P	                  W4      p\        V 4       F9  p\        P                  P	                  WE4      p\        Wb4      '       g   K5  Vu u # 	  \        WB4      '       g   K}  Vu # 	  R# )zNSearch for a header under *anchor_point* using the descriptor's layout fields.N)Úheader_basenameÚanchor_include_rel_dirsr1   r/   r:   r
   r;   )r=   r>   Ú
h_basenameÚrel_dirÚidirÚsubdirÚcdirs   &&     r   Ú_locate_in_anchor_layoutrG   ?   sw   € à×%Ñ%€JØ×/Ô/ˆÜ�w‰w�|‰|˜LÓ2ˆÜ.¨tÖ4ˆFÜ—7‘7—<‘< Ó-ˆDÜ˜d×/Ô/Ø”ñ 5ô ˜$×+Ô+ØŠKñ 0ñ r!   c               ó    € V ^8„  d   QhRRRR/# ©r   r=   r   r   úLocatedHeaderDir | Noner   )r   s   "r   r   r   R   s   € ÷ ñ Ð 0ð Ð5Lñ r!   c                óØ   € V P                    FY  p\        \        VP                  R4      4      4       F/  p\	        W P
                  4      '       g   K   \        VRR7      u u # 	  K[  	  R# )z#Search pip wheel install locations.Ú/zsite-packages©r   r   N)Úsite_packages_dirsr   ÚtupleÚsplitr;   r@   r   )r=   Úsub_dirÚhdr_dirs   &  r   Úfind_in_site_packagesrS   R   sS   € à×*Ô*ˆä5´e¸G¿M¹MÈ#Ó<NÓ6OÖPˆGÜ˜g×';Ñ';×<Ô<Ü'°ÀOÔTÔTó Qñ +ñ
 r!   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r   s   "r   r   r   \   s   € ÷ ñ Ð(ð Ð-Dñ r!   c                óº   € \         P                  P                  R4      pV'       g   R# \        W4      pVf   R# \	        W4      pV'       d   \        VRR7      # R# )zSearch ``$CONDA_PREFIX``.ÚCONDA_PREFIXNÚcondarM   )r1   ÚenvironÚgetr   rG   r   )r=   Úconda_prefixr>   Úfound_header_paths   &   r   Úfind_in_condar\   \   sL   € ä—:‘:—>‘> .Ó1€LßÙÜ'¨Ó;€LØÒÙÜ0°ÓDÐßÜÐ):ÀgÔNÐNÙr!   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r   s   "r   r   r   j   s   € ÷ 	ñ 	Ð 0ð 	Ð5Lñ 	r!   c                ó¸   € V P                    FI  p\        P                  P                  V4      pV'       g   K,  \	        W4      pVf   K=  \        W1R7      u # 	  R# )zESearch roots supplied through product-specific environment variables.NrM   )Úproduct_root_env_varsr1   rX   rY   rG   r   )r=   Úenv_varÚrootÚresults   &   r   Úfind_in_product_rootsrc   j   sJ   € à×-Ô-ˆÜ�z‰z�~‰~˜gÓ&ˆßÙÜ)¨$Ó5ˆØÔÜ#¨VÔGÒGñ .ñ r!   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r   s   "r   r   r   v   s   € ÷ ñ Ð,ð Ð1Hñ r!   c                ó^   € \        4       pVf   R# \        W4      pVe   \        VRR7      # R# )z'Search ``$CUDA_PATH`` / ``$CUDA_HOME``.NÚ	CUDA_PATHrM   )r   rG   r   )r=   Ú	cuda_homerb   s   &  r   Úfind_in_cuda_pathrh   v   s3   € ä%Ó'€IØÒÙÜ% dÓ6€FØÒÜ¨¸;ÔGÐGÙr!   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r   s   "r   r   r   �   s   € ÷ ñ Ð#3ð Ð8Oñ r!   c                óÀ   € V P                   '       g   R# \        \        ^ ,          4      pVf   R# \        V4      pVf   R# \	        W4      pVe   \        VRR7      # R# )a8  Try CTK header lookup via CTK-root canary probing.

Skips immediately if the descriptor does not opt in (``use_ctk_root_canary``).
Otherwise, system-loads ``cudart`` in a fully isolated Python subprocess, derives
CTK root from the resolved library path, and searches the expected include
layout under that root.
Nzsystem-ctk-rootrM   )Úuse_ctk_root_canaryr   r   r   rG   r   )r=   Úcanary_abs_pathÚctk_rootrb   s   &   r   Úfind_via_ctk_root_canaryrn   �   sa   € ð ×#×#Ð#ÙÜCÔDcÐdeÕDfÓg€OØÒÙÜ˜Ó/€HØÒÙÜ% dÓ5€FØÒÜ¨Ð;LÔMÐMÙr!   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r   s   "r   r   r   —   s   € ÷ ñ Ð&6ð Ð;Rñ r!   c                óÜ   € \        V 4       F\  p\        \        P                  ! V4      \        RR7       F/  p\	        W P
                  4      '       g   K   \        VRR7      u u # 	  K^  	  R# )z2Search system install directories (glob patterns).T)ÚkeyÚreverseÚsupported_install_dirrM   N)r   ÚsortedÚglobr   r;   r@   r   )r=   ÚpatternrR   s   &  r   Úfind_in_system_install_dirsrw   —   sT   € ä.¨tÖ4ˆÜœdŸiši¨Ó0Ô6QÐ[_×`ˆGÜ˜g×';Ñ';×<Ô<Ü'°ÐD[Ô\Ô\ó añ 5ñ r!   útuple[HeaderFindStep, ...]Ú
FIND_STEPSc               ó$   € V ^8„  d   QhRRRRRR/# )r   r=   r   Ústepsrx   r   rJ   r   )r   s   "r   r   r   ¯   s$   € ÷ ñ Ð)ð Ð2Lð ÐQhñ r!   c                ó8   € V F  pV! V 4      pVf   K  Vu # 	  R# )z1Run find steps in order, returning the first hit.Nr   )r=   r{   Ústeprb   s   &&  r   Úrun_find_stepsr~   ¯   s%   € ãˆÙ�d“ˆØÔØŠMñ ñ r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úlibnamer   r   rJ   r   )r   s   "r   r   r   ¾   s   € ÷ ,ñ ,¨Cð ,Ð4Kñ ,r!   c                ót   € \         P                  ! V 4      pVf   \        RV : 24      h\        V\        4      # )uù  Locate the header directory for a supported NVIDIA library.

Args:
    libname (str): The short name of the library whose headers are needed
        (e.g., ``"nvrtc"``, ``"cusolver"``, ``"nvshmem"``).

Returns:
    LocatedHeaderDir or None: A LocatedHeaderDir object containing the absolute path
    to the discovered header directory and information about where it was found,
    or ``None`` if the headers cannot be found.

Raises:
    RuntimeError: If ``libname`` is not in the supported set.

Search order:
    1. **NVIDIA Python wheels** â€” site-packages directories from the descriptor.
    2. **Conda environments** â€” platform-specific conda include layouts.
    3. **Product environment variables** â€” for example, ``CUDNN_PATH``.
    4. **CUDA Toolkit environment variables** â€” ``CUDA_PATH`` / ``CUDA_HOME``.
    5. **CTK root canary probe** â€” subprocess canary (descriptors with
       ``use_ctk_root_canary=True`` only).
    6. **System install directories** â€” glob patterns from the descriptor.
zUNKNOWN libname=)r	   rY   ÚRuntimeErrorr~   ry   )r€   r=   s   & r   Úlocate_nvidia_header_directoryrƒ   ½   s9   € ô2 ×!Ò! 'Ó*€DØ‚|ÜÐ. g¡ZÐ0Ó1Ð1Ü˜$¤
Ó+Ð+r!   c               ó    € V ^8„  d   QhRRRR/# )r   r€   r   r   r   r   )r   s   "r   r   r   Ü   s   € ÷ -ñ -¨#ð -°*ñ -r!   c                óD   € \        V 4      pV'       d   VP                  # R# )u–  Locate the header directory for a supported NVIDIA library.

Args:
    libname (str): The short name of the library whose headers are needed
        (e.g., ``"nvrtc"``, ``"cusolver"``, ``"nvshmem"``).

Returns:
    str or None: Absolute path to the discovered header directory, or ``None``
    if the headers cannot be found.

Raises:
    RuntimeError: If ``libname`` is not in the supported set.

Search order:
    1. **NVIDIA Python wheels** â€” site-packages directories from the descriptor.
    2. **Conda environments** â€” platform-specific conda include layouts.
    3. **Product environment variables** â€” for example, ``CUDNN_PATH``.
    4. **CUDA Toolkit environment variables** â€” ``CUDA_PATH`` / ``CUDA_HOME``.
    5. **CTK root canary probe** â€” subprocess canary (descriptors with
       ``use_ctk_root_canary=True`` only).
    6. **System install directories** â€” glob patterns from the descriptor.
N)rƒ   r   )r€   Úfounds   & r   Úfind_nvidia_header_directoryr‡   Ü   s   € ô. +¨7Ó3€Eß"ˆ5�>‰>Ð,¨Ð,r!   )/Ú__conditional_annotations__Ú
__future__r   Ú	functoolsru   r1   Úcollections.abcr   Údataclassesr   Útypingr   Ú5cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_libr   Ú*cuda.pathfinder._dynamic_libs.search_stepsr   Ú*cuda.pathfinder._headers.header_descriptorr	   r
   r   r   Ú&cuda.pathfinder._utils.ctk_root_canaryr   Úcuda.pathfinder._utils.env_varsr   Ú$cuda.pathfinder._utils.find_sub_dirsr   Ú cuda.pathfinder._utils.path_sortr   r   r   ÚHeaderFindStepr$   r;   rG   rS   r\   rc   rh   rn   rw   ry   r,   r~   Úcacherƒ   r‡   )rˆ   s   @r   Ú<module>r—      sð   øð÷ #Ð "ã Û Û 	Ý $Ý !Ý  õõ G÷ó õ SÝ AÝ OÝ HçÝKð ÷1ð 1ó ð1ð Ð-Ð.Ð0@À4Õ0GÐGÕH€õõ;õõ&õõ	õõõ,ð ØØØØØð*€
Ð&ó õð ‡�ô,ó ð,÷<-r!   