2021-09-18 10:52:07 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pbr
|
|
|
|
, flake8
|
|
|
|
, stestr
|
|
|
|
, ddt
|
|
|
|
, testscenarios
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "hacking";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "6.0.1";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-YdeEb8G58m7CFnjpkHQmkJX5ZNe72M1kbrbIxML4jcE=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
sed -i 's/flake8.*/flake8/' requirements.txt
|
2022-03-30 09:31:56 +00:00
|
|
|
substituteInPlace hacking/checks/python23.py \
|
|
|
|
--replace 'H236: class Foo(object):\n __metaclass__ = \' 'Okay: class Foo(object):\n __metaclass__ = \'
|
|
|
|
substituteInPlace hacking/checks/except_checks.py \
|
|
|
|
--replace 'H201: except:' 'Okay: except:'
|
2021-09-18 10:52:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pbr ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
flake8
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
ddt
|
|
|
|
stestr
|
|
|
|
testscenarios
|
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
2022-09-09 14:08:57 +00:00
|
|
|
# tries to trigger flake8 and fails
|
|
|
|
rm hacking/tests/test_doctest.py
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
stestr run
|
2021-09-18 10:52:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "hacking" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "OpenStack Hacking Guideline Enforcement";
|
|
|
|
homepage = "https://github.com/openstack/hacking";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = teams.openstack.members;
|
|
|
|
};
|
|
|
|
}
|