1{ lib, buildPythonPackage, fetchFromGitHub, xdg_utils
2, requests, filetype, pyparsing, configparser, arxiv2bib
3, pyyaml, chardet, beautifulsoup4, colorama, bibtexparser
4, pylibgen, click, python-slugify, habanero, isbnlib
5, prompt_toolkit, pygments, stevedore, tqdm, lxml
6, python-doi, isPy3k, pythonOlder
7#, optional, dependencies
8, whoosh, pytest
9, stdenv
10}:
11
12buildPythonPackage rec {
13 pname = "papis";
14 version = "0.9";
15 disabled = !isPy3k;
16
17 # Missing tests on Pypi
18 src = fetchFromGitHub {
19 owner = "papis";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "kzA8nlglbjHDPEB7HRAY2dza1Umn/OYUu+ydbA1OJ5Y=";
23 };
24
25 propagatedBuildInputs = [
26 requests filetype pyparsing configparser arxiv2bib
27 pyyaml chardet beautifulsoup4 colorama bibtexparser
28 pylibgen click python-slugify habanero isbnlib
29 prompt_toolkit pygments
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 "python-slugify>=1.2.6,<4" "python-slugify"
40 '';
41
42 # pytest seems to hang with python3.8
43 doCheck = !stdenv.isDarwin && pythonOlder "3.8";
44
45 checkInputs = ([
46 pytest
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"
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}