
    h                        S SK r S SKrS SKrS SKJrJrJrJr  S SKJ	r	  S SK
Jr  S SKJr  \ R                  " S5      r S SKJr  \R$                  r\(       a  SrO?\R0                  S:X  a  / S	QrO*\R0                  S
:X  a  / SQrO\" S\R0                  -  5      e\(       a  \ H  r\	" \5      r\c  M    O   \c  \" SSR5                  \5      -  5      e\" \5      r\R0                  S:X  a  S SKJr  \" \5      rS r\" S5      r\/\l         \\l!        S r"S r#S r$\$" 5       r%\" S\\\5      r&S r'\&" \'5      r'S r(\(" S\&/\&5      r)\)" \'5        g! \\\\4 a    Sr GNf = f)    N)CDLL	CFUNCTYPEc_char_pc_int)find_library)GDALException)ImproperlyConfiguredzdjango.contrib.gis)settingsnt)	gdal308gdal307gdal306gdal305gdal304gdal303gdal302gdal301gdal300posix)gdalGDALz	gdal3.8.0z	gdal3.7.0z	gdal3.6.0z	gdal3.5.0z	gdal3.4.0z	gdal3.3.0z	gdal3.2.0z	gdal3.1.0z	gdal3.0.0zGDAL is unsupported on OS "%s".zzCould not find the GDAL library (tried "%s"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.z", ")WinDLLc                 N    [         R                  S:X  a	  [        U    $ [        U    $ )zR
Return the correct STDCALL function for certain OSR routines on Win32
platforms.
r   )osnamelwingdallgdal)funcs    Q/var/www/html/env/lib/python3.13/site-packages/django/contrib/gis/gdal/libgdal.pystd_callr    Q   s#    
 
ww$~T{    GDALVersionInfoc                      [        S5      $ )z0Return only the GDAL version number information.s   RELEASE_NAME_version_info r!   r   gdal_versionr'   d   s    ))r!   c                      [        S5      $ )z)Return the full GDAL version information.r!   r$   r&   r!   r   gdal_full_versionr)   i   s    r!   c                      [        5       n [        R                  " SU 5      nU(       d  [        SU -  5      eUR	                  5       u  p#n[        U5      [        U5      U=(       a    [        U5      4$ )Ns7   ^(?P<major>\d+)\.(?P<minor>\d+)(?:\.(?P<subminor>\d+))?z(Could not parse GDAL version string "%s")r'   rematchr   groupsint)vermmajorminorsubminors        r   gdal_version_infor4   n   s\    
.C
LcRAFLMMXXZE(JE
H$>X??r!   c                 0    [         R                  SX5        g )NzGDAL_ERROR %d: %s)loggererror)error_classerror_numbermessages      r   err_handlerr;   }   s    
LL$l<r!   c                 4    [        U 5      nXl        X#l        U$ )N)r    argtypesrestype)r   argsr>   r   s       r   functionr@      s    D>DMLKr!   CPLSetErrorHandler)*loggingr   r+   ctypesr   r   r   r   ctypes.utilr   django.contrib.gis.gdal.errorr   django.core.exceptionsr	   	getLoggerr6   django.confr
   GDAL_LIBRARY_PATHlib_pathAttributeErrorImportErrorOSError	lib_namesr   lib_namejoinr   r   r   r    r%   r=   r>   r'   r)   r4   GDAL_VERSIONCPLErrorHandlerr;   r@   set_error_handlerr&   r!   r   <module>rT      s    	 	 3 3 $ 7 7			/	0$))H IWW_
I WWI @277J
KK ) 
 
	D
++i
 	!  	X 77d?hH *+"   *

@ !" D%9= k* 1O3DoV  + w 	%97C Hs   E E E 