1{ lib
2, buildPythonPackage
3, fetchpatch
4, fetchPypi
5, hopcroftkarp
6, multiset
7, pytest
8, pytest-runner
9, hypothesis
10, setuptools-scm
11, isPy27
12}:
13
14buildPythonPackage rec {
15 pname = "matchpy";
16 version = "0.5.1";
17 disabled = isPy27;
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "1vvf1cd9kw5z1mzvypc9f030nd18lgvvjc8j56b1s9b7dyslli2r";
22 };
23
24 patches = [
25 # Fix tests for pytest 4. Remove with the next release
26 (fetchpatch {
27 url = "https://github.com/HPAC/matchpy/commit/b405a2717a7793d58c47b2e2197d9d00c06fb13c.patch";
28 includes = [ "tests/conftest.py" ];
29 sha256 = "1b6gqf2vy9qxg384nqr9k8il335afhbdmlyx4vhd8r8rqpv7gax9";
30 })
31 ];
32
33 postPatch = ''
34 substituteInPlace setup.cfg \
35 --replace "hypothesis>=3.6,<4.0" "hypothesis" \
36 --replace "pytest>=3.0,<4.0" "pytest"
37 '';
38
39 buildInputs = [ setuptools-scm pytest-runner ];
40 checkInputs = [ pytest hypothesis ];
41 propagatedBuildInputs = [ hopcroftkarp multiset ];
42
43 meta = with lib; {
44 description = "A library for pattern matching on symbolic expressions";
45 homepage = "https://github.com/HPAC/matchpy";
46 license = licenses.mit;
47 maintainers = [ maintainers.costrouc ];
48 };
49}