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 ]
53 ++ cachecontrol.optional-dependencies.filecache;
54
55 pythonRelaxDeps = [
56 "cachecontrol" # Use newer cachecontrol that uses filelock instead of lockfile
57 "urllib3" # The cachecontrol and requests incompatibility issue is closed
58 ];
59
60 pythonRemoveDeps = [
61 "lockfile" # "cachecontrol" now uses filelock
62 ];
63
64 nativeCheckInputs = [ pytestCheckHook ];
65
66 enabledTestPaths = [
67 "tests/test_cli.py"
68 ];
69
70 enabledTests = [
71 "test_cli_format"
72 ];
73
74 # CLI tests expect the output bin/ in PATH
75 preCheck = ''
76 PATH="$out/bin:$PATH"
77 '';
78
79 pythonImportsCheck = [ "lastversion" ];
80
81 meta = {
82 description = "Find the latest release version of an arbitrary project";
83 homepage = "https://github.com/dvershinin/lastversion";
84 changelog = "https://github.com/dvershinin/lastversion/blob/${src.tag}/CHANGELOG.md";
85 license = lib.licenses.bsd2;
86 maintainers = with lib.maintainers; [ ShamrockLee ];
87 mainProgram = "lastversion";
88 };
89}