1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5
6 # build-system
7 hatchling,
8
9 # tests
10 pytestCheckHook,
11 wcag-contrast-ratio,
12 pythonOlder
13}:
14
15let
16 pygments = buildPythonPackage rec {
17 pname = "pygments";
18 version = "2.18.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8"; # 2.18.0 requirement
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-eG/4AvMukTEb/ziJ9umoboFQX+mfJzW7bWCuDFAE8Zk=";
26 };
27
28 nativeBuildInputs = [ hatchling ];
29
30 # circular dependencies if enabled by default
31 doCheck = false;
32
33 nativeCheckInputs = [
34 pytestCheckHook
35 wcag-contrast-ratio
36 ];
37
38 disabledTestPaths = [
39 # 5 lines diff, including one nix store path in 20000+ lines
40 "tests/examplefiles/bash/ltmain.sh"
41 ];
42
43 pythonImportsCheck = [ "pygments" ];
44
45 passthru.tests = {
46 check = pygments.overridePythonAttrs (_: {
47 doCheck = true;
48 });
49 };
50
51 meta = {
52 changelog = "https://github.com/pygments/pygments/releases/tag/${version}";
53 homepage = "https://pygments.org/";
54 description = "Generic syntax highlighter";
55 mainProgram = "pygmentize";
56 license = lib.licenses.bsd2;
57 maintainers = with lib.maintainers; [ sigmanificient ];
58 };
59 };
60in
61pygments