Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pdfrw and pagelabels #69637

Merged
merged 3 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions pkgs/applications/misc/termpdf.py/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{ stdenv
, buildPythonApplication
, fetchFromGitHub
, fetchPypi
, bibtool
, pybtex
, pymupdf
, pynvim
, pyperclip
, roman
, pdfrw
, pagelabels
, setuptools
}:
teto marked this conversation as resolved.
Show resolved Hide resolved

buildPythonApplication {
pname = "termpdf.py";
version = "2019-10-03";

src = fetchFromGitHub {
owner = "dsanson";
repo = "termpdf.py";
rev = "4f3bdf4b5a00801631f2498f2c38c81e0a588ae2";
sha256 = "05gbj2fqzqndq1mx6g9asa7i6z8a9jdjrvilfwx8lg23cs356m6m";
};

propagatedBuildInputs = [
bibtool
pybtex
pymupdf
pyperclip
roman
pagelabels
pdfrw
pynvim
setuptools
];

# upstream doesn't contain tests
doCheck = false;
teto marked this conversation as resolved.
Show resolved Hide resolved

meta = with stdenv.lib; {
description = ''
A graphical pdf (and epub, cbz, ...) reader that works
inside the kitty terminal.
'';
homepage = https://github.com/dsanson/termpdf.py;
maintainers = with maintainers; [ teto ];
license = licenses.mit;
};
}
23 changes: 23 additions & 0 deletions pkgs/development/python-modules/pagelabels/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ stdenv, buildPythonPackage, fetchPypi, pdfrw }:
teto marked this conversation as resolved.
Show resolved Hide resolved

buildPythonPackage rec {
pname = "pagelabels";
version = "1.2.0";

src = fetchPypi {
inherit pname version;
sha256 = "07as5kzyvj66bfgvx8bph8gkyj6cgm4lhgxwb78bpdl4m8y8kpma";
};

buildInputs = [ pdfrw ];

teto marked this conversation as resolved.
Show resolved Hide resolved
# upstream doesn't contain tests
doCheck = false;

meta = with stdenv.lib; {
description = "Python library to manipulate PDF page labels.";
homepage = "https://github.com/lovasoa/pagelabels-py";
maintainers = with maintainers; [ teto ];
license = licenses.gpl3;
};
}
21 changes: 21 additions & 0 deletions pkgs/development/python-modules/pdfrw/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ stdenv, buildPythonPackage, fetchPypi }:

buildPythonPackage rec {
teto marked this conversation as resolved.
Show resolved Hide resolved
pname = "pdfrw";
version = "0.4";

src = fetchPypi {
inherit pname version;
sha256 = "1x1yp63lg3jxpg9igw8lh5rc51q353ifsa1bailb4qb51r54kh0d";
};

# tests require the extra download of github.com/pmaupin/static_pdfs
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the comment is true, then this should work

Suggested change
doCheck = false;
doCheck = isPy27;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out that there are even more errors with python2 so I just disabled for both as originally ( I had not tested python2 at the time)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be an attempt to run all the pure tests that you can. There will be some that you can't do in a sandbox environment, but we want to guarentee that the package wont break when your dependencies get bumped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it requires additionnal pdfs https://github.com/pmaupin/pdfrw#6testing . I think it's fine to disable them. The decision can be revisited when and if the package breaks.


meta = with stdenv.lib; {
description = "pdfrw is a pure Python library that reads and writes PDFs.";
homepage = "https://github.com/pmaupin/pdfrw";
maintainers = with maintainers; [ teto ];
license = licenses.mit;
};
}
4 changes: 3 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5711,7 +5711,7 @@ in
padthv1 = libsForQt5.callPackage ../applications/audio/padthv1 { };

page = callPackage ../tools/misc/page { };

pagmo2 = callPackage ../development/libraries/pagmo2 { };

pakcs = callPackage ../development/compilers/pakcs { };
Expand Down Expand Up @@ -25879,6 +25879,8 @@ in

prow = callPackage ../applications/networking/cluster/prow { };

termpdfpy = python3Packages.callPackage ../applications/misc/termpdf.py {};

inherit (callPackage ../applications/networking/cluster/terraform {
# terraform 0.12 crashes with go1.14 on darwin https://github.com/hashicorp/terraform/issues/24287
buildGoPackage = if stdenv.isDarwin then buildGo113Package else buildGoPackage;
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4819,6 +4819,8 @@ in {

paho-mqtt = callPackage ../development/python-modules/paho-mqtt { };

pagelabels = callPackage ../development/python-modules/pagelabels { };

pamqp = callPackage ../development/python-modules/pamqp { };

parsedatetime = callPackage ../development/python-modules/parsedatetime { };
Expand Down Expand Up @@ -4890,6 +4892,8 @@ in {

pdfkit = callPackage ../development/python-modules/pdfkit { };

pdfrw = callPackage ../development/python-modules/pdfrw { };

periodictable = callPackage ../development/python-modules/periodictable { };

pgcli = callPackage ../development/tools/database/pgcli {};
Expand Down