1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 # nativeBuildInputs
7 setuptools,
8 # nativeCheckInputs
9 pytestCheckHook,
10 # install_requires
11 appdirs,
12 beautifulsoup4,
13 cachecontrol,
14 distro,
15 feedparser,
16 packaging,
17 python-dateutil,
18 pyyaml,
19 requests,
20 tqdm,
21 urllib3,
22}:
23
24buildPythonPackage rec {
25 pname = "lastversion";
26 version = "3.5.7";
27 pyproject = true;
28
29 disabled = pythonOlder "3.6";
30
31 src = fetchFromGitHub {
32 owner = "dvershinin";
33 repo = "lastversion";
34 tag = "v${version}";
35 hash = "sha256-z3QrtnhIgXLVyaDNm0XqaVqZb05K3pq8mbweTpphdBQ=";
36 };
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 appdirs
42 beautifulsoup4
43 cachecontrol
44 distro
45 feedparser
46 packaging
47 python-dateutil
48 pyyaml
49 requests
50 tqdm
51 urllib3
52 ] ++ cachecontrol.optional-dependencies.filecache;
53
54 pythonRelaxDeps = [
55 "cachecontrol" # Use newer cachecontrol that uses filelock instead of lockfile
56 "urllib3" # The cachecontrol and requests incompatibility issue is closed
57 ];
58
59 pythonRemoveDeps = [
60 "lockfile" # "cachecontrol" now uses filelock
61 ];
62
63 nativeCheckInputs = [ pytestCheckHook ];
64
65 pytestFlags = [
66 "tests/test_cli.py"
67 "-k"
68 "test_cli_format"
69 ];
70
71 # CLI tests expect the output bin/ in PATH
72 preCheck = ''
73 PATH="$out/bin:$PATH"
74 '';
75
76 pythonImportsCheck = [ "lastversion" ];
77
78 meta = {
79 description = "Find the latest release version of an arbitrary project";
80 homepage = "https://github.com/dvershinin/lastversion";
81 changelog = "https://github.com/dvershinin/lastversion/blob/${src.tag}/CHANGELOG.md";
82 license = lib.licenses.bsd2;
83 maintainers = with lib.maintainers; [ ShamrockLee ];
84 mainProgram = "lastversion";
85 };
86}