2020-05-20 03:22:47 -07:00
|
|
|
{ lib, fetchPypi, buildPythonPackage, pythonOlder
|
2019-08-09 12:24:08 -07:00
|
|
|
, aspy-yaml
|
|
|
|
, cached-property
|
|
|
|
, cfgv
|
|
|
|
, identify
|
|
|
|
, importlib-metadata
|
|
|
|
, importlib-resources
|
2020-05-20 13:24:52 -07:00
|
|
|
, isPy27
|
2019-08-09 12:24:08 -07:00
|
|
|
, nodeenv
|
2020-02-01 10:05:42 -08:00
|
|
|
, python
|
2019-08-09 12:24:08 -07:00
|
|
|
, six
|
|
|
|
, toml
|
|
|
|
, virtualenv
|
|
|
|
}:
|
|
|
|
|
2020-05-20 03:22:47 -07:00
|
|
|
buildPythonPackage rec {
|
2019-01-24 11:50:13 -08:00
|
|
|
pname = "pre-commit";
|
2021-03-08 16:56:06 -08:00
|
|
|
version = "2.11.0";
|
2020-05-20 13:24:52 -07:00
|
|
|
disabled = isPy27;
|
2018-07-30 16:19:24 -07:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2019-01-24 11:50:13 -08:00
|
|
|
inherit version;
|
|
|
|
pname = "pre_commit";
|
2021-03-08 16:56:06 -08:00
|
|
|
sha256 = "15f1chxrbmfcajk1ngk3jvf6jjbigb5dg66wnn7phmlywaawpy06";
|
2018-07-30 16:19:24 -07:00
|
|
|
};
|
|
|
|
|
2020-02-01 10:05:42 -08:00
|
|
|
patches = [
|
|
|
|
./hook-tmpl-use-the-hardcoded-path-to-pre-commit.patch
|
2020-05-20 13:24:52 -07:00
|
|
|
./languages-use-the-hardcoded-path-to-python-binaries.patch
|
2020-02-01 10:05:42 -08:00
|
|
|
];
|
|
|
|
|
2018-07-30 16:19:24 -07:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
aspy-yaml
|
|
|
|
cached-property
|
|
|
|
cfgv
|
|
|
|
identify
|
|
|
|
nodeenv
|
|
|
|
six
|
|
|
|
toml
|
|
|
|
virtualenv
|
2020-05-20 13:24:52 -07:00
|
|
|
] ++ lib.optional (pythonOlder "3.8") importlib-metadata
|
|
|
|
++ lib.optional (pythonOlder "3.7") importlib-resources;
|
2018-07-30 16:19:24 -07:00
|
|
|
|
2019-08-09 12:24:08 -07:00
|
|
|
# slow and impure
|
2018-07-30 16:19:24 -07:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-02-01 10:05:42 -08:00
|
|
|
preFixup = ''
|
|
|
|
substituteInPlace $out/${python.sitePackages}/pre_commit/resources/hook-tmpl \
|
|
|
|
--subst-var-by pre-commit $out
|
2020-05-20 13:24:52 -07:00
|
|
|
substituteInPlace $out/${python.sitePackages}/pre_commit/languages/python.py \
|
|
|
|
--subst-var-by virtualenv ${virtualenv}
|
|
|
|
substituteInPlace $out/${python.sitePackages}/pre_commit/languages/node.py \
|
|
|
|
--subst-var-by nodeenv ${nodeenv}
|
2020-02-01 10:05:42 -08:00
|
|
|
'';
|
|
|
|
|
2019-08-09 12:24:08 -07:00
|
|
|
meta = with lib; {
|
2018-07-30 16:19:24 -07:00
|
|
|
description = "A framework for managing and maintaining multi-language pre-commit hooks";
|
2020-03-31 18:11:51 -07:00
|
|
|
homepage = "https://pre-commit.com/";
|
2018-07-30 16:19:24 -07:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ borisbabic ];
|
|
|
|
};
|
|
|
|
}
|