1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, isPy27
6, rdflib
7, html5lib
8}:
9
10buildPythonPackage rec {
11 pname = "pyrdfa3";
12 version = "3.5.3";
13 disabled = isPy27;
14
15 src = fetchPypi {
16 inherit version;
17 pname = "pyRdfa3";
18 hash = "sha256-FXZjqSuH3zRbb2m94jXf9feXiRYI4S/h5PqNrWhxMa4=";
19 };
20
21 patches = [
22 (fetchpatch {
23 name = "CVE-2022-4396.patch";
24 url = "https://github.com/RDFLib/pyrdfa3/commit/ffd1d62dd50d5f4190013b39cedcdfbd81f3ce3e.patch";
25 hash = "sha256-prRrOwylYcEqKLr/8LIpyJ5Yyt+6+HTUqH5sQXU8tqc=";
26 })
27 ];
28
29 postPatch = ''
30 substituteInPlace setup.py \
31 --replace "'html = pyRdfa.rdflibparsers:StructuredDataParser'" "'html = pyRdfa.rdflibparsers:StructuredDataParser'," \
32 --replace "'hturtle = pyRdfa.rdflibparsers:HTurtleParser'" "'hturtle = pyRdfa.rdflibparsers:HTurtleParser',"
33 '';
34
35 propagatedBuildInputs = [
36 rdflib
37 html5lib
38 ];
39
40 # Does not work with python3
41 doCheck = false;
42
43 pythonImportsCheck = [ "pyRdfa" ];
44
45 meta = with lib; {
46 description = "RDFa 1.1 distiller/parser library";
47 homepage = "https://www.w3.org/2012/pyRdfa/";
48 license = licenses.w3c;
49 maintainers = with maintainers; [ ambroisie ];
50 };
51}