summary refs log tree commit diff
path: root/pkgs/development/python-modules/pypandoc/default.nix
blob: 41576c5ad1fc8d220b20b8498eaec50c97716373 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ stdenv, buildPythonPackage, fetchFromGitHub
, pandoc, haskellPackages, texlive }:

buildPythonPackage rec {
  pname = "pypandoc";
  version = "unstable-2018-06-18";

  src = fetchFromGitHub {
    owner = "bebraw";
    repo = pname;
    rev = "87912f0f17e0a71c1160008df708c876d32e5819";
    sha256 = "0l6knkxxhmni4lx8hyvbb71svnhza08ivyklqlk5fw637gznc0hx";
  };

  postPatch = ''
    # set pandoc path statically
    sed -i '/^__pandoc_path = None$/c__pandoc_path = "${pandoc}/bin/pandoc"' pypandoc/__init__.py

    # Fix tests: requires network access
    substituteInPlace tests.py --replace "pypandoc.convert(url, 'html')" "'GPL2 license'"
  '';

  preCheck = ''
    export PATH="${haskellPackages.pandoc-citeproc}/bin:${texlive.combined.scheme-small}/bin:$PATH"
  '';

  meta = with stdenv.lib; {
    description = "Thin wrapper for pandoc";
    homepage = https://github.com/bebraw/pypandoc;
    license = licenses.mit;
    maintainers = with maintainers; [ sternenseemann bennofs ];
  };
}