
    Xi                    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                     eej        d                              eedz  e ed          gz  ZddZddZdS )z;
Locate `libspatialindex` shared library and header files.
    )annotationsN)find_library)PathSPATIALINDEX_C_LIBRARYlib returnctypes.CDLLc                    t           j        dk    rdt          j                    d         v rd} nd} d|  d}t          dz                                  sdt          j        v r%t          	                    t          d	z  d
z             t           j
                            dd                                                              d          }t          D ]}|                                sd                    t          |          |g          t           j
        d<   	 t           j                            t          ||z                      }|||t           j
        d<   c S n@# t&          $ r Y n4t(          $ r(}t+          d|t          j                   Y d}~nd}~ww xY w|t           j
        d<   # |t           j
        d<   w xY wt'          d|           t           j        dk    rt          j                    dk    rd}nd}	 t0          j                            d          }|t|D ]q}|j        j        dk    r_|j                            d          rEd|j        v r<t                              dtA          |!                                                      nrn# t0          j        j"        $ r Y nw xY wt          D ]}|#                                r|}||z  }	n|$                                r
|j        }|}	n=|	                                sR	 t           j                            t          |	                    }||c S # t(          $ r+}t+          d|	 d|t          j                   Y d}~d}~ww xY w	 tK          d          }
|
t           j                            |
          S n# t(          $ r Y nw xY wt'          d          )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              d/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/rtree/finder.pyloadrJ      sC   
 
w$8(**1---DDD/T/// ,&..00 	@Gs{4J4J{Y6>??? ++1133::3?? 	, 	,D;;==  "%3t99f*=!>!>BJv	,[,,S-A-ABB> &,
6"""" "     R R R???cjQQQQQQQQQR &,
6""V
6"++++:::;;;	G		 ?((0HH .H%.44W==	( ) " " K,<< $	 4 45F G G = % 6 6'..q$t{{}}2E2EFFF!E%:      	 	D{{}} 	 {==??  [,,S[[99>III "    HVHHHH        +,,?;**3///      <
=
==sy   2E! F1!
F+F1-	F6FF1FF11GBJ J21J2/M
M7!M22M7;/N, ,
N98N9r*   c                    	 t           j                            d          } | J| D ]G}|j        dk    r:t	          t          |                                          j        j                  c S Hn# t           j        j        $ r Y nw xY wt          d          }t          j        dk    rt          dz  |z  }n
t          |z  }|                                rt	          |j        j                  S t          t                      j                  j        }|j        |z  }|                                rt	          |j        j                  S t          d          |z  }|                                rt	          |j        j                  S dS )	zReturn the directory that contains the spatialindex \*.h files.

    :returns: Path to include directory or "" if not found.
    r   NzSpatialIndex.hz#include/spatialindex/SpatialIndex.hr   r   z/usrr   )r3   r4   r5   r   r*   r   r;   r6   r<   r   r   r>   rJ   _name)rE   rB   path_to_spatialindex_hr   libdirs        rI   get_includerO      s{   &,,W55	 ! B B9 000tDKKMM229@AAAAA 12    ""GHH 
w$Y&)??33||~~ '4;%&&& $&&,&F=11D||~~ '4;%&&& <<00D||~~ '4;%&&& 2s   A)A. ,A. .BB)r	   r
   )r	   r*   )__doc__
__future__r   r+   importlib.metadatar3   r   r   r!   ctypes.utilr   pathlibr   __file__r6   _cwdprefixr   r#   r%   r$   rJ   rO        rI   <module>rZ      s&    # " " " " "      				  



 $ $ $ $ $ $      tH~~d3: rz))ttBJ'?@AABBB udDDHH- -d> d> d> d>N& & & & & &rY   