2021-12-04 14:21:29 +00:00
|
|
|
{ lib, python3Packages }:
|
2019-08-09 19:24:08 +00:00
|
|
|
|
2021-12-04 14:21:29 +00:00
|
|
|
with python3Packages;
|
2020-05-20 10:22:47 +00:00
|
|
|
buildPythonPackage rec {
|
2019-01-24 19:50:13 +00:00
|
|
|
pname = "pre-commit";
|
2022-01-19 08:43:41 +00:00
|
|
|
version = "2.17.0";
|
2021-12-01 10:57:53 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2021-06-10 10:19:28 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2018-07-30 23:19:24 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2019-01-24 19:50:13 +00:00
|
|
|
inherit version;
|
|
|
|
pname = "pre_commit";
|
2022-01-19 08:43:41 +00:00
|
|
|
sha256 = "c1a8040ff15ad3d648c70cc3e55b93e4d2d5b687320955505587fd79bbaed06a";
|
2018-07-30 23:19:24 +00:00
|
|
|
};
|
|
|
|
|
2020-02-01 18:05:42 +00:00
|
|
|
patches = [
|
2020-05-20 20:24:52 +00:00
|
|
|
./languages-use-the-hardcoded-path-to-python-binaries.patch
|
2021-12-02 22:51:24 +00:00
|
|
|
./hook-tmpl.patch
|
2020-02-01 18:05:42 +00:00
|
|
|
];
|
|
|
|
|
2018-07-30 23:19:24 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cfgv
|
|
|
|
identify
|
|
|
|
nodeenv
|
2021-12-01 10:57:53 +00:00
|
|
|
pyyaml
|
2018-07-30 23:19:24 +00:00
|
|
|
toml
|
|
|
|
virtualenv
|
2021-12-01 10:57:53 +00:00
|
|
|
] ++ lib.optional (pythonOlder "3.8") [
|
|
|
|
importlib-metadata
|
|
|
|
] ++ lib.optional (pythonOlder "3.7") [
|
|
|
|
importlib-resources
|
|
|
|
];
|
2018-07-30 23:19:24 +00:00
|
|
|
|
2019-08-09 19:24:08 +00:00
|
|
|
# slow and impure
|
2018-07-30 23:19:24 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-02-01 18:05:42 +00:00
|
|
|
preFixup = ''
|
|
|
|
substituteInPlace $out/${python.sitePackages}/pre_commit/resources/hook-tmpl \
|
|
|
|
--subst-var-by pre-commit $out
|
2020-05-20 20:24:52 +00: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 18:05:42 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-01 10:57:53 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pre_commit"
|
|
|
|
];
|
2021-06-10 10:19:28 +00:00
|
|
|
|
2019-08-09 19:24:08 +00:00
|
|
|
meta = with lib; {
|
2018-07-30 23:19:24 +00:00
|
|
|
description = "A framework for managing and maintaining multi-language pre-commit hooks";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://pre-commit.com/";
|
2018-07-30 23:19:24 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ borisbabic ];
|
|
|
|
};
|
|
|
|
}
|