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, pythonOlder, pytestcov
7#, optional, dependencies
8, whoosh, pytest
9, stdenv
10}:
11
12buildPythonPackage rec {
13 pname = "papis";
14 version = "0.10";
15 disabled = !isPy3k;
16
17 # Missing tests on Pypi
18 src = fetchFromGitHub {
19 owner = "papis";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "0fmrvxs6ixfwjlp96b69db7fpvyqfy2n3c23kdz8yr0vhnp82l93";
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 # pytest seems to hang with python3.8
44 doCheck = !stdenv.isDarwin && pythonOlder "3.8";
45
46 checkInputs = ([
47 pytest pytestcov
48 ]) ++ [
49 xdg_utils
50 ];
51
52 # most of the downloader tests and 4 other tests require a network connection
53 # test_export_yaml and test_citations check for the exact output produced by pyyaml 3.x and
54 # fail with 5.x
55 checkPhase = ''
56 HOME=$(mktemp -d) pytest papis tests --ignore tests/downloaders \
57 -k "not test_get_data and not test_doi_to_data and not test_general and not get_document_url \
58 and not test_validate_arxivid and not test_downloader_getter and not match"
59 '';
60
61 meta = {
62 description = "Powerful command-line document and bibliography manager";
63 homepage = "https://papis.readthedocs.io/en/latest/";
64 license = lib.licenses.gpl3;
65 maintainers = with lib.maintainers; [ nico202 teto ];
66 };
67}