1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, isPy27 5, isPy38 6, isPy39 7, pythonAtLeast 8, flake8 9, six 10, python 11}: 12 13buildPythonPackage rec { 14 pname = "flake8-future-import"; 15 version = "0.4.7"; 16 17 # PyPI tarball doesn't include the test suite 18 src = fetchFromGitHub { 19 owner = "xZise"; 20 repo = "flake8-future-import"; 21 rev = "refs/tags/${version}"; 22 hash = "sha256-2EcCOx3+PCk9LYpQjHCFNpQVI2Pdi+lWL8R6bNadFe0="; 23 }; 24 25 patches = lib.optionals (pythonAtLeast "3.10") [ 26 ./fix-annotations-version-11.patch 27 ] ++ lib.optionals (isPy38 || isPy39) [ 28 ./fix-annotations-version-10.patch 29 ] ++ lib.optionals isPy27 [ 30 # Upstream disables this test case naturally on python 3, but it also fails 31 # inside NixPkgs for python 2. Since it's going to be deleted, we just skip it 32 # on py2 as well. 33 ./skip-test.patch 34 ]; 35 36 postPatch = '' 37 substituteInPlace "test_flake8_future_import.py" \ 38 --replace "'flake8'" "'${lib.getExe flake8}'" 39 ''; 40 41 propagatedBuildInputs = [ flake8 ]; 42 43 nativeCheckInputs = [ six ]; 44 45 checkPhase = '' 46 runHook preCheck 47 48 ${python.interpreter} -m test_flake8_future_import 49 50 runHook postCheck 51 ''; 52 53 meta = with lib; { 54 description = "A flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base"; 55 homepage = "https://github.com/xZise/flake8-future-import"; 56 license = licenses.mit; 57 }; 58}