1{ lib, buildPythonPackage, fetchFromGitHub, xdg-utils
2, requests, filetype, pyparsing, configparser, arxiv2bib
3, pyyaml, chardet, beautifulsoup4, colorama, bibtexparser
4, click, python-slugify, habanero, isbnlib, typing-extensions
5, prompt-toolkit, pygments, stevedore, tqdm, lxml
6, python-doi, isPy3k, pytest-cov
7#, optional, dependencies
8, whoosh, pytest
9, stdenv
10}:
11
12buildPythonPackage rec {
13 pname = "papis";
14 version = "0.11.1";
15 disabled = !isPy3k;
16
17 # Missing tests on Pypi
18 src = fetchFromGitHub {
19 owner = "papis";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "0bbkjyw1fsvvp0380l404h2lys8ib4xqga5s6401k1y1hld28nl6";
23 };
24
25 propagatedBuildInputs = [
26 requests filetype pyparsing configparser arxiv2bib
27 pyyaml chardet beautifulsoup4 colorama bibtexparser
28 click python-slugify habanero isbnlib
29 prompt-toolkit pygments typing-extensions
30 stevedore tqdm lxml
31 python-doi
32 # optional dependencies
33 whoosh
34 ];
35
36 postPatch = ''
37 substituteInPlace setup.py \
38 --replace "lxml<=4.3.5" "lxml~=4.3" \
39 --replace "isbnlib>=3.9.1,<3.10" "isbnlib~=3.9" \
40 --replace "python-slugify>=1.2.6,<4" "python-slugify"
41 '';
42
43 doCheck = !stdenv.isDarwin;
44
45 checkInputs = ([
46 pytest pytest-cov
47 ]) ++ [
48 xdg-utils
49 ];
50
51 # most of the downloader tests and 4 other tests require a network connection
52 # test_export_yaml and test_citations check for the exact output produced by pyyaml 3.x and
53 # fail with 5.x
54 checkPhase = ''
55 HOME=$(mktemp -d) pytest papis tests --ignore tests/downloaders \
56 -k "not test_get_data and not test_doi_to_data and not test_general and not get_document_url \
57 and not test_validate_arxivid and not test_downloader_getter and not match"
58 '';
59
60 meta = {
61 description = "Powerful command-line document and bibliography manager";
62 homepage = "https://papis.readthedocs.io/en/latest/";
63 license = lib.licenses.gpl3;
64 maintainers = with lib.maintainers; [ nico202 teto ];
65 };
66}