Commit 5b27c360 authored by Justin Bronn's avatar Justin Bronn
Browse files

gis: Fixed #8207; now shield 2.4 test runners from attempting to import ctypes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 56f1f1fa
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -47,9 +47,13 @@ except:
    HAS_GDAL, GEOJSON = False, False

# The envelope, error, and geomtype modules do not actually require the
#  GDAL library.
# GDAL library, but still nead at least Python 2.4 and ctypes.
PYTHON23 = sys.version_info[0] == 2 and sys.version_info[1] == 3
if not PYTHON23:
    try:
        from django.contrib.gis.gdal.envelope import Envelope
        from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException
        from django.contrib.gis.gdal.geomtype import OGRGeomType
    except ImportError:
        # No ctypes, but don't raise an exception.
        pass
+2 −3
Original line number Diff line number Diff line
@@ -214,11 +214,10 @@ if not PYTHON23 and settings.DATABASE_ENGINE == 'postgresql_psycopg2':
    # Because the PostGIS version is checked when initializing the spatial 
    # backend a `ProgrammingError` will be raised if the PostGIS tables 
    # and functions are not installed.  We catch here so it won't be raised when 
    # running the Django test suite.
    from psycopg2 import ProgrammingError
    # running the Django test suite.  `ImportError` is also possible if no ctypes.
    try:
        from django.contrib.gis.db.backend.postgis.models import GeometryColumns, SpatialRefSys
    except ProgrammingError:
    except:
        _srid_info = False
elif not PYTHON23 and settings.DATABASE_ENGINE == 'oracle':
    # Same thing as above, except the GEOS library is attempted to be loaded for