Skip to content

Commit ac3d800

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 7422347 commit ac3d800

File tree

2 files changed

+15
-50
lines changed

2 files changed

+15
-50
lines changed

setup.cfg.template

+4-21
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,10 @@
2424
#sample_data = True
2525

2626
[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:
27+
# Matplotlib supports multiple GUI toolkits, known as backends.
28+
# The Mac OSX backend requires the Cocoa headers included with XCode.
29+
# You can select whether to build it by uncommenting the following line.
30+
# Acceptable values are:
4631
#
4732
# True: build the extension. Exits with a warning if the
4833
# required dependencies are not available
@@ -51,9 +36,7 @@
5136
# otherwise skip silently. This is the default
5237
# behavior
5338
#
54-
#agg = auto
5539
#macosx = auto
56-
#tkagg = auto
5740

5841
[rc_options]
5942
# User-configurable options

setupext.py

+11-29
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ def _try_managers(*managers):
411411

412412
class OptionalPackage(SetupPackage):
413413
optional = True
414-
force = False
415414
config_category = "packages"
416415
default_config = "auto"
417416

@@ -437,26 +436,13 @@ def check(self):
437436
438437
May be overridden by subclasses for additional checks.
439438
"""
440-
# Check configuration file
441-
conf = self.get_config()
442-
# Default "auto" state or install forced by user
443-
if conf in [True, 'auto']:
444-
# Set non-optional if user sets `True` in config
445-
if conf is True:
439+
conf = self.get_config() # Check configuration file
440+
if conf in [True, 'auto']: # Default "auto", or install forced by user
441+
if conf is True: # Set non-optional if user sets `True` in config
446442
self.optional = False
447443
return "installing"
448-
# Configuration opt-out by user
449-
else:
450-
# Some backend extensions (e.g. Agg) need to be built for certain
451-
# other GUI backends (e.g. TkAgg) even when manually disabled
452-
if self.force is True:
453-
return "installing forced (config override)"
454-
else:
455-
raise CheckFailed("skipping due to configuration")
456-
457-
458-
class OptionalBackendPackage(OptionalPackage):
459-
config_category = "gui_support"
444+
else: # Configuration opt-out by user
445+
raise CheckFailed("skipping due to configuration")
460446

461447

462448
class Platform(SetupPackage):
@@ -871,9 +857,8 @@ def get_extension(self):
871857
return ext
872858

873859

874-
class BackendAgg(OptionalBackendPackage):
860+
class BackendAgg(SetupPackage):
875861
name = "agg"
876-
force = True
877862

878863
def get_extension(self):
879864
sources = [
@@ -889,9 +874,8 @@ def get_extension(self):
889874
return ext
890875

891876

892-
class BackendTkAgg(OptionalBackendPackage):
877+
class BackendTkAgg(SetupPackage):
893878
name = "tkagg"
894-
force = True
895879

896880
def check(self):
897881
return "installing; run-time loading from Python Tcl/Tk"
@@ -919,7 +903,8 @@ def add_flags(self, ext):
919903
ext.libraries.extend(['dl'])
920904

921905

922-
class BackendMacOSX(OptionalBackendPackage):
906+
class BackendMacOSX(OptionalPackage):
907+
config_category = 'gui_support'
923908
name = 'macosx'
924909

925910
def check(self):
@@ -938,15 +923,12 @@ def get_extension(self):
938923
return ext
939924

940925

941-
class OptionalPackageData(OptionalPackage):
942-
config_category = "package_data"
943-
944-
945-
class Dlls(OptionalPackageData):
926+
class Dlls(OptionalPackage):
946927
"""
947928
On Windows, this packages any DLL files that can be found in the
948929
lib/matplotlib/* directories.
949930
"""
931+
config_category = "package_data"
950932
name = "dlls"
951933

952934
def check(self):

0 commit comments

Comments
 (0)