8000 Merge pull request #4305 from jenshnielsen/freetypedetection · matplotlib/matplotlib@f918227 · GitHub
[go: up one dir, main page]

Skip to content

Commit f918227

Browse files
committed
Merge pull request #4305 from jenshnielsen/freetypedetection
BLD : Improve error message when freetype headers are not found using python3
1 parent 016f568 commit f918227

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

setupext.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
427427
`min_version` is the minimum version required.
428428
429429
`version` will override the found version if this package
430-
requires an alternate method for that.
430+
requires an alternate method for that. Set version='unknown'
431+
if the version is not known but you still want to disabled
432+
pkg_config version check.
431433
"""
432434
if version is None:
433435
version = pkg_config.get_version(package)
@@ -441,7 +443,7 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
441443
raise CheckFailed(
442444
"Requires patches that have not been merged upstream.")
443445

444-
if min_version:
446+
if min_version and version != 'unknown':
445447
if (not is_min_version(version, min_version)):
446448
raise CheckFailed(
447449
"Requires %s %s or later. Found %s." %
@@ -956,12 +958,15 @@ def check(self):
956958
if version is None or 'No such file or directory\ngrep:' in version:
957959
version = self.version_from_header()
958960

961+
# pkg_config returns the libtool version rather than the
962+
# freetype version so we need to explicitly pass the version
963+
# to _check_for_pkg_config
959964
return self._check_for_pkg_config(
960965
'freetype2', 'ft2build.h',
961966
min_version='2.3', version=version)
962967

963968
def version_from_header(self):
964-
version = 'Failed to identify version.'
969+
version = 'unknown'
965970
ext = self.get_extension()
966971
if ext is None:
967972
return version

0 commit comments

Comments
 (0)
0