o 3Ûøag ã @s²ddlZddlZddlZddlmZmZmZmZddlm Z ddl m Z ddl m Z e d¡Zz ddlmZejZWneee efyIdZYnwerOdZnejdkrYgd ¢Znejd krcgd ¢Zne d ejƒ‚er{eD] Ze eƒZedurznqnedurˆe d d e¡ƒ‚eeƒZejdkr›ddlmZeeƒZdd„ZedƒZege_ ee_!dd„Z"dd„Z#dd„Z$e$ƒZ%edeeeƒZ&dd„Z'e&e'ƒZ'dd„Z(e(de&ge&ƒZ)e)e'ƒdS)éN)ÚCDLLÚ CFUNCTYPEÚc_char_pÚc_int)Ú find_library)Ú GDALException)ÚImproperlyConfiguredzdjango.contrib.gis)ÚsettingsÚnt)Úgdal302Úgdal301Úgdal300Úgdal204Úgdal203Úgdal202Úgdal201Úgdal20Úposix) ÚgdalÚGDALz gdal3.2.0z gdal3.1.0z gdal3.0.0z gdal2.4.0z gdal2.3.0z gdal2.2.0z gdal2.1.0z gdal2.0.0zGDAL 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", ")ÚWinDLLcCstjdkr t|St|S)z^ Return the correct STDCALL function for certain OSR routines on Win32 platforms. r )ÚosÚnameÚlwingdalÚlgdal)Úfunc©rúA/usr/lib/python3/dist-packages/django/contrib/gis/gdal/libgdal.pyÚstd_call@s rÚGDALVersionInfocCótdƒS)z0Return only the GDAL version number information.s RELEASE_NAME©Ú _version_inforrrrÚ gdal_versionSór#cCr )z)Return the full GDAL version information.ór!rrrrÚgdal_full_versionXr$r&cCsJtƒ}t d|¡}|std|ƒ‚| ¡\}}}t|ƒt|ƒ|o#t|ƒfS)Ns7^(?P\d+)\.(?P\d+)(?:\.(?P\d+))?z(Could not parse GDAL version string "%s")r#ÚreÚmatchrÚgroupsÚint)ÚverÚmÚmajorÚminorÚsubminorrrrÚgdal_version_info]s   r0cCst d||¡dS)NzGDAL_ERROR %d: %s)ÚloggerÚerror)Ú error_classÚ error_numberÚmessagerrrÚ err_handlerlsr6cCst|ƒ}||_||_|S)N)rÚargtypesÚrestype)rÚargsr8rrrrÚfunctionssr:ÚCPLSetErrorHandler)*Úloggingrr'ÚctypesrrrrÚ ctypes.utilrÚdjango.contrib.gis.gdal.errorrÚdjango.core.exceptionsrÚ getLoggerr1Ú django.confr ÚGDAL_LIBRARY_PATHÚlib_pathÚAttributeErrorÚ ImportErrorÚOSErrorÚ lib_namesrÚlib_nameÚjoinrrrrr"r7r8r#r&r0Ú GDAL_VERSIONÚCPLErrorHandlerr6r:Úset_error_handlerrrrrÚsf      ÿ    ÿþÿ