Skip to content

Commit 0bf9e36

Browse files
committed
Remove logic for optionally building Agg and TkAgg.
They are actually not optional (that's the `force = True` setting which overrides the OptionalBackendPackage logic), so just make them SetupPackages and remove the corresponding (outdated) comments in setup.cfg.template.
1 parent 63d96d2 commit 0bf9e36

File tree

2 files changed

+17
-50
lines changed

2 files changed

+17
-50
lines changed

setup.cfg.template

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Rename this file to setup.cfg to modify Matplotlib's
2-
# build options.
1+
# Rename this file to setup.cfg to modify Matplotlib's build options.
32

43
[egg_info]
54

@@ -24,25 +23,10 @@
2423
#sample_data = True
2524

2625
[gui_support]
27-
# Matplotlib supports multiple GUI toolkits, including
28-
# GTK3, MacOSX, Qt4, Qt5, Tk, and WX. Support for many of
29-
# these toolkits requires AGG, the Anti-Grain Geometry library,
30-
# which is provided by Matplotlib and built by default.
31-
#
32-
# Some backends are written in pure Python, and others require
33-
# extension code to be compiled. By default, Matplotlib checks for
34-
# these GUI toolkits during installation and, if present, compiles the
35-
# required extensions to support the toolkit.
36-
#
37-
# - Tk support requires Tk development headers and Tkinter.
38-
# - Mac OSX backend requires the Cocoa headers included with XCode.
39-
#
40-
# The other GUI toolkits do not require any extension code, and can be
41-
# used as long as the libraries are installed on your system --
42-
# therefore they are installed unconditionally.
43-
#
44-
# You can uncomment any the following lines to change this
45-
# behavior. Acceptable values are:
26+
# Matplotlib supports multiple GUI toolkits, known as backends.
27+
# The Mac OSX backend requires the Cocoa headers included with XCode.
28+
# You can select whether to build it by uncommenting the following line.
29+
# Acceptable values are:
4630
#
4731
# True: build the extension. Exits with a warning if the
4832
# required dependencies are not available
@@ -51,18 +35,16 @@
5135
# otherwise skip silently. This is the default
5236
# behavior
5337
#
54-
#agg = auto
5538
#macosx = auto
56-
#tkagg = auto
5739

5840
[rc_options]
5941
# User-configurable options
6042
#
6143
# Default backend, one of: Agg, Cairo, GTK3Agg, GTK3Cairo, MacOSX, Pdf, Ps,
6244
# Qt4Agg, Qt5Agg, SVG, TkAgg, WX, WXAgg.
6345
#
64-
# The Agg, Ps, Pdf and SVG backends do not require external dependencies. Do
65-
# not choose MacOSX, or TkAgg if you have disabled the relevant extension
66-
# modules. The default is determined by fallback.
46+
# The Agg, Ps, Pdf and SVG backends do not require external dependencies. Do
47+
# not choose MacOSX if you have disabled the relevant extension modules. The
48+
# default is determined by fallback.
6749
#
6850
#backend = Agg

setupext.py

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ def do_custom_build(self):
319319

320320
class OptionalPackage(SetupPackage):
321321
optional = True
322-
force = False
323322
config_category = "packages"
324323
default_config = "auto"
325324

@@ -345,26 +344,13 @@ def check(self):
345344
346345
May be overridden by subclasses for additional checks.
347346
"""
348-
# Check configuration file
349-
conf = self.get_config()
350-
# Default "auto" state or install forced by user
351-
if conf in [True, 'auto']:
352-
# Set non-optional if user sets `True` in config
353-
if conf is True:
347+
conf = self.get_config() # Check configuration file
348+
if conf in [True, 'auto']: # Default "auto", or install forced by user
349+
if conf is True: # Set non-optional if user sets `True` in config
354350
self.optional = False
355351
return "installing"
356-
# Configuration opt-out by user
357-
else:
358-
# Some backend extensions (e.g. Agg) need to be built for certain
359-
# other GUI backends (e.g. TkAgg) even when manually disabled
360-
if self.force is True:
361-
return "installing forced (config override)"
362-
else:
363-
raise CheckFailed("skipping due to configuration")
364-
365-
366-
class OptionalBackendPackage(OptionalPackage):
367-
config_category = "gui_support"
352+
else: # Configuration opt-out by user
353+
raise CheckFailed("skipping due to configuration")
368354

369355

370356
class Platform(SetupPackage):
@@ -750,9 +736,8 @@ def get_extension(self):
750736
return ext
751737

752738

753-
class BackendAgg(OptionalBackendPackage):
739+
class BackendAgg(SetupPackage):
754740
name = "agg"
755-
force = True
756741

757742
def get_extension(self):
758743
sources = [
@@ -768,9 +753,8 @@ def get_extension(self):
768753
return ext
769754

770755

771-
class BackendTkAgg(OptionalBackendPackage):
756+
class BackendTkAgg(SetupPackage):
772757
name = "tkagg"
773-
force = True
774758

775759
def check(self):
776760
return "installing; run-time loading from Python Tcl/Tk"
@@ -798,7 +782,8 @@ def add_flags(self, ext):
798782
ext.libraries.extend(['dl'])
799783

800784

801-
class BackendMacOSX(OptionalBackendPackage):
785+
class BackendMacOSX(OptionalPackage):
786+
config_category = 'gui_support'
802787
name = 'macosx'
803788

804789
def check(self):

0 commit comments

Comments
 (0)