diff --git a/pkgs/development/python-modules/python-sat/default.nix b/pkgs/development/python-modules/python-sat/default.nix index 8b6e8716a56b..4624eb5cb6ef 100644 --- a/pkgs/development/python-modules/python-sat/default.nix +++ b/pkgs/development/python-modules/python-sat/default.nix @@ -1,30 +1,27 @@ { buildPythonPackage, - fetchFromGitHub, + fetchPypi, lib, + setuptools, six, pypblib, pytestCheckHook, }: -buildPythonPackage { +buildPythonPackage rec { pname = "python-sat"; - version = "0.1.8.dev20"; - format = "setuptools"; + version = "1.8.dev24"; + pyproject = true; - src = fetchFromGitHub { - owner = "pysathq"; - repo = "pysat"; - rev = "d94f51e5eff2feef35abbc25480659eafa615cc0"; # upstream does not tag releases - hash = "sha256-fKZcdEVuqpv8jWnK8Cr1UJ7szJqXivK6x3YPYHH5ccI="; + build-system = [ setuptools ]; + + src = fetchPypi { + inherit version; + pname = "python_sat"; + hash = "sha256-f9NnaPcHdNNInWTvpkg91ieaYejJ29kAAOLcbnbDmM0="; }; - # Build SAT solver backends in parallel and fix hard-coded g++ reference for - # darwin, where stdenv uses clang - postPatch = '' - substituteInPlace solvers/prepare.py \ - --replace-fail "&& make &&" "&& make -j$NIX_BUILD_CORES &&" - substituteInPlace solvers/patches/glucose421.patch \ - --replace-fail "+CXX := g++" "+CXX := c++" + preBuild = '' + export MAKEFLAGS="-j$NIX_BUILD_CORES" ''; propagatedBuildInputs = [ @@ -32,12 +29,25 @@ buildPythonPackage { pypblib ]; + pythonImportsCheck = [ + "pysat" + "pysat.examples" + "pysat.allies" + ]; + nativeCheckInputs = [ pytestCheckHook ]; - disabledTestPaths = [ "tests/test_unique_mus.py" ]; + # Due to `python -m pytest` appending the local directory to `PYTHONPATH`, + # importing `pysat.examples` in the tests fails. Removing the `pysat` + # directory fixes since then only the installed version in `$out` is + # imported, which has `pysat.examples` correctly installed. + # See https://github.com/NixOS/nixpkgs/issues/255262 + preCheck = '' + rm -r pysat + ''; meta = with lib; { - description = "Toolkit to provide interface for various SAT (without optional dependancy py-aiger-cnf)"; + description = "Toolkit for SAT-based prototyping in Python (without optional dependencies)"; homepage = "https://github.com/pysathq/pysat"; changelog = "https://pysathq.github.io/updates/"; license = licenses.mit;