1{
2 lib,
3 fetchFromGitHub,
4 python3,
5}:
6
7python3.pkgs.buildPythonApplication rec {
8 pname = "castero";
9 version = "0.9.5";
10 pyproject = true;
11
12 src = fetchFromGitHub {
13 owner = "xgi";
14 repo = "castero";
15 rev = "v${version}";
16 hash = "sha256-6/7oCKBMEcQeJ8PaFP15Xef9sQRYCpigtzINv2M6GUY=";
17 };
18
19 build-system = with python3.pkgs; [
20 setuptools
21 wheel
22 ];
23
24 propagatedBuildInputs =
25 with python3.pkgs;
26 [
27 requests
28 grequests
29 cjkwrap
30 pytz
31 beautifulsoup4
32 lxml
33 mpv
34 python-vlc
35 ]
36 ++ requests.optional-dependencies.socks;
37
38 nativeCheckInputs = with python3.pkgs; [
39 pytestCheckHook
40 ];
41
42 enabledTestPaths = [
43 "tests"
44 ];
45
46 # Disable tests that are problematic with pytest
47 # Check NixOS/nixpkgs#333019 for more info about these
48 disabledTests = [
49 "test_datafile_download"
50 "test_display_get_input_str"
51 "test_display_get_y_n"
52 # > assert mymenu.metadata == episode1.metadata
53 # E AssertionError: assert '' == <MagicMock name='mock.metadata' id='140737279137104'>
54 # E + where '' = <castero.menus.episodemenu.EpisodeMenu object at 0x7ffff3acd0d0>.metadata
55 # E + and <MagicMock name='mock.metadata' id='140737279137104'> = episode1.metadata
56 "test_menu_episode_metadata"
57 ];
58
59 pythonImportsCheck = [
60 "castero"
61 ];
62
63 # Resolve configuration tests, which access $HOME
64 preCheck = ''
65 export HOME=$(mktemp -d)
66 '';
67
68 # Satisfy the python-mpv dependency, which is mpv within NixOS
69 postPatch = ''
70 substituteInPlace setup.py --replace-fail "python-mpv" "mpv"
71 '';
72
73 # VLC currently doesn't support Darwin on NixOS
74 meta = with lib; {
75 mainProgram = "castero";
76 description = "TUI podcast client for the terminal";
77 homepage = "https://github.com/xgi/castero";
78 license = licenses.mit;
79 platforms = platforms.linux;
80 maintainers = with maintainers; [ keto ];
81 };
82}