15 |
import os |
import os |
16 |
import os.path |
import os.path |
17 |
import weakref |
import weakref |
18 |
|
import traceback |
19 |
|
|
20 |
import Thuban |
import Thuban |
21 |
from Thuban import _ |
from Thuban import _ |
33 |
|
|
34 |
PROJ_EXT = ".proj" |
PROJ_EXT = ".proj" |
35 |
|
|
36 |
has_gdal_support = lambda: False |
# Determine the status of GDAL support. If GDAL is supported |
37 |
try: |
# gdal_support_status will be set to the empty string, otherwise to a |
38 |
# first try to see if our extension module is there. if it |
# string with information why it isn't supported |
39 |
# wasn't even compiled, we obviously don't have gdal support. |
# |
40 |
import gdalwarp |
# GDAL is supported if we can import both the thuban specific gdalwarp |
41 |
|
# module and the GDAL python bindings. |
42 |
# now try to import the python extension. if this doesn't |
for _module in ("gdalwarp", "gdal"): |
43 |
# exist then we can't do anything. |
try: |
44 |
import gdal |
__import__(_module) |
45 |
|
except ImportError, val: |
46 |
"""Return True if the gdal library is available.""" |
gdal_support_status = (_("No GDAL support because module '%s'" |
47 |
has_gdal_support = lambda: True |
" cannot be imported. Python exception: '%s'") |
48 |
except ImportError: |
% (_module, str(val))) |
49 |
pass |
break |
50 |
|
else: |
51 |
|
gdal_support_status = "" |
52 |
|
|
53 |
|
def has_gdal_support(): |
54 |
|
return gdal_support_status == "" |
55 |
|
|
56 |
|
|
57 |
projfile_cache = weakref.WeakValueDictionary() |
projfile_cache = weakref.WeakValueDictionary() |
58 |
|
|