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

Skip to content

Commit babe80b

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 014aa5b commit babe80b

2 files changed

Lines changed: 17 additions & 50 deletions

File tree

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

@@ -18,25 +17,10 @@
1817
#sample_data = True
1918

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

5234
[rc_options]
5335
# User-configurable options
5436
#
5537
# Default backend, one of: Agg, Cairo, GTK3Agg, GTK3Cairo, MacOSX, Pdf, Ps,
5638
# Qt4Agg, Qt5Agg, SVG, TkAgg, WX, WXAgg.
5739
#
58-
# The Agg, Ps, Pdf and SVG backends do not require external dependencies. Do
59-
# not choose MacOSX, or TkAgg if you have disabled the relevant extension
60-
# modules. The default is determined by fallback.
40+
# The Agg, Ps, Pdf and SVG backends do not require external dependencies. Do
41+
# not choose MacOSX if you have disabled the relevant extension modules. The
42+
# default is determined by fallback.
6143
#
6244
#backend = Agg

setupext.py

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

303303
class OptionalPackage(SetupPackage):
304304
optional = True
305-
force = False
306305
config_category = "packages"
307306
default_config = "auto"
308307

@@ -328,26 +327,13 @@ def check(self):
328327
329328
May be overridden by subclasses for additional checks.
330329
"""
331-
# Check configuration file
332-
conf = self.get_config()
333-
# Default "auto" state or install forced by user
334-
if conf in [True, 'auto']:
335-
# Set non-optional if user sets `True` in config
336-
if conf is True:
330+
conf = self.get_config() # Check configuration file
331+
if conf in [True, 'auto']: # Default "auto", or install forced by user
332+
if conf is True: # Set non-optional if user sets `True` in config
337333
self.optional = False
338334
return "installing"
339-
# Configuration opt-out by user
340-
else:
341-
# Some backend extensions (e.g. Agg) need to be built for certain
342-
# other GUI backends (e.g. TkAgg) even when manually disabled
343-
if self.force is True:
344-
return "installing forced (config override)"
345-
else:
346-
raise CheckFailed("skipping due to configuration")
347-
348-
349-
class OptionalBackendPackage(OptionalPackage):
350-
config_category = "gui_support"
335+
else: # Configuration opt-out by user
336+
raise CheckFailed("skipping due to configuration")
351337

352338

353339
class Platform(SetupPackage):
@@ -707,9 +693,8 @@ def get_extension(self):
707693
return ext
708694

709695

710-
class BackendAgg(OptionalBackendPackage):
696+
class BackendAgg(SetupPackage):
711697
name = "agg"
712-
force = True
713698

714699
def get_extension(self):
715700
sources = [
@@ -725,9 +710,8 @@ def get_extension(self):
725710
return ext
726711

727712

728-
class BackendTkAgg(OptionalBackendPackage):
713+
class BackendTkAgg(SetupPackage):
729714
name = "tkagg"
730-
force = True
731715

732716
def check(self):
733717
return "installing; run-time loading from Python Tcl/Tk"
@@ -755,7 +739,8 @@ def add_flags(self, ext):
755739
ext.libraries.extend(['dl'])
756740

757741

758-
class BackendMacOSX(OptionalBackendPackage):
742+
class BackendMacOSX(OptionalPackage):
743+
config_category = 'gui_support'
759744
name = 'macosx'
760745

761746
def check(self):

0 commit comments

Comments
 (0)