1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, python
6, cffi
7, pytestCheckHook
8, pythonOlder
9, ApplicationServices
10}:
11
12buildPythonPackage rec {
13 pname = "pymunk";
14 version = "6.5.2";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchPypi {
20 inherit pname version;
21 extension = "zip";
22 hash = "sha256-AV6upaZcnbKmQm9tTItRB6LpckappjdHvMH/awn/KeE=";
23 };
24
25 propagatedBuildInputs = [
26 cffi
27 ];
28
29 buildInputs = lib.optionals stdenv.isDarwin [
30 ApplicationServices
31 ];
32
33 preBuild = ''
34 ${python.pythonOnBuildForHost.interpreter} setup.py build_ext --inplace
35 '';
36
37 nativeCheckInputs = [
38 pytestCheckHook
39 ];
40
41 pytestFlagsArray = [
42 "pymunk/tests"
43 ];
44
45 pythonImportsCheck = [
46 "pymunk"
47 ];
48
49 meta = with lib; {
50 description = "2d physics library";
51 homepage = "https://www.pymunk.org";
52 changelog = "https://github.com/viblo/pymunk/releases/tag/${version}";
53 license = with licenses; [ mit ];
54 maintainers = with maintainers; [ emilytrau ];
55 platforms = platforms.unix;
56 };
57}