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.13";
16
17 src = fetchPypi {
18 inherit pname version;
19 hash = "sha256-b3XTP3o3IM9HNxq2PO0PDr0a622xk4aukviXegm+lhE=";
20 };
21
22 patches = [
23 ./darwin-m1-compat.patch
24 ];
25
26 nativeCheckInputs = [ glibcLocales ];
27
28 buildInputs = [ ft ];
29 propagatedBuildInputs = [ pillow ];
30
31 postPatch = ''
32 substituteInPlace setup.py \
33 --replace "mif = findFile(d,'ft2build.h')" "mif = findFile('${lib.getDev ft}','ft2build.h')"
34
35 # Remove all the test files that require access to the internet to pass.
36 rm tests/test_lib_utils.py
37 rm tests/test_platypus_general.py
38 rm tests/test_platypus_images.py
39
40 # Remove the tests that require Vera fonts installed
41 rm tests/test_graphics_render.py
42 rm tests/test_graphics_charts.py
43 '';
44
45 checkPhase = ''
46 cd tests
47 LC_ALL="en_US.UTF-8" ${python.interpreter} runAll.py
48 '';
49
50 # See https://bitbucket.org/pypy/compatibility/wiki/reportlab%20toolkit
51 disabled = isPyPy;
52
53 meta = {
54 description = "An Open Source Python library for generating PDFs and graphics";
55 homepage = "http://www.reportlab.com/";
56 };
57}