summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ca/castero/package.nix
blob: 288963cad6ce0ec3f448291f73844e7ec775a382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
  lib,
  fetchFromGitHub,
  python3,
}:

python3.pkgs.buildPythonApplication (finalAttrs: {
  pname = "castero";
  version = "0.9.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "xgi";
    repo = "castero";
    rev = "v${finalAttrs.version}";
    hash = "sha256-6/7oCKBMEcQeJ8PaFP15Xef9sQRYCpigtzINv2M6GUY=";
  };

  build-system = with python3.pkgs; [
    setuptools
    wheel
  ];

  propagatedBuildInputs =
    with python3.pkgs;
    [
      requests
      grequests
      cjkwrap
      pytz
      beautifulsoup4
      lxml
      mpv
      python-vlc
    ]
    ++ requests.optional-dependencies.socks;

  nativeCheckInputs = with python3.pkgs; [
    pytestCheckHook
  ];

  enabledTestPaths = [
    "tests"
  ];

  # Disable tests that are problematic with pytest
  # Check NixOS/nixpkgs#333019 for more info about these
  disabledTests = [
    "test_datafile_download"
    "test_display_get_input_str"
    "test_display_get_y_n"
    # > assert mymenu.metadata == episode1.metadata
    # E AssertionError: assert '' == <MagicMock name='mock.metadata' id='140737279137104'>
    # E  +  where '' = <castero.menus.episodemenu.EpisodeMenu object at 0x7ffff3acd0d0>.metadata
    # E  +  and   <MagicMock name='mock.metadata' id='140737279137104'> = episode1.metadata
    "test_menu_episode_metadata"
    # flaky: segfaults on Hydra when a background DB reload thread races the test
    "test_perspective_downloaded_draw_metadata"
  ];

  pythonImportsCheck = [
    "castero"
  ];

  # Resolve configuration tests, which access $HOME
  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  # Satisfy the python-mpv dependency, which is mpv within NixOS
  postPatch = ''
    substituteInPlace setup.py --replace-fail "python-mpv" "mpv"
  '';

  # VLC currently doesn't support Darwin on NixOS
  meta = {
    mainProgram = "castero";
    description = "TUI podcast client for the terminal";
    homepage = "https://github.com/xgi/castero";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ keto ];
  };
})