1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 hopcroftkarp,
7 multiset,
8 pytestCheckHook,
9 hypothesis,
10 setuptools-scm,
11 isPy27,
12}:
13
14buildPythonPackage rec {
15 pname = "matchpy";
16 version = "0.5.5"; # Don't upgrade to 4.3.1, this tag is very old
17 format = "setuptools";
18 disabled = isPy27;
19
20 src = fetchFromGitHub {
21 owner = "HPAC";
22 repo = "matchpy";
23 rev = version;
24 hash = "sha256-n5rXIjqVQZzEbfIZVQiGLh2PR1DHAJ9gumcrbvwnasA=";
25 };
26
27 patches = [
28 # https://github.com/HPAC/matchpy/pull/77
29 (fetchpatch {
30 name = "fix-versioneer-py312.patch";
31 url = "https://github.com/HPAC/matchpy/commit/965d7c39689b9f2473a78ed06b83f2be701e234d.patch";
32 hash = "sha256-xXADCSIhq1ARny2twzrhR1J8LkMFWFl6tmGxrM8RvkU=";
33 })
34 ];
35
36 postPatch = ''
37 sed -i '/pytest-runner/d' setup.cfg
38
39 substituteInPlace setup.cfg \
40 --replace "multiset>=2.0,<3.0" "multiset"
41 '';
42
43 nativeBuildInputs = [ setuptools-scm ];
44
45 propagatedBuildInputs = [
46 hopcroftkarp
47 multiset
48 ];
49
50 nativeCheckInputs = [
51 pytestCheckHook
52 hypothesis
53 ];
54
55 pythonImportsCheck = [ "matchpy" ];
56
57 meta = with lib; {
58 description = "Library for pattern matching on symbolic expressions";
59 homepage = "https://github.com/HPAC/matchpy";
60 license = licenses.mit;
61 maintainers = [ ];
62 };
63}