1{ stdenv, buildPythonPackage, fetchPypi, python, html-tidy }:
2
3buildPythonPackage rec {
4 pname = "pytidylib";
5 version = "0.3.2";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "22b1c8d75970d8064ff999c2369e98af1d0685417eda4c829a5c9f56764b0af3";
10 };
11
12 postPatch = ''
13 # Patch path to library
14 substituteInPlace tidylib/tidy.py \
15 --replace "load_library(name)" \
16 "load_library('${html-tidy}/lib/libtidy${stdenv.hostPlatform.extensions.sharedLibrary}')"
17
18 # Test fails
19 substituteInPlace tests/test_docs.py \
20 --replace " def test_large_document(self):" \
21 $' @unittest.skip("")\n def test_large_document(self):'
22 '';
23
24 checkPhase = ''
25 ${python.interpreter} -m unittest discover
26 '';
27
28 meta = with stdenv.lib; {
29 description = "Python wrapper for HTML Tidy (tidylib) on Python 2 and 3";
30 homepage = https://countergram.github.io/pytidylib/;
31 license = licenses.mit;
32 maintainers = with maintainers; [ layus ];
33 };
34}