Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def __init__(self):
self.set_pkgconfig_path()
status, output = getstatusoutput("pkg-config --help")
self.has_pkgconfig = (status == 0)
if not self.has_pkgconfig:
print("IMPORTANT WARNING:")
print(
" pkg-config is not installed.\n"
" matplotlib may not be able to find some of its dependencies")

def set_pkgconfig_path(self):
pkgconfig_path = sysconfig.get_config_var('LIBDIR')
Expand Down Expand Up @@ -981,19 +986,13 @@ def add_flags(self, ext):
pkg_config.setup_extension(
ext, 'freetype2',
default_include_dirs=[
'freetype2', 'lib/freetype2/include',
'include/freetype2', 'freetype2',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to get rid of the alt_exec?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the crux of the fix here. At least on my system, the result from freetype-config --cflags is totally and utterly wrong (-I/freetype2), so better to use pkg-config and, failing that, fall back to the regular default locations. I suspect this was the source of all of the problems that led to the #3067 solution in the first place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I identified the main fix as adding more guesses to the default path.

'lib/freetype2/include',
'lib/freetype2/include/freetype2'],
default_library_dirs=[
'freetype2/lib'],
default_libraries=['freetype', 'z'],
alt_exec='freetype-config')
default_libraries=['freetype', 'z'])

def get_extension(self):
if sys.platform == 'win32':
return None
ext = make_extension('freetype2', [])
self.add_flags(ext)
return ext


class FT2Font(SetupPackage):
Expand Down