
    `ch                    6   d Z ddlmZ ddlZddlZddlZddlZddlZddl	m
Z
 ddlmZ  ee      j                  Z eej                         Zg Zdej&                  v r$ej)                   eej&                  d                eedz  e ed      gz  Zdd	Zdd
Zy)z;
Locate `libspatialindex` shared library and header files.
    )annotationsN)find_library)PathSPATIALINDEX_C_LIBRARYlib c                    t         j                  dk(  rYdt        j                         d   v rd} nd} d|  d}t        dz  j                         sdt        j                  v rt        j                  t        d	z  d
z         t         j                  j                  dd      j                         j                  d      }t        D ]  }|j                         sdj                  t        |      |g      t         j                  d<   	 t         j"                  j%                  t        ||z              }|||t         j                  d<   c S 	 |t         j                  d<    t'        d|       t         j                  dk(  r;t        j.                         dk(  rd}nd}	 t0        j2                  j5                  d      }|z|D ]u  }|j6                  j                  dk(  s|j8                  j;                  d      s9d|j<                  v sHt        j?                  dtA        |jC                                       n t        D ]z  }|jG                         r|}||z  }	n |jI                         r|j6                  }|}	n;|	j                         sL	 t         j"                  j%                  t        |	            }||c S | 	 tK        d      }
|
t         j"                  j%                  |
      S 	 t'        d      # t&        $ r Y t(        $ r)}t+        d|t        j,                         Y d}~d}~ww xY w# |t         j                  d<   w xY w# t0        j2                  jD                  $ r Y 4w xY w# t(        $ r,}t+        d|	 d|t        j,                         Y d}~bd}~w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: )filezcould not find or load posixDarwinzlibspatialindex_c.dylibzlibspatialindex_c.sortreez
rtree.libslibspatialindexz.so   zrtree.finder (z) unexpected error: spatialindex_cz(Could not load libspatialindex_c library)&osnameplatformarchitecture_sys_prefixexistssysversion_candidatesappendenvirongetstriprstripjoinstrctypescdllLoadLibraryOSErrorBaseExceptionprintstderrsystem	importlibmetadatafilesparentstem
startswithsuffixesinsertr   locatePackageNotFoundErroris_diris_filer   )archlib_nameoldenvpathrterr	pkg_filesr   candtargetpths              ?/var/www/html/immo/lib/python3.12/site-packages/rtree/finder.pyloadrH      s]   
 
ww$8((*1--DD$TF$/ ,&..0Gs{{4J{Y6>? +113::3? 	,D;;= "%3t9f*=!>BJJv	,[[,,S-AB> &,

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

6"	,  /z:;;	G	 ??(0H .H%..44W=	( ) " KK,,< $		 4 45F G % 6'..q$t{{}2EF!"   	D{{}{{==? [[,,S[9>I ")	8+,?;;**3//  <
==M    R7w?cjjQQR &,

6"2 %%:: 2 ! $VH,@H   
<
==s   .K6
L6?M M ;M 
0M +M2>+N* 6	L3?L6L3
L.(L6.L33L66MM/.M/2	N';!N""N'*	O ?O c                 6   	 t         j                  j                  d      } | N| D ]I  }|j                  dk(  st	        t        |j                               j                  j                        c S  t        d      }t        j                  dk(  rt        dz  |z  }n	t        |z  }|j                         rt	        |j                  j                        S t        t               j                        j                  }|j                  |z  }|j                         rt	        |j                  j                        S t        d      |z  }|j                         rt	        |j                  j                        S y# t         j                  j                  $ r Y &w xY w)zReturn the directory that contains the spatialindex \*.h files.

    :returns: Path to include directory or "" if not found.
    r   zSpatialIndex.hz#include/spatialindex/SpatialIndex.hr
   r   z/usrr   )r1   r2   r3   r   r(   r   r9   r4   r:   r   r   r<   rH   _name)rC   r@   path_to_spatialindex_hr   libdirs        rG   get_includerM      sP   &&,,W5	 ! B99 00tDKKM299@@AAB ""GH 
ww$Y&)??33||~4;;%%&& $&,,&&F==11D||~4;;%%&& <00D||~4;;%%&& 5 22 s   5E7 7E7 0E7 7FF)returnzctypes.CDLL)rN   r(   )__doc__
__future__r   r)   importlib.metadatar1   r   r   r   ctypes.utilr   pathlibr   __file__r4   _cwdprefixr   r!   r#   r"   rH   rM        rG   <module>rY      s    #   	  
 $ H~3:: rzz)tBJJ'?@AB udDH- -d>N&rX   