about summary refs log tree commit diff
path: root/pkgs/development/python-modules/smartypants/default.nix
blob: 5094287fcfafc2e77d2f3d0f887028e0b539db8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ lib
, buildPythonPackage
, python
, fetchFromGitHub
, fetchpatch2
, isPyPy
, setuptools
, docutils
, pygments
, pytestCheckHook
}:

buildPythonPackage (rec {
  version = "2.0.1";
  pname = "smartypants";

  disabled = isPyPy;

  src = fetchFromGitHub {
    owner = "leohemsted";
    repo = "smartypants.py";
    rev = "v${version}";
    sha256 = "00p1gnb9pzb3svdq3c5b9b332gsp50wrqqa39gj00m133zadanjp";
  };

  nativeCheckInputs = [
    docutils
    pygments
    pytestCheckHook
  ];

  preCheck = ''
    patchShebangs smartypants
  '';

  meta = with lib; {
    description = "Python with the SmartyPants";
    homepage = "https://github.com/leohemsted/smartypants.py";
    license = licenses.bsd3;
    maintainers = with maintainers; [ dotlambda ];
  };
}
  # FIXME: just avoiding large rebuild, we'll revert this commit
  // (if lib.versionOlder python.version "3.12" then {
    format = "setuptools";
  } else {
    pyproject = true;

    patches = [
      (fetchpatch2 {
        # https://github.com/leohemsted/smartypants.py/pull/21
        name = "smartypants-3.12-compat.patch";
        url = "https://github.com/leohemsted/smartypants.py/commit/ea46bf36343044a7a61ba3acce4a7f188d986ec5.patch";
        hash = "sha256-9lsiiZKFFKHLy7j3y9ff4gt01szY+2AHpWPAKQgKwZg=";
      })
    ];

    nativeBuildInputs = [
      setuptools
    ];
  })
)