From c7129fbe8e1482616bae8ae79efc7f1f7710c004 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 15 Oct 2020 01:48:59 +0200 Subject: [PATCH] pythonPackages.flake8-future-import: fix build Was broken after python3.8 upgraded to 3.8.6 due to this change: bpo-41314: Changed the release when from future import annotations becomes the default from 4.0 to 3.10 (following a change in PEP 563). --- .../python-modules/flake8-future-import/default.nix | 5 +++-- .../fix-annotations-version.patch | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/flake8-future-import/fix-annotations-version.patch diff --git a/pkgs/development/python-modules/flake8-future-import/default.nix b/pkgs/development/python-modules/flake8-future-import/default.nix index e819422c572..661b7c71c33 100644 --- a/pkgs/development/python-modules/flake8-future-import/default.nix +++ b/pkgs/development/python-modules/flake8-future-import/default.nix @@ -1,4 +1,4 @@ -{ lib, isPy27, fetchFromGitHub, buildPythonPackage, pythonOlder, fetchpatch, flake8, importlib-metadata, six }: +{ lib, isPy27, isPy38, fetchFromGitHub, buildPythonPackage, pythonOlder, fetchpatch, flake8, importlib-metadata, six }: buildPythonPackage rec { pname = "flake8-future-import"; @@ -20,7 +20,8 @@ buildPythonPackage rec { # 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. - patches = lib.optionals isPy27 [ ./skip-test.patch ]; + patches = lib.optionals isPy38 [ ./fix-annotations-version.patch ] + ++ lib.optionals isPy27 [ ./skip-test.patch ]; meta = with lib; { description = "A flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base"; diff --git a/pkgs/development/python-modules/flake8-future-import/fix-annotations-version.patch b/pkgs/development/python-modules/flake8-future-import/fix-annotations-version.patch new file mode 100644 index 00000000000..2e3062c8ac4 --- /dev/null +++ b/pkgs/development/python-modules/flake8-future-import/fix-annotations-version.patch @@ -0,0 +1,13 @@ +diff --git a/flake8_future_import.py b/flake8_future_import.py +index 92c3fda..27a1a66 100755 +--- a/flake8_future_import.py ++++ b/flake8_future_import.py +@@ -76,7 +76,7 @@ UNICODE_LITERALS = Feature(4, 'unicode_literals', (2, 6, 0), (3, 0, 0)) + GENERATOR_STOP = Feature(5, 'generator_stop', (3, 5, 0), (3, 7, 0)) + NESTED_SCOPES = Feature(6, 'nested_scopes', (2, 1, 0), (2, 2, 0)) + GENERATORS = Feature(7, 'generators', (2, 2, 0), (2, 3, 0)) +-ANNOTATIONS = Feature(8, 'annotations', (3, 7, 0), (4, 0, 0)) ++ANNOTATIONS = Feature(8, 'annotations', (3, 7, 0), (3, 10, 0)) + + + # Order important as it defines the error code