nixpkgs/pkgs/development/python-modules/pre-commit/default.nix

64 lines
1.5 KiB
Nix
Raw Normal View History

{ lib, fetchPypi, buildPythonPackage, pythonOlder
, aspy-yaml
, cached-property
, cfgv
, futures
, identify
, importlib-metadata
, importlib-resources
2020-05-20 20:24:52 +00:00
, isPy27
, nodeenv
, python
, six
, toml
, virtualenv
}:
buildPythonPackage rec {
pname = "pre-commit";
2020-07-06 23:41:57 +00:00
version = "2.6.0";
2020-05-20 20:24:52 +00:00
disabled = isPy27;
2018-07-30 23:19:24 +00:00
src = fetchPypi {
inherit version;
pname = "pre_commit";
2020-07-06 23:41:57 +00:00
sha256 = "05d9635v0yzrj2848m2hn9axbvds0dymv49rlyj238v3vlzncmqn";
2018-07-30 23:19:24 +00:00
};
patches = [
./hook-tmpl-use-the-hardcoded-path-to-pre-commit.patch
2020-05-20 20:24:52 +00:00
./languages-use-the-hardcoded-path-to-python-binaries.patch
];
2018-07-30 23:19:24 +00:00
propagatedBuildInputs = [
aspy-yaml
cached-property
cfgv
identify
nodeenv
six
toml
virtualenv
2020-05-20 20:24:52 +00:00
] ++ lib.optional (pythonOlder "3.8") importlib-metadata
++ lib.optional (pythonOlder "3.7") importlib-resources;
2018-07-30 23:19:24 +00:00
# slow and impure
2018-07-30 23:19:24 +00:00
doCheck = false;
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}
'';
meta = with lib; {
2018-07-30 23:19:24 +00:00
description = "A framework for managing and maintaining multi-language pre-commit hooks";
homepage = "https://pre-commit.com/";
2018-07-30 23:19:24 +00:00
license = licenses.mit;
maintainers = with maintainers; [ borisbabic ];
};
}