[reportlab-users] [PATCH] fix building on certain RHEL-derived distributions

James Brown jbrown at easypost.com
Fri Aug 26 14:57:13 EDT 2022


On some RHEL-derived Linux distributions, ft2build.h is in a different
directory (/usr/include) than the rest of the freetype headers (
/usr/include/freetype2); reportlab can't build in that configuration,
because it uses ft2build.h to determine the freetype include path.

This is a very small patch which adds the subdirectory "freetype2" in
whatever directory ft2build.h was found to the include search list, if it
exists. This shouldn't break anything, since it's added after the existing
paths.

diff -r 4f30137c136e setup.py
--- a/setup.py Wed Aug 03 13:24:40 2022 +0100
+++ b/setup.py Fri Aug 26 18:55:40 2022 +0000
@@ -12,6 +12,7 @@
 dirname = os.path.dirname
 basename = os.path.basename
 splitext = os.path.splitext
+exists = os.path.exists
 addrSize = 64 if sys.maxsize > 2**32 else 32
 sysconfig_platform = sysconfig.get_platform()

@@ -304,6 +305,9 @@
         if mif:
             d = dirname(mif)
             I = [dirname(d), d]
+            subdir = pjoin(d, 'freetype2')]
+            if exists(subdir):
+                I.append(subdir)
             ftv = freetypeVersion(findFile(d,'freetype.h'),'22')
         else:
             print('!!!!! cannot find ft2build.h')

-- 
James Brown
Infrastructure Architect @ easypost.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220826/72416a22/attachment.htm>


More information about the reportlab-users mailing list