about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pybox2d/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pybox2d/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pybox2d/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pybox2d/default.nix b/nixpkgs/pkgs/development/python-modules/pybox2d/default.nix
new file mode 100644
index 000000000000..c7a8e7d83ebf
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pybox2d/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, swig
+}:
+
+buildPythonPackage rec {
+  pname = "pybox2d";
+  version = "2.3.10";
+  format = "setuptools";
+
+  src = fetchFromGitHub {
+    owner = "pybox2d";
+    repo = "pybox2d";
+    rev = "refs/tags/${version}";
+    hash = "sha256-yjLFvsg8GQLxjN1vtZM9zl+kAmD4+eS/vzRkpj0SCjY=";
+  };
+
+  nativeBuildInputs = [
+    swig
+  ];
+
+  # We need to build the package explicitly a first time so that the library/Box2D/Box2D.py file
+  # gets generated.
+  # After that, the default behavior will succeed at installing the package.
+  preBuild = ''
+    python setup.py build
+  '';
+
+  pythonImportsCheck = [
+    "Box2D"
+    "Box2D._Box2D"
+  ];
+
+  # Tests need to start GUI windows.
+  doCheck = false;
+
+  meta = with lib; {
+    description = "2D Game Physics for Python";
+    homepage = "https://github.com/pybox2d/pybox2d";
+    license = licenses.zlib;
+    maintainers = with maintainers; [ GaetanLepage ];
+  };
+}