
    h                    >   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSK	J
r
  SSKJr  \" \5      R                  r\" \R                   5      r/ rS\R&                  ;   a$  \R)                  \" \R&                  S   5      5        \\S-  \\" S5      /-  rSS	 jrSS
 jrg)z;
Locate `libspatialindex` shared library and header files.
    )annotationsN)find_library)PathSPATIALINDEX_C_LIBRARYlib c                    [         R                  S:X  Gak  S[        R                  " 5       S   ;   a  Sn OSn SU  S3n[        S-  R                  5       (       d  S[        R                  ;   a  [        R                  [        S	-  S
-  5        [         R                  R                  SS5      R                  5       R                  S5      n[         H  nUR                  5       (       d  M  SR                  [        U5      U/5      [         R                  S'    [         R"                  R%                  [        X1-  5      5      nUb  UU[         R                  S'   s  $  U[         R                  S'   M     ['        SU 35      e[         R                  S:X  Ga  [        R.                  " 5       S:X  a  SnOSn [0        R2                  R5                  S5      nUb  U H  nUR6                  R                  S:X  d  M  UR8                  R;                  S5      (       d  MA  SUR<                  ;   d  MS  [        R?                  S[A        URC                  5       5      5          O   [         RF                  " 5       n[         H  n	U	RI                  5       (       a  U	nX-  n
O&U	RK                  5       (       a  U	R6                  nU	n
OME  U
R                  5       (       d  M\   [         RL                  " U5        [         R"                  R%                  [        U
5      5      nUb  U[         RL                  " U5        s  $  [         RL                  " U5        M      [O        S5      nUb  [         R"                  R%                  U5      $  ['        S5      e! [&         a     GN6[(         a'  n[+        SU< 3[        R,                  S9   SnAGNaSnAff = f! U[         R                  S'   f = f! [0        R2                  RD                   a     GNf = f! [(         a*  n[+        SU
 SU< 3[        R,                  S9   SnAGN SnAff = f! [         RL                  " U5        f = f! [(         a     Nf = f)zLLoad 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getcwdis_diris_filechdirr   )archlib_nameoldenvpathrterr	pkg_filesr   cwdcandtargetpths               _C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\rtree/finder.pyloadrK      s   
 
ww$8((*1--DD$TF$/ ,&..0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 G % 6'..q$t{{}2EF! !* iikD{{}}{{==??[[,,S[9>  " 9  <+,?;;**3//  <
==U    R7w?cjjQQR &,

6"2 %%:: 6 ! $VH,@H    s   .NO5?O 8O O ,.O O AP0P9,Q 
OO	ON=7O=OOOO?>O?
P6P1+P91P66P99Q
Q! Q!c                 `    [         R                  R                  S5      n U bQ  U  HK  nUR                  S:X  d  M  [	        [        UR                  5       5      R                  R                  5      s  $    [        S5      n[        R                  S:X  a  [        S-  U-  nO	[        U-  nUR                  5       (       a  [	        UR                  R                  5      $ [        [        5       R                  5      R                  nUR                  U-  nUR                  5       (       a  [	        UR                  R                  5      $ [        S5      U-  nUR                  5       (       a  [	        UR                  R                  5      $ g! [         R                  R                   a     GN7f = f)zyReturn 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=   rK   _name)rE   rB   path_to_spatialindex_hr   libdirs        rJ   get_includerP      sO   &&,,W5	 !99 00tDKKM299@@AA " ""GH 
ww$Y&)??33||~~4;;%%&& $&,,&&F==11D||~~4;;%%&& <00D||~~4;;%%&& 5 22 s   5F 7F 3F F-,F-)returnzctypes.CDLL)rQ   r(   )__doc__
__future__r   r)   importlib.metadatar1   r   r   r   ctypes.utilr   pathlibr   __file__r4   _cwdprefixr   r!   r#   r"   rK   rP        rJ   <module>r\      s    #   	  
 $ H~3:: rzz)tBJJ'?@AB udDH- -h>V&r[   