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

WIP pythonPackages.pypdftk: init at 0.4 #89941

Closed
wants to merge 1 commit into from

Conversation

scaredmushroom
Copy link
Contributor

Motivation for this change

Add a python wrapper for pdftk to fill out pdf forms easily.

Thinks I need help with

As this is my first python package I based this one on a copy of pypdf.
It is important to me that someone oversees this package and helps me to make it ready to merge.

  • I'm not sure if doCheck = !(isPy3k); is necessary
  • pdftk was inherited because pypdftk depends on it. Did I include it the right way?
  • the build time is quite long which confuses me
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • [ x ] NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

{ stdenv
, buildPythonPackage
, fetchPypi
#, glibcLocales
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove that comment.

Comment on lines +19 to +20
#LC_ALL = "en_US.UTF-8";
#buildInputs = [ glibcLocales ];
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this too.

Comment on lines +26 to +27
# Tests broken on Python 3.x
doCheck = !(isPy3k);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an issue upstream about this? Does pypdftk itself work with python 3?

Copy link
Member

Choose a reason for hiding this comment

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

I wanted to evaluate this for something today and used this expression as a base. I got pypdftk and the tests working in python 3, so I think these lines can be cut. There are a few leaps to getting the tests working from here, but I'm going to make a general comment on the issue with what I found so that it doesn't get hidden if/when this is marked resolved.

@abathur
Copy link
Member

abathur commented Jul 14, 2020

I wanted to evaluate pypdftk today so I gave this a try and spotted a few things. (It didn't ultimately appear to do what I needed, so I haven't given its functionality a good workout really).

  1. The pypi package at this release/version doesn't include test.py
  2. There's no corresponding tag/release on github, so I had to manually figure out which commit was equivalent. I asked at pypi release 0.4 revolunet/pypdftk#28 for a tag/release on github. They've since tagged this on GH, so if we wanted to stick to official releases we could probably use the tag and patch to disable the specific tests that fail (I don't still have this up, but IIRC it was only a couple).
  3. Pypdftk needed a little help finding pdftk. I'm not sure if I did this "right", but I had to forcibly supply it to the tests via env and add it to propagatedBuildInputs for regular use.
  4. The tests were broken at this commit/release anyways. They've been fixed in an unreleased commit (revolunet/pypdftk@fb66dcf), so if we want the tests to run we'll either need to use an unreleased commit or wait for upstream to cut a new release. (For the eagle-eyed, I'm not using this commit below. There's only 1 newer commit in master, and it didn't make much sense to me to stop 1 commit shy of current.)

I'm not sure that I've done everything correctly, either, but in case it helps move this forward, this is roughly where I ended up:

{ stdenv
, buildPythonPackage
, fetchFromGitHub
, python
, pdftk
}:

buildPythonPackage rec {
    pname = "pypdftk";
    version = "unstable-2020-05-29";

    # Using GH latest for now. Release 0.4 on pypi is:
    # - missing test.py
    # - tests were broken at this release anyways :P
    src = fetchFromGitHub {
      owner = "revolunet";
      repo = pname;
      rev = "6ddcc2efb083b6774265b7849bb5f48194fde11c";
      sha256 = "1g7dly946hm9zbsrs0w7354a5z0gi0a5agsaimbl18lbszkbmhkv";
    };

    propagatedBuildInputs = [ pdftk ];

    checkPhase = ''
      PDFTK_PATH=${pdftk}/bin/pdftk ${python.interpreter} test.py
    '';

    meta = with stdenv.lib; {
      description = "Python wrapper for PDFTK";
      homepage = "https://github.com/revolunet/pypdftk";
      license = licenses.bsd2;
      maintainers = with maintainers; [ cap ];
    };
}

@stale
Copy link

stale bot commented Jun 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2021
@Mindavi
Copy link
Contributor

Mindavi commented May 11, 2022

Triage: still interested in this?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 11, 2022
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 12, 2022
@abathur
Copy link
Member

abathur commented Sep 4, 2023

Tentatively closing. Happy to reopen if anyone objects.

@abathur abathur closed this Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants