Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a488cbc

Browse files
committed
Merge pull request #4305 from jenshnielsen/freetypedetection
BLD : Improve error message when freetype headers are not found using python3
2 parents 5725b2c + 2c47e25 commit a488cbc

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
@@ -428,7 +428,9 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
428428
`min_version` is the minimum version required.
429429
430430
`version` will override the found version if this package
431-
requires an alternate method for that.
431+
requires an alternate method for that. Set version='unknown'
432+
if the version is not known but you still want to disabled
433+
pkg_config version check.
432434
"""
433435
if version is None:
434436
version = pkg_config.get_version(package)
@@ -442,7 +444,7 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
442444
raise CheckFailed(
443445
"Requires patches that have not been merged upstream.")
444446

445-
if min_version:
447+
if min_version and version != 'unknown':
446448
if (not is_min_version(version, min_version)):
447449
raise CheckFailed(
448450
"Requires %s %s or later. Found %s." %
@@ -895,12 +897,15 @@ def check(self):
895897
if version is None or 'No such file or directory\ngrep:' in version:
896898
version = self.version_from_header()
897899

900+
# pkg_config returns the libtool version rather than the
901+
# freetype version so we need to explicitly pass the version
902+
# to _check_for_pkg_config
898903
return self._check_for_pkg_config(
899904
'freetype2', 'ft2build.h',
900905
min_version='2.3', version=version)
901906

902907
def version_from_header(self):
903-
version = 'Failed to identify version.'
908+
version = 'unknown'
904909
ext = self.get_extension()
905910
if ext is None:
906911
return version

0 commit comments

Comments
 (0)