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