Changeset 8012 for django/branches/gis/django/contrib/gis/gdal
- Timestamp:
- 07/20/08 16:30:46 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/gdal/libgdal.py
r7127 r8012 7 7 try: 8 8 from django.conf import settings 9 lib_ name= settings.GDAL_LIBRARY_PATH9 lib_path = settings.GDAL_LIBRARY_PATH 10 10 except (AttributeError, EnvironmentError, ImportError): 11 lib_ name= None11 lib_path = None 12 12 13 if lib_ name:14 pass13 if lib_path: 14 lib_names = None 15 15 elif os.name == 'nt': 16 16 # Windows NT shared library 17 lib_name = 'gdal15.dll'17 lib_names = ['gdal15'] 18 18 elif os.name == 'posix': 19 platform = os.uname()[0] 20 if platform == 'Darwin': 21 # Mac OSX shared library 22 lib_name = 'libgdal.dylib' 23 else: 24 # Attempting to use .so extension for all other platforms. 25 lib_name = 'libgdal.so' 19 # *NIX library names. 20 lib_names = ['gdal', 'gdal1.5.0'] 26 21 else: 27 22 raise OGRException('Unsupported OS "%s"' % os.name) 28 23 24 # Using the ctypes `find_library` utility to find the 25 # path to the GDAL library from the list of library names. 26 if lib_names: 27 for lib_name in lib_names: 28 lib_path = find_library(lib_name) 29 if not lib_path is None: break 30 31 if lib_path is None: 32 raise OGRException('Could not find the GDAL library (tried "%s"). ' 33 'Try setting GDAL_LIBRARY_PATH in your settings.' % 34 '", "'.join(lib_names)) 35 29 36 # This loads the GDAL/OGR C library 30 lgdal = CDLL(lib_ name)37 lgdal = CDLL(lib_path) 31 38 32 39 # On Windows, the GDAL binaries have some OSR routines exported with
