summary refs log tree commit diff
path: root/pkgs/development/python-modules/shapely/library-paths.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/shapely/library-paths.patch')
-rw-r--r--pkgs/development/python-modules/shapely/library-paths.patch72
1 files changed, 49 insertions, 23 deletions
diff --git a/pkgs/development/python-modules/shapely/library-paths.patch b/pkgs/development/python-modules/shapely/library-paths.patch
index d55630be9c1..484af67ef68 100644
--- a/pkgs/development/python-modules/shapely/library-paths.patch
+++ b/pkgs/development/python-modules/shapely/library-paths.patch
@@ -1,8 +1,8 @@
 diff --git a/shapely/geos.py b/shapely/geos.py
-index 4619732..1abdb5e 100644
+index 13ab835..1abdb5e 100644
 --- a/shapely/geos.py
 +++ b/shapely/geos.py
-@@ -55,148 +55,21 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
+@@ -55,174 +55,21 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
              "Could not find lib {} or load any of its variants {}.".format(
                  libname, fallbacks or []))
  
@@ -61,16 +61,23 @@ index 4619732..1abdb5e 100644
 -
 -elif sys.platform == 'darwin':
 -    # Test to see if we have a delocated wheel with a GEOS dylib.
--    geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
--        __file__), '.dylibs/libgeos_c.1.dylib'))
+-    dylib_path = os.path.abspath(
+-        os.path.join(os.path.dirname(__file__), ".dylibs/*.dylib")
+-    )
+-    LOG.debug("Formed path for globbing: dylib_path=%r", dylib_path)
+-
+-    geos_whl_dylib = glob.glob(dylib_path)
+-    LOG.debug("Globbed: geos_whl_dylib=%r", geos_whl_dylib)
 -
--    if os.path.exists(geos_whl_dylib):
+-    if len(geos_whl_dylib) > 0:
 -        handle = CDLL(None)
 -        if hasattr(handle, "initGEOS_r"):
 -            LOG.debug("GEOS already loaded")
 -            _lgeos = handle
 -        else:
--            _lgeos = CDLL(geos_whl_dylib)
+-            geos_whl_dylib = sorted(geos_whl_dylib)
+-            CDLL(geos_whl_dylib[0])
+-            _lgeos = CDLL(geos_whl_dylib[-1])
 -            LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
 -
 -    elif exists_conda_env():
@@ -112,25 +119,44 @@ index 4619732..1abdb5e 100644
 -elif sys.platform == 'win32':
 -    _conda_dll_path = os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll')
 -    if exists_conda_env() and os.path.exists(_conda_dll_path):
--        # conda package.
 -        _lgeos = CDLL(_conda_dll_path)
 -    else:
--        try:
--            egg_dlls = os.path.abspath(
--                os.path.join(os.path.dirname(__file__), 'DLLs'))
--            if hasattr(sys, '_MEIPASS'):
--                wininst_dlls = sys._MEIPASS
--            elif hasattr(sys, "frozen"):
--                wininst_dlls = os.path.normpath(
--                    os.path.abspath(sys.executable + '../../DLLS'))
--            else:
--                wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
--            original_path = os.environ['PATH']
--            os.environ['PATH'] = "%s;%s;%s" % \
--                (egg_dlls, wininst_dlls, original_path)
--            _lgeos = load_dll("geos_c.dll")
--        except (ImportError, WindowsError, OSError):
--            raise
+-        geos_whl_dll = glob.glob(
+-            os.path.abspath(
+-                os.path.join(
+-                    os.path.dirname(__file__), "..", "Shapely.libs", "geos*.dll"
+-                )
+-            )
+-        )
+-
+-        if len(geos_whl_dll) > 0:
+-            geos_whl_dll = sorted(geos_whl_dll)
+-            # CDLL(geos_whl_so[0])
+-            _lgeos = CDLL(geos_whl_dll[-1])
+-            LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
+-        else:
+-            try:
+-                egg_dlls = os.path.abspath(
+-                    os.path.join(os.path.dirname(__file__), "DLLs")
+-                )
+-                if hasattr(sys, "_MEIPASS"):
+-                    wininst_dlls = sys._MEIPASS
+-                elif hasattr(sys, "frozen"):
+-                    wininst_dlls = os.path.normpath(
+-                        os.path.abspath(sys.executable + "../../DLLS")
+-                    )
+-                else:
+-                    wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
+-                original_path = os.environ["PATH"]
+-                os.environ["PATH"] = "%s;%s;%s" % (
+-                    egg_dlls,
+-                    wininst_dlls,
+-                    original_path,
+-                )
+-                _lgeos = load_dll("geos_c.dll")
+-
+-            except (ImportError, WindowsError, OSError):
+-                raise
 -
 -        def free(m):
 -            try: