vim-vint: fix

+57 -15
+29 -15
pkgs/by-name/vi/vim-vint/package.nix
··· 2 lib, 3 python3Packages, 4 fetchFromGitHub, 5 }: 6 7 python3Packages.buildPythonApplication rec { ··· 16 hash = "sha256-A0yXDkB/b9kEEXSoLeqVdmdm4p2PYL2QHqbF4FgAn30="; 17 }; 18 19 build-system = with python3Packages; [ setuptools ]; 20 21 dependencies = with python3Packages; [ 22 ansicolor 23 chardet 24 pyyaml 25 - setuptools # pkg_resources is imported during runtime 26 ]; 27 28 - nativeCheckInputs = with python3Packages; [ 29 pytestCheckHook 30 pytest-cov-stub 31 - ]; 32 - 33 - preCheck = '' 34 - substituteInPlace \ 35 - test/acceptance/test_cli.py \ 36 - test/acceptance/test_cli_vital.py \ 37 - --replace-fail \ 38 - "cmd = ['bin/vint'" \ 39 - "cmd = ['$out/bin/vint'" 40 - ''; 41 42 - meta = with lib; { 43 description = "Fast and Highly Extensible Vim script Language Lint implemented by Python"; 44 homepage = "https://github.com/Kuniwak/vint"; 45 - license = licenses.mit; 46 mainProgram = "vint"; 47 maintainers = [ ]; 48 - platforms = platforms.all; 49 }; 50 }
··· 2 lib, 3 python3Packages, 4 fetchFromGitHub, 5 + replaceVars, 6 + versionCheckHook, 7 }: 8 9 python3Packages.buildPythonApplication rec { ··· 18 hash = "sha256-A0yXDkB/b9kEEXSoLeqVdmdm4p2PYL2QHqbF4FgAn30="; 19 }; 20 21 + patches = [ 22 + # Otherwise, the following warning appears each time the binary is run: 23 + # UserWarning: pkg_resources is deprecated as an API. 24 + # This leads the `test/acceptance/test_cli.py::TestCLI::*` tests to fail 25 + (replaceVars ./remove-pkg-resources.patch { 26 + inherit version; 27 + }) 28 + ]; 29 + 30 + postPatch = '' 31 + substituteInPlace \ 32 + test/acceptance/test_cli.py \ 33 + test/acceptance/test_cli_vital.py \ 34 + --replace-fail \ 35 + "cmd = ['bin/vint'" \ 36 + "cmd = ['$out/bin/vint'" 37 + ''; 38 + 39 build-system = with python3Packages; [ setuptools ]; 40 41 dependencies = with python3Packages; [ 42 ansicolor 43 chardet 44 pyyaml 45 ]; 46 47 + nativeCheckInputs = [ 48 + versionCheckHook 49 + ] 50 + ++ (with python3Packages; [ 51 pytestCheckHook 52 pytest-cov-stub 53 + ]); 54 + versionCheckProgramArg = "--version"; 55 56 + meta = { 57 description = "Fast and Highly Extensible Vim script Language Lint implemented by Python"; 58 homepage = "https://github.com/Kuniwak/vint"; 59 + license = lib.licenses.mit; 60 mainProgram = "vint"; 61 maintainers = [ ]; 62 + platforms = lib.platforms.all; 63 }; 64 }
+28
pkgs/by-name/vi/vim-vint/remove-pkg-resources.patch
···
··· 1 + diff --git a/vint/linting/cli.py b/vint/linting/cli.py 2 + index 55db52e..97f33e1 100644 3 + --- a/vint/linting/cli.py 4 + +++ b/vint/linting/cli.py 5 + @@ -1,7 +1,6 @@ 6 + import sys 7 + from argparse import ArgumentParser 8 + from pathlib import PosixPath 9 + -import pkg_resources 10 + import logging 11 + 12 + from vint.linting.linter import Linter 13 + @@ -150,14 +149,7 @@ class CLI(object): 14 + 15 + 16 + def _get_version(self): 17 + - # In unit tests, pkg_resources cannot find vim-vint. 18 + - # So, I decided to return dummy version 19 + - try: 20 + - version = pkg_resources.require('vim-vint')[0].version 21 + - except pkg_resources.DistributionNotFound: 22 + - version = 'test_mode' 23 + - 24 + - return version 25 + + return "@version@" 26 + 27 + 28 + def _adjust_log_level(self, env):