2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
isPy27,
|
|
|
|
isPy38,
|
|
|
|
isPy39,
|
|
|
|
pythonAtLeast,
|
2024-09-19 14:19:46 +00:00
|
|
|
setuptools,
|
2024-06-05 15:53:02 +00:00
|
|
|
flake8,
|
|
|
|
six,
|
|
|
|
python,
|
2021-07-21 07:28:18 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "flake8-future-import";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "0.4.7";
|
2024-09-19 14:19:46 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# PyPI tarball doesn't include the test suite
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xZise";
|
|
|
|
repo = "flake8-future-import";
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-2EcCOx3+PCk9LYpQjHCFNpQVI2Pdi+lWL8R6bNadFe0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches =
|
|
|
|
lib.optionals (pythonAtLeast "3.10") [ ./fix-annotations-version-11.patch ]
|
|
|
|
++ lib.optionals (isPy38 || isPy39) [ ./fix-annotations-version-10.patch ]
|
|
|
|
++ lib.optionals isPy27 [
|
|
|
|
# Upstream disables this test case naturally on python 3, but it also fails
|
|
|
|
# inside NixPkgs for python 2. Since it's going to be deleted, we just skip it
|
|
|
|
# on py2 as well.
|
|
|
|
./skip-test.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "test_flake8_future_import.py" \
|
2024-09-19 14:19:46 +00:00
|
|
|
--replace-fail "'flake8'" "'${lib.getExe flake8}'"
|
2023-05-24 13:37:59 +00:00
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [ setuptools ];
|
|
|
|
|
|
|
|
dependencies = [ flake8 ];
|
2021-07-21 07:28:18 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ six ];
|
2021-07-21 07:28:18 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2023-05-24 13:37:59 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
${python.interpreter} -m test_flake8_future_import
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2021-07-21 07:28:18 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/xZise/flake8-future-import";
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|