3
gg                 @   s  d dl Z d dlZd dlZd dlmZmZmZmZ d dlm	Z	 d dl
mZ d dlmZ e jdZyd dlmZ ejZW n  eeeefk
r   dZY nX erdZnRejdkrd	d
ddddddgZn2ejdkrddddddddddg
Znedej erxeD ]Ze	eZedk	rP qW edkr4eddje eeZejdkr\d dlmZ eeZd d! Zed"Zege_ ee_!d#d$ Z"d%d& Z#d'd( Z$e$ Z%edeeeZ&d)d* Z'e&e'Z'd+d, Z(e(d-e&ge&Z)e)e' dS ).    N)CDLL	CFUNCTYPEc_char_pc_int)find_library)GDALException)ImproperlyConfiguredzdjango.contrib.gis)settingsntZgdal302Zgdal301Zgdal300Zgdal204Zgdal203Zgdal202Zgdal201Zgdal20posixZgdalZGDALz	gdal3.2.0z	gdal3.1.0z	gdal3.0.0z	gdal2.4.0z	gdal2.3.0z	gdal2.2.0z	gdal2.1.0z	gdal2.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             C   s   t jdkrt|  S t|  S dS )z^
    Return the correct STDCALL function for certain OSR routines on Win32
    platforms.
    r
   N)osnamelwingdallgdal)func r   ]/var/www/tester-filtro-web/env/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.pystd_call@   s    
r   ZGDALVersionInfoc               C   s   t dS )z0Return only the GDAL version number information.s   RELEASE_NAME)_version_infor   r   r   r   gdal_versionS   s    r   c               C   s   t dS )z)Return the full GDAL version information.    )r   r   r   r   r   gdal_full_versionX   s    r   c              C   sJ   t  } tjd| }|s"td|  |j \}}}t|t||oFt|fS )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minorZsubminorr   r   r   gdal_version_info]   s    r!   c             C   s   t jd|| d S )NzGDAL_ERROR %d: %s)loggererror)Zerror_classZerror_numbermessager   r   r   err_handlerl   s    r%   c             C   s   t | }||_||_|S )N)r   argtypesrestype)r   argsr'   r   r   r   r   functions   s    r)   ZCPLSetErrorHandler)*loggingr   r   ctypesr   r   r   r   ctypes.utilr   Zdjango.contrib.gis.gdal.errorr   Zdjango.core.exceptionsr   	getLoggerr"   Zdjango.confr	   ZGDAL_LIBRARY_PATHZlib_pathAttributeErrorImportErrorOSErrorZ	lib_namesr   Zlib_namejoinr   r   r   r   r   r&   r'   r   r   r!   ZGDAL_VERSIONZCPLErrorHandlerr%   r)   Zset_error_handlerr   r   r   r   <module>   sb   






	