1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pytestCheckHook,
7 pythonOlder,
8
9 cython,
10 geos,
11 numpy,
12 oldest-supported-numpy,
13 setuptools,
14 wheel,
15}:
16
17buildPythonPackage rec {
18 pname = "shapely";
19 version = "2.1.1";
20 pyproject = true;
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "shapely";
25 repo = "shapely";
26 tag = version;
27 hash = "sha256-qIITlPym92wfq0byqjRxofpmYYg7vohbi1qPVEu6hRg=";
28 };
29
30 nativeBuildInputs = [
31 cython
32 geos # for geos-config
33 oldest-supported-numpy
34 setuptools
35 wheel
36 ];
37
38 buildInputs = [ geos ];
39
40 dependencies = [ numpy ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 # Fix a ModuleNotFoundError. Investigated at:
45 # https://github.com/NixOS/nixpkgs/issues/255262
46 preCheck = ''
47 cd $out
48 '';
49
50 disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
51 # FIXME(lf-): these logging tests are broken, which is definitely our
52 # fault. I've tried figuring out the cause and failed.
53 #
54 # It is apparently some sandbox or no-sandbox related thing on macOS only
55 # though.
56 "test_error_handler_exception"
57 "test_error_handler"
58 "test_info_handler"
59 ];
60
61 pythonImportsCheck = [ "shapely" ];
62
63 meta = {
64 changelog = "https://github.com/shapely/shapely/blob/${src.tag}/CHANGES.txt";
65 description = "Manipulation and analysis of geometric objects";
66 homepage = "https://github.com/shapely/shapely";
67 license = lib.licenses.bsd3;
68 teams = [ lib.teams.geospatial ];
69 };
70}