From 18e1e2424fb10cb13bcbd2b2d1d986700912e35c Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 6 May 2020 20:44:55 -0500 Subject: py-shapely: fix unit tests (#16500) --- var/spack/repos/builtin/packages/py-shapely/package.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-shapely/package.py b/var/spack/repos/builtin/packages/py-shapely/package.py index a6b2e8ceee..a25e4d214f 100644 --- a/var/spack/repos/builtin/packages/py-shapely/package.py +++ b/var/spack/repos/builtin/packages/py-shapely/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import sys class PyShapely(PythonPackage): @@ -38,7 +39,8 @@ class PyShapely(PythonPackage): # https://github.com/Toblerity/Shapely/pull/891 patch('https://github.com/Toblerity/Shapely/commit/98f6b36710bbe05b4ab59231cb0e08b06fe8b69c.patch', - sha256='4984cd0590beb5091f213948a953f70cea08ea11c5db1de07ba98c19e3d13f06') + sha256='4984cd0590beb5091f213948a953f70cea08ea11c5db1de07ba98c19e3d13f06', + when='@:1.7') @when('^python@3.7:') def patch(self): @@ -53,7 +55,14 @@ class PyShapely(PythonPackage): env.set('GEOS_CONFIG', join_path(self.spec['geos'].prefix.bin, 'geos-config')) + # Shapely uses ctypes.util.find_library, which searches LD_LIBRARY_PATH + # Our RPATH logic works fine, but the unit tests fail without this + # https://github.com/Toblerity/Shapely/issues/909 + libs = ':'.join(self.spec['geos'].libs.directories) + if sys.platform == 'darwin': + env.prepend_path('DYLD_FALLBACK_LIBRARY_PATH', libs) + else: + env.prepend_path('LD_LIBRARY_PATH', libs) + def test(self): - # Tests fail when 'geos' library not found in usual search directories - # python('-m', 'pytest') - pass + python('-m', 'pytest') -- cgit v1.2.3-70-g09d2