
    +Ce                     b   d Z ddlZddlZddlZddlZddlmZ ej                  j                  ej                  j                  ej                  j                  e                  Zej                  j                  dd      ej                  j                  ed      edgZdej"                  fdZy)	zY
finder.py
------------

Locate `libspatialindex` shared library by any means necessary.
    N)find_librarySPATIALINDEX_C_LIBRARYlib returnc                  6   t         j                  dk(  rdt        j                         d   v rd} nd} d|  d}t         j                  j                  t         j                  j                  t        j                  d            sdt        j                  v rBt        j                  t         j                  j                  t        j                  d	d
             t         j                  j                  dd      j                         j                  d      }t        D ]  }|rt         j                  j                  |      s%dj                  ||g      t         j                  d<   	 t         j"                  j%                  t         j                  j                  ||            }|||t         j                  d<   c S 	 |t         j                  d<    t'        d|       t         j                  dk(  rMt        j,                         dk(  rd}nd}t        j.                         }t        D ]  }|t         j                  j1                  |      r#|}t         j                  j                  ||      }nEt         j                  j3                  |      r%t         j                  j5                  |      d   }|}nt         j                  j                  |      s	 t        j6                  |       t         j"                  j%                  |      }||t        j6                  |       c S 	 t        j6                  |        	 t9        d      }|t         j"                  j%                  |      S 	 t'        d      # t&        $ r Y t(        $ r}t+        d|       Y d}~d}~ww xY w# |t         j                  d<   w xY w# t(        $ r}t+        d| d|       Y d}~d}~ww xY w# t        j6                  |       w xY w# t(        $ r Y t'        d      w xY w)zTLoad the `libspatialindex` shared library.

    :returns: Loaded shared library
    nt64r   32zspatialindex_c-z.dllz
conda-metacondaLibrarybinPATHr   ;Nzrtree.finder unexpected error: zcould not find or load posixDarwinzlibspatialindex_c.dylibzlibspatialindex_c.sozrtree.finder (z) unexpected error: spatialindex_cz(Could not load libspatialindex_c library)osnameplatformarchitecturepathexistsjoinsysprefixversion_candidatesappendenvirongetstriprstripctypescdllLoadLibraryOSErrorBaseExceptionprintsystemgetcwdisdirisfilesplitchdirr   )	archlib_nameoldenvr   rtEcwdcandtargets	            ,lib/python3.12/site-packages/rtree/finder.pyloadr9      sC   
 
ww$8((*1--DD$TF$/ GGNN277<<

LAB#++%rww||CJJ	5IJ +113::3? 	,Drww~~d3 "%4.!9BJJv	,[[,,RWW\\$-IJ> &,

6" " &,

6"	,  /z:;;	G	 ??(0H .H iik 	D|t$dH5%ww}}T*1-77>>&)
[[,,V4>  "
 7	:,-;;**400  <
==w    ?7u=>>? &,

6"P ! Jvh.B1%HIIJ   
<
==s   %A M9;N)7O'O(+P 9	N&N)N&N!N)!N&&N))N>	O%
O O( O%%O((O?	PP)__doc__r$   r   r   r   ctypes.utilr   r   abspath
expanduserdirname__file___cwdr    r!   r   r   CDLLr9        r8   <module>rD      s     	  
 $ 
wwrww))"''//(*CDE
 JJNN+T2GGLLu	\>fkk \>rC   