Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchPypi, 6 pytestCheckHook, 7 pythonOlder, 8 substituteAll, 9 10 cython_0, 11 geos_3_11, 12 numpy, 13 oldest-supported-numpy, 14 setuptools, 15 wheel, 16}: 17 18buildPythonPackage rec { 19 pname = "shapely"; 20 version = "1.8.5"; 21 pyproject = true; 22 23 disabled = pythonOlder "3.7"; 24 25 src = fetchPypi { 26 pname = "Shapely"; 27 inherit version; 28 hash = "sha256-6CttYOz7EkEgyI/hBqR4WWu+qxQhFtfn9ko2TayQKpI="; 29 }; 30 31 # Environment variable used in shapely/_buildcfg.py 32 GEOS_LIBRARY_PATH = "${geos_3_11}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}"; 33 34 patches = [ 35 # Patch to search form GOES .so/.dylib files in a Nix-aware way 36 (substituteAll { 37 src = ./library-paths.patch; 38 libgeos_c = GEOS_LIBRARY_PATH; 39 libc = lib.optionalString ( 40 !stdenv.isDarwin 41 ) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6"; 42 }) 43 ]; 44 45 postPatch = '' 46 substituteInPlace pyproject.toml --replace "setuptools<64" "setuptools" 47 ''; 48 49 nativeBuildInputs = [ 50 cython_0 51 geos_3_11 # for geos-config 52 oldest-supported-numpy 53 setuptools 54 wheel 55 ]; 56 57 buildInputs = [ geos_3_11 ]; 58 59 propagatedBuildInputs = [ numpy ]; 60 61 nativeCheckInputs = [ pytestCheckHook ]; 62 63 preCheck = '' 64 rm -r shapely # prevent import of local shapely 65 ''; 66 67 disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 68 # FIXME(lf-): these logging tests are broken, which is definitely our 69 # fault. I've tried figuring out the cause and failed. 70 # 71 # It is apparently some sandbox or no-sandbox related thing on macOS only 72 # though. 73 "test_error_handler_exception" 74 "test_error_handler" 75 "test_info_handler" 76 ]; 77 78 pythonImportsCheck = [ "shapely" ]; 79 80 meta = with lib; { 81 changelog = "https://github.com/shapely/shapely/blob/${version}/CHANGES.txt"; 82 description = "Manipulation and analysis of geometric objects"; 83 homepage = "https://github.com/shapely/shapely"; 84 license = licenses.bsd3; 85 maintainers = teams.geospatial.members; 86 }; 87}