diff --git a/pkgs/development/python-modules/filetype/default.nix b/pkgs/development/python-modules/filetype/default.nix new file mode 100644 index 000000000000..e47c007b9678 --- /dev/null +++ b/pkgs/development/python-modules/filetype/default.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, python +}: + +buildPythonPackage rec { + pname = "filetype"; + version = "1.0.2"; + + # No tests in PyPI tarball + # See https://github.com/h2non/filetype.py/pull/33 + src = fetchFromGitHub { + owner = "h2non"; + repo = "filetype.py"; + rev = "v${version}"; + sha256 = "000gl3q2cadfnmqnbxg31ppc3ak8blzb4nfn75faxbp7b6r5qgr2"; + }; + + checkPhase = '' + ${python.interpreter} -m unittest discover + ''; + + meta = with lib; { + description = "Infer file type and MIME type of any file/buffer"; + homepage = https://github.com/h2non/filetype.py; + license = licenses.mit; + maintainers = with maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/development/python-modules/isbnlib/default.nix b/pkgs/development/python-modules/isbnlib/default.nix new file mode 100644 index 000000000000..1d16265242a9 --- /dev/null +++ b/pkgs/development/python-modules/isbnlib/default.nix @@ -0,0 +1,35 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, nose +, coverage +}: + +buildPythonPackage rec { + pname = "isbnlib"; + version = "3.9.4"; + + # PyPI tarball is missing LICENSE file + # See https://github.com/xlcnd/isbnlib/pull/53 + src = fetchFromGitHub { + owner = "xlcnd"; + repo = "isbnlib"; + rev = "v${version}"; + sha256 = "0gc0k5khf34b4zz56a9zc3rscdhj3bx849lbzgmzpji30sbyy1fh"; + }; + + checkInputs = [ + nose + coverage + ]; + + # requires network connection + doCheck = false; + + meta = with lib; { + description = "Extract, clean, transform, hyphenate and metadata for ISBNs"; + homepage = https://github.com/xlcnd/isbnlib; + license = licenses.lgpl3; + maintainers = with maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/tools/misc/papis/default.nix b/pkgs/tools/misc/papis/default.nix index 52e704eb52e1..8bccfccfeabf 100644 --- a/pkgs/tools/misc/papis/default.nix +++ b/pkgs/tools/misc/papis/default.nix @@ -1,52 +1,52 @@ -{ lib, fetchFromGitHub, bashInteractive -, python3, vim +{ lib, fetchFromGitHub, fetchpatch +, python36, xdg_utils }: -let - python = python3; - -in python.pkgs.buildPythonApplication rec { +python36.pkgs.buildPythonApplication rec { pname = "papis"; - version = "0.6"; + version = "0.7.5"; # Missing tests on Pypi src = fetchFromGitHub { owner = "papis"; repo = pname; rev = "v${version}"; - sha256 = "0zy8q154zhpqb75c775nwq3mdl1szhzhkfi0nvyjmzfgsv2g1wa2"; + sha256 = "1b481sj92z9nw7gwbrpkgd4nlmqc1n73qilkc51k2r56cy1kjvss"; }; - postPatch = '' - sed -i 's/configparser>=3.0.0/# configparser>=3.0.0/' setup.py - patchShebangs tests - ''; + # Update click version to 7.0.0 + patches = fetchpatch { + url = https://github.com/papis/papis/commit/fddb80978a37a229300b604c26e992e2dc90913f.patch; + sha256 = "0cmagfdaaml1pxhnxggifpb47z5g1p231qywnvnqpd3dm93382w1"; + }; - propagatedBuildInputs = with python.pkgs; [ - argcomplete arxiv2bib beautifulsoup4 bibtexparser - configparser dmenu-python habanero papis-python-rofi - pylibgen prompt_toolkit pyparser python_magic pyyaml - requests unidecode urwid vobject tkinter whoosh - vim + propagatedBuildInputs = with python36.pkgs; [ + click requests filetype pyparsing configparser + arxiv2bib pyyaml chardet beautifulsoup4 prompt_toolkit + bibtexparser python-slugify pyparser pylibgen + habanero isbnlib + # optional dependencies + dmenu-python whoosh ]; - checkInputs = with python.pkgs; [ pytest ]; - - # Papis tries to create the config folder under $HOME during the tests - checkPhase = '' - mkdir -p check-phase - export PATH=$out/bin:$PATH - # Still don't know why this fails - sed -i 's/--set dir=hello //' tests/bash/test_default.sh - - # This test has been disabled since it requires a network connaction - sed -i 's/test_downloader_getter(self):/disabled_test_downloader_getter(self):/' papis/downloaders/tests/test_main.py - - export HOME=$(pwd)/check-phase - make test - SH=${bashInteractive}/bin/bash make test-non-pythonic + postInstall = '' + install -Dt "$out/etc/bash_completion.d" scripts/shell_completion/build/bash/papis ''; + checkInputs = (with python36.pkgs; [ + pytest + ]) ++ [ + xdg_utils + ]; + + # most of the downloader tests require a network connection + checkPhase = '' + HOME=$(mktemp -d) pytest papis tests --ignore tests/downloaders + ''; + + # FIXME: find out why 39 tests fail + doCheck = false; + meta = { description = "Powerful command-line document and bibliography manager"; homepage = http://papis.readthedocs.io/en/latest/; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ac3f6b64712e..5c0d3849b762 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15729,7 +15729,7 @@ in papirus-icon-theme = callPackage ../data/icons/papirus-icon-theme { }; - papis = python3Packages.callPackage ../tools/misc/papis { }; + papis = callPackage ../tools/misc/papis { }; pecita = callPackage ../data/fonts/pecita {}; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 41fc79cc9f2f..63d3e962b236 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1747,6 +1747,8 @@ in { fb-re2 = callPackage ../development/python-modules/fb-re2 { }; + filetype = callPackage ../development/python-modules/filetype { }; + flexmock = callPackage ../development/python-modules/flexmock { }; flit = callPackage ../development/python-modules/flit { }; @@ -1881,6 +1883,8 @@ in { ipfsapi = callPackage ../development/python-modules/ipfsapi { }; + isbnlib = callPackage ../development/python-modules/isbnlib { }; + itsdangerous = callPackage ../development/python-modules/itsdangerous { }; iniparse = callPackage ../development/python-modules/iniparse { };