1{
2 lib,
3 appdirs,
4 buildPythonPackage,
5 cachelib,
6 colorama,
7 cssselect,
8 fetchFromGitHub,
9 fetchpatch,
10 keep,
11 lxml,
12 pygments,
13 pyquery,
14 requests,
15 rich,
16 pytestCheckHook,
17 pythonOlder,
18 setuptools,
19}:
20
21buildPythonPackage rec {
22 pname = "howdoi";
23 version = "2.0.20";
24 pyproject = true;
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "gleitz";
30 repo = "howdoi";
31 tag = "v${version}";
32 hash = "sha256-u0k+h7Sp2t/JUnfPqRzDpEA+vNXB7CpyZ/SRvk+B9t0=";
33 };
34
35 patches = [
36 # Bad test case fix: comparing hardcoded string to internet search result
37 # PR merged: https://github.com/gleitz/howdoi/pull/497
38 # Please remove on the next release
39 (fetchpatch {
40 url = "https://github.com/gleitz/howdoi/commit/7d24e9e1c87811a6e66d60f504381383cf1ac3fd.patch";
41 hash = "sha256-AFQMnMEijaExqiimbNaVeIRmZJ4Yj0nGUOEjfsvBLh8=";
42 })
43 ];
44
45 build-system = [ setuptools ];
46
47 dependencies = [
48 appdirs
49 cachelib
50 colorama
51 cssselect
52 keep
53 lxml
54 pygments
55 pyquery
56 requests
57 rich
58 ];
59
60 nativeCheckInputs = [ pytestCheckHook ];
61
62 preCheck = ''
63 export HOME=$(mktemp -d)
64 '';
65
66 disabledTests = [
67 "test_colorize"
68 # Tests are flaky, OSError: [Errno 24] Too many open files happens
69 "test_answer_links_using_l_option"
70 "test_answers_bing"
71 "test_answers"
72 "test_json_output"
73 "test_missing_pre_or_code_query"
74 "test_multiple_answers"
75 "test_position"
76 "test_unicode_answer"
77 ];
78
79 pythonImportsCheck = [ "howdoi" ];
80
81 meta = with lib; {
82 description = "Instant coding answers via the command line";
83 homepage = "https://github.com/gleitz/howdoi";
84 changelog = "https://github.com/gleitz/howdoi/blob/v${version}/CHANGES.txt";
85 license = licenses.mit;
86 maintainers = [ ];
87 };
88}