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

9 views
Skip to first unread message

James Brown via reportlab-users

unread,
Aug 26, 2022, 2:57:34 PMAug 26
to reportl...@lists2.reportlab.com, James Brown
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

Robin Becker

unread,
Aug 30, 2022, 7:21:02 AMAug 30
to reportlab-users
Hi James,

I will use this patch, but I think it better to use

if isdir(subdir) instead of if exists(subdir)

The former seems to be true only if subdir is a dir or a link to a dir. The latter will try to append a file if that exists.


> diff -r 4f30137c136e setup.py
...........
>
> @@ -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')
>
..........
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
https://pairlist2.pair.net/mailman/listinfo/reportlab-users
Reply all
Reply to author
Forward
0 new messages