Unverified Commit ed3fb39d authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

python3Packages.python-sat: update, more tests, pull from PyPI for r-ryantm updates (#443368)

parents 88c27e36 b921ac91
Loading
Loading
Loading
Loading
+29 −19
Original line number Diff line number Diff line
{
  buildPythonPackage,
  fetchFromGitHub,
  fetchPypi,
  lib,
  setuptools,
  six,
  pypblib,
  pytestCheckHook,
}:
buildPythonPackage {
buildPythonPackage rec {
  pname = "python-sat";
  version = "0.1.8.dev20";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "pysathq";
    repo = "pysat";
    rev = "d94f51e5eff2feef35abbc25480659eafa615cc0"; # upstream does not tag releases
    hash = "sha256-fKZcdEVuqpv8jWnK8Cr1UJ7szJqXivK6x3YPYHH5ccI=";
  version = "1.8.dev24";
  pyproject = true;

  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;