1{ lib
2, buildPythonPackage
3, fetchPypi
4, freetype
5, pillow
6, glibcLocales
7, python
8, isPyPy
9}:
10
11let
12 ft = freetype.overrideAttrs (oldArgs: { dontDisableStatic = true; });
13in buildPythonPackage rec {
14 pname = "reportlab";
15 version = "3.6.11";
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "sha256-BPxEIPBUiBXQYj4DHIah9/PzAD5pnZr3FIdC4tcrAko=";
20 };
21
22 patches = [
23 ./darwin-m1-compat.patch
24 ];
25
26 checkInputs = [ glibcLocales ];
27
28 buildInputs = [ ft pillow ];
29
30 postPatch = ''
31 substituteInPlace setup.py \
32 --replace "mif = findFile(d,'ft2build.h')" "mif = findFile('${lib.getDev ft}','ft2build.h')"
33
34 # Remove all the test files that require access to the internet to pass.
35 rm tests/test_lib_utils.py
36 rm tests/test_platypus_general.py
37 rm tests/test_platypus_images.py
38
39 # Remove the tests that require Vera fonts installed
40 rm tests/test_graphics_render.py
41 rm tests/test_graphics_charts.py
42 '';
43
44 checkPhase = ''
45 cd tests
46 LC_ALL="en_US.UTF-8" ${python.interpreter} runAll.py
47 '';
48
49 # See https://bitbucket.org/pypy/compatibility/wiki/reportlab%20toolkit
50 disabled = isPyPy;
51
52 meta = {
53 description = "An Open Source Python library for generating PDFs and graphics";
54 homepage = "http://www.reportlab.com/";
55 };
56}