

def load_geos():
    try:
        from django.conf import settings
        lib_path = settings.GEOS_LIBRARY_PATH
    except (AttributeError, EnvironmentError, ImportError, ImproperlyConfigured):
        lib_path = None
    if lib_path:
        lib_names = None
    elif (os.name == 'nt'):
        lib_names = ['geos_c', 'libgeos_c-1']
    elif (os.name == 'posix'):
        lib_names = ['geos_c', 'GEOS']
    else:
        raise ImportError(('Unsupported OS "%s"' % os.name))
    if lib_names:
        for lib_name in lib_names:
            lib_path = find_library(lib_name)
            if (lib_path is not None):
                break
    if (lib_path is None):
        raise ImportError(('Could not find the GEOS library (tried "%s"). Try setting GEOS_LIBRARY_PATH in your settings.' % '", "'.join(lib_names)))
    _lgeos = CDLL(lib_path)
    _lgeos.initGEOS_r.restype = CONTEXT_PTR
    _lgeos.finishGEOS_r.argtypes = [CONTEXT_PTR]
    return _lgeos

dataset/ETHPy150Open django/django/django/contrib/gis/geos/libgeos.py load_geos/original