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