Skip to content

Commit

Permalink
Merge branch 'v1.4.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Aug 15, 2014
2 parents 15fd1b4 + 405c2de commit b1ebb3c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def _get_key(self, event):
key = key.lower()

mods.reverse()
return six.u('+').join(mods + [key])
return '+'.join(mods + [key])

def new_timer(self, *args, **kwargs):
"""
Expand Down
27 changes: 27 additions & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,37 @@ def check(self):
else:
version = None

# Early versions of freetype grep badly inside freetype-config,
# so catch those cases. (tested with 2.5.3).
if 'No such file or directory\ngrep:' in version:
version = self.version_from_header()

return self._check_for_pkg_config(
'freetype2', 'ft2build.h',
min_version='2.3', version=version)

def version_from_header(self):
version = 'Failed to identify version.'
ext = self.get_extension()
if ext is None:
return version
# Return the first version found in the include dirs.
for include_dir in ext.include_dirs:
header_fname = os.path.join(include_dir, 'freetype.h')
if os.path.exists(header_fname):
major, minor, patch = 0, 0, 0
with open(header_fname, 'r') as fh:
for line in fh:
if line.startswith('#define FREETYPE_'):
value = line.rsplit(' ', 1)[1].strip()
if 'MAJOR' in line:
major = value
elif 'MINOR' in line:
minor = value
else:
patch = value
return '.'.join([major, minor, patch])

def add_flags(self, ext):
pkg_config.setup_extension(
ext, 'freetype2',
Expand Down

0 comments on commit b1ebb3c

Please sign in to comment.