1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, isPyPy
6, flask
7, pyquery
8, pytest
9, pytest-runner
10, cairosvg
11, tinycss
12, cssselect
13, lxml
14}:
15
16buildPythonPackage rec {
17 pname = "pygal";
18 version = "2.4.0";
19
20 doCheck = !isPyPy; # one check fails with pypy
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "9204f05380b02a8a32f9bf99d310b51aa2a932cba5b369f7a4dc3705f0a4ce83";
25 };
26 patches = [
27 # Fixes compatibility with latest pytest. October 12, 2020.
28 # Should be included in the next release after 2.4.0
29 (fetchpatch {
30 url = "https://github.com/Kozea/pygal/commit/19e5399be18a054b3b293f4a8a2777d2df4f9c18.patch";
31 sha256 = "1j0hpcvd2mhi449wmlr0ml9gw4cakqk3av1j79bi2qy86dyrss2l";
32 })
33 ];
34
35 buildInputs = [
36 flask
37 pyquery
38
39 # Should be a check input, but upstream lists it under "setup_requires".
40 # https://github.com/Kozea/pygal/issues/430
41 pytest-runner
42 ];
43
44 checkInputs = [
45 pytest
46 ];
47
48 preCheck = ''
49 # necessary on darwin to pass the testsuite
50 export LANG=en_US.UTF-8
51 '';
52
53 postPatch = ''
54 substituteInPlace setup.cfg --replace "[pytest]" "[tool:pytest]"
55 '';
56
57 propagatedBuildInputs = [ cairosvg tinycss cssselect ]
58 ++ lib.optionals (!isPyPy) [ lxml ];
59
60 meta = with lib; {
61 description = "Sexy and simple python charting";
62 homepage = "http://www.pygal.org";
63 license = licenses.lgpl3Plus;
64 maintainers = with maintainers; [ sjourdois ];
65 };
66
67}