summary refs log tree commit diff
path: root/pkgs/tools/misc/pubs/default.nix
blob: c9ab32035de4a061800271e33b714b8b552e7a2c (plain) (blame)
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
{ stdenv, fetchFromGitHub, python3 }:

let
  python3Packages = (python3.override {
    packageOverrides = self: super: {
      # https://github.com/pubs/pubs/issues/131
      pyfakefs = super.pyfakefs.overridePythonAttrs (oldAttrs: rec {
        version = "3.3";
        src = self.fetchPypi {
          pname = "pyfakefs";
          inherit version;
          sha256 = "e3e198dea5e0d5627b73ba113fd0b139bb417da6bc15d920b2c873143d2f12a6";
        };
        postPatch = "";
        doCheck = false;
      });
    };
  }).pkgs;

in python3Packages.buildPythonApplication rec {
  pname = "pubs";
  version = "0.7.0";

  src = fetchFromGitHub {
    owner = "pubs";
    repo = "pubs";
    rev = "v${version}";
    sha256 = "0n5wbjx9wqy6smfg625mhma739jyg7c92766biaiffp0a2bzr475";
  };

  propagatedBuildInputs = with python3Packages; [
    dateutil configobj bibtexparser pyyaml requests beautifulsoup4
  ];

  checkInputs = with python3Packages; [ pyfakefs ddt ];

  preCheck = ''
    # API tests require networking
    rm tests/test_apis.py

    # pyfakefs works weirdly in the sandbox
    export HOME=/
  '';

  meta = with stdenv.lib; {
    description = "Command-line bibliography manager";
    homepage = https://github.com/pubs/pubs;
    license = licenses.lgpl3;
    maintainers = with maintainers; [ gebner ];
  };
}