Skip to content

Commit 4577a57

Browse files
committed
Merge 1.4.x into master
2 parents 3e15a8e + 11c0985 commit 4577a57

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

lib/matplotlib/backends/qt_compat.py

+24-8
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,37 @@
1414
QT_API_PYSIDE = 'PySide' # only supports Version 2 API
1515
QT_API_PYQT5 = 'PyQt5' # use PyQt5 API; Version 2 with module shim
1616

17-
ETS = dict(pyqt=QT_API_PYQTv2, pyside=QT_API_PYSIDE, pyqt5=QT_API_PYQT5)
18-
# If the ETS QT_API environment variable is set, use it. Note that
17+
ETS = dict(pyqt=(QT_API_PYQTv2, 4), pyside=(QT_API_PYSIDE, 4),
18+
pyqt5=(QT_API_PYQT5, 5))
19+
# ETS is a dict of env variable to (QT_API, QT_MAJOR_VERSION)
20+
# If the ETS QT_API environment variable is set, use it, but only
21+
# if the varible if of the same major QT version. Note that
1922
# ETS requires the version 2 of PyQt4, which is not the platform
2023
# default for Python 2.x.
2124

2225
QT_API_ENV = os.environ.get('QT_API')
23-
if QT_API_ENV is not None:
26+
27+
if rcParams['backend'] == 'Qt5Agg':
28+
QT_RC_MAJOR_VERSION = 5
29+
else:
30+
QT_RC_MAJOR_VERSION = 4
31+
32+
QT_API = None
33+
34+
if (QT_API_ENV is not None):
2435
try:
25-
QT_API = ETS[QT_API_ENV]
36+
QT_ENV_MAJOR_VERSION = ETS[QT_API_ENV][1]
2637
except KeyError:
2738
raise RuntimeError(
28-
'Unrecognized environment variable %r, valid values are: %r or %r' %
29-
(QT_API_ENV, 'pyqt', 'pyside', 'pyqt5'))
30-
else:
31-
# No ETS environment, so use rcParams.
39+
('Unrecognized environment variable %r, valid values are:'
40+
' %r, %r or %r' % (QT_API_ENV, 'pyqt', 'pyside', 'pyqt5')))
41+
if QT_ENV_MAJOR_VERSION == QT_RC_MAJOR_VERSION:
42+
# Only if backend and env qt major version are
43+
# compatible use the env variable.
44+
QT_API = ETS[QT_API_ENV][0]
45+
46+
if QT_API is None:
47+
# No ETS environment or incompatible so use rcParams.
3248
if rcParams['backend'] == 'Qt5Agg':
3349
QT_API = rcParams['backend.qt5']
3450
else:

matplotlibrc.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ backend : %(backend)s
475475

476476
###ANIMATION settings
477477
#animation.writer : ffmpeg # MovieWriter 'backend' to use
478-
#animation.codec : mp4 # Codec to use for writing movie
478+
#animation.codec : mpeg4 # Codec to use for writing movie
479479
#animation.bitrate: -1 # Controls size/quality tradeoff for movie.
480480
# -1 implies let utility auto-determine
481481
#animation.frame_format: 'png' # Controls frame format used by temp files

setupext.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ def __init__(self):
253253
self.set_pkgconfig_path()
254254
status, output = getstatusoutput("pkg-config --help")
255255
self.has_pkgconfig = (status == 0)
256+
if not self.has_pkgconfig:
257+
print("IMPORTANT WARNING:")
258+
print(
259+
" pkg-config is not installed.\n"
260+
" matplotlib may not be able to find some of its dependencies")
256261

257262
def set_pkgconfig_path(self):
258263
pkgconfig_path = sysconfig.get_config_var('LIBDIR')
@@ -982,19 +987,13 @@ def add_flags(self, ext):
982987
pkg_config.setup_extension(
983988
ext, 'freetype2',
984989
default_include_dirs=[
985-
'freetype2', 'lib/freetype2/include',
990+
'include/freetype2', 'freetype2',
991+
'lib/freetype2/include',
986992
'lib/freetype2/include/freetype2'],
987993
default_library_dirs=[
988994
'freetype2/lib'],
989-
default_libraries=['freetype', 'z'],
990-
alt_exec='freetype-config')
995+
default_libraries=['freetype', 'z'])
991996

992-
def get_extension(self):
993-
if sys.platform == 'win32':
994-
return None
995-
ext = make_extension('freetype2', [])
996-
self.add_flags(ext)
997-
return ext
998997

999998

1000999
class FT2Font(SetupPackage):

0 commit comments

Comments
 (0)