2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchPypi,
|
|
|
|
pbr,
|
|
|
|
flake8,
|
|
|
|
stestr,
|
|
|
|
ddt,
|
|
|
|
testscenarios,
|
2021-09-18 10:52:07 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "hacking";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "6.1.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-3lBqMSQDThi046acld5JjDRgvLxJwWQ9MXjRW8barBQ=";
|
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 ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ flake8 ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|