base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / bu / buku / package.nix
blob36d4000214adc8acebb2c8ba664964f2ffecdd37
1 { lib, python3, fetchFromGitHub, withServer ? false }:
3 let
4   serverRequire = with python3.pkgs; [
5     requests
6     flask
7     flask-admin
8     flask-api
9     flask-bootstrap
10     flask-paginate
11     flask-wtf
12     arrow
13     werkzeug
14     click
15     vcrpy
16     toml
17   ];
19 with python3.pkgs; buildPythonApplication rec {
20   version = "4.8";
21   pname = "buku";
22   pyproject = true;
24   src = fetchFromGitHub {
25     owner = "jarun";
26     repo = "buku";
27     rev = "v${version}";
28     sha256 = "sha256-kPVlfTYUusf5CZnKB53WZcCHo3MEnA2bLUHTRPGPn+8=";
29   };
31   nativeBuildInputs = [
32     setuptools
33   ];
35   nativeCheckInputs = [
36     hypothesis
37     pytest
38     pytest-recording
39     pyyaml
40     mypy-extensions
41     click
42     pylint
43     flake8
44     pytest-cov
45     pyyaml
46   ];
48   propagatedBuildInputs = [
49     cryptography
50     beautifulsoup4
51     certifi
52     urllib3
53     html5lib
54   ] ++ lib.optionals withServer serverRequire;
56   preCheck = ''
57     # Disables a test which requires internet
58     substituteInPlace tests/test_bukuDb.py \
59       --replace "@pytest.mark.slowtest" "@unittest.skip('skipping')" \
60       --replace "self.assertEqual(shorturl, \"http://tny.im/yt\")" "" \
61       --replace "self.assertEqual(url, \"https://www.google.com\")" ""
62     substituteInPlace setup.py \
63       --replace mypy-extensions==0.4.1 mypy-extensions>=0.4.1
64   '' + lib.optionalString (!withServer) ''
65     rm tests/test_{server,views}.py
66   '';
68   postInstall = ''
69     make install PREFIX=$out
71     mkdir -p $out/share/zsh/site-functions $out/share/bash-completion/completions $out/share/fish/vendor_completions.d
72     cp auto-completion/zsh/* $out/share/zsh/site-functions
73     cp auto-completion/bash/* $out/share/bash-completion/completions
74     cp auto-completion/fish/* $out/share/fish/vendor_completions.d
75   '' + lib.optionalString (!withServer) ''
76     rm $out/bin/bukuserver
77   '';
79   meta = with lib; {
80     description = "Private cmdline bookmark manager";
81     mainProgram = "buku";
82     homepage = "https://github.com/jarun/Buku";
83     license = licenses.gpl3;
84     platforms = platforms.unix;
85     maintainers = with maintainers; [ matthiasbeyer ];
86   };