linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / pre-commit / default.nix
blob1b5af02dca0da27c5ffe121f8f9af9985d837d91
1 { lib, fetchPypi, buildPythonPackage, pythonOlder
2 , aspy-yaml
3 , cached-property
4 , cfgv
5 , identify
6 , importlib-metadata
7 , importlib-resources
8 , isPy27
9 , nodeenv
10 , python
11 , six
12 , toml
13 , virtualenv
16 buildPythonPackage rec {
17   pname = "pre-commit";
18   version = "2.11.0";
19   disabled = isPy27;
21   src = fetchPypi {
22     inherit version;
23     pname = "pre_commit";
24     sha256 = "15f1chxrbmfcajk1ngk3jvf6jjbigb5dg66wnn7phmlywaawpy06";
25   };
27   patches = [
28     ./hook-tmpl-use-the-hardcoded-path-to-pre-commit.patch
29     ./languages-use-the-hardcoded-path-to-python-binaries.patch
30   ];
32   propagatedBuildInputs = [
33     aspy-yaml
34     cached-property
35     cfgv
36     identify
37     nodeenv
38     six
39     toml
40     virtualenv
41   ] ++ lib.optional (pythonOlder "3.8") importlib-metadata
42     ++ lib.optional (pythonOlder "3.7") importlib-resources;
44   # slow and impure
45   doCheck = false;
47   preFixup = ''
48     substituteInPlace $out/${python.sitePackages}/pre_commit/resources/hook-tmpl \
49       --subst-var-by pre-commit $out
50     substituteInPlace $out/${python.sitePackages}/pre_commit/languages/python.py \
51       --subst-var-by virtualenv ${virtualenv}
52     substituteInPlace $out/${python.sitePackages}/pre_commit/languages/node.py \
53       --subst-var-by nodeenv ${nodeenv}
54   '';
56   meta = with lib; {
57     description = "A framework for managing and maintaining multi-language pre-commit hooks";
58     homepage = "https://pre-commit.com/";
59     license = licenses.mit;
60     maintainers = with maintainers; [ borisbabic ];
61   };