8000 Handle dateutil and pyparsing in the same manner as everything else. · matplotlib/matplotlib@7018842 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7018842

Browse files
committed
Handle dateutil and pyparsing in the same manner as everything else.
1 parent 088a267 commit 7018842

File tree

3 files changed

+87
-52
lines changed

3 files changed

+87
-52
lines changed

setup.cfg.template

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,16 @@
1111
[status]
1212
# To suppress display of the dependencies and their versions
1313
# a 10000 t the top of the build log, uncomment the following line:
14-
#suppress = True
15-
#
16-
# Uncomment to insert lots of diagnostic prints in extension code
17-
#verbose = True
14+
#suppress = False
1815

1916
[packages]
2017
# There are a number of subpackages of matplotlib that are considered
2118
# optional. They are all installed by default, but they may be turned
2219
# off here.
2320
#
24-
#tests = False
25-
#sample_data = False
26-
#toolkits = False
27-
28-
[provide_packages]
29-
# By default, matplotlib checks for a few dependencies and
30-
# installs them if missing. This feature can be turned off
31-
# by uncommenting the following lines. Acceptible values are:
32-
# True: install, overwrite an existing installation
33-
# False: do not install
34-
# auto: install only if the package is unavailable. This
35-
# is the default behavior
36-
#
37-
## Date/timezone support:
38-
#pytz = False
39-
#dateutil = False
40-
#six = False
21+
#tests = True
22+
#sample_data = True
23+
#toolkits = True
4124

4225
[gui_support]
4326
# Matplotlib supports multiple GUI toolkits, including Cocoa,
@@ -46,29 +29,36 @@
4629
# which is provided by matplotlib and built by default.
4730
#
4831
# Some backends are written in pure Python, and others require
49-
# extension code to be compiled. By default, matplotlib checks
50-
# for these GUI toolkits during installation and, if present,
51-
# compiles the required extensions to support the toolkit. GTK
52-
# support requires the GTK runtime environment and PyGTK. Wx
53-
# support requires wxWidgets and wxPython. Tk support requires
54-
# Tk and Tkinter. The other GUI toolkits do not require any
55-
# extension code, and can be used as long as the libraries are
56-
# installed on your system.
32+
# extension code to be compiled. By default, matplotlib checks for
33+
# these GUI toolkits during installation and, if present, compiles the
34+
# required extensions to support the toolkit.
35+
#
36+
# - GTK 2.x support of any kind requires the GTK runtime environment
37+
# headers and PyGTK.
38+
# - Tk support requires Tk development headers and Tkinter.
39+
# - Mac OSX backend requires the Cocoa headers included with XCode.
40+
# - Windowing is MS-Windows specific, and requires the "windows.h"
41+
# header.
42+
#
43+
# The other GUI toolkits do not require any extension code, and can be
44+
# used as long as the libraries are installed on your system --
45+
# therefore they are installed unconditionally.
46+
#
47+
# You can uncomment any the following lines to change this
48+
# behavior. Acceptible values are:
5749
#
58-
# You can uncomment any the following lines if you know you do
59-
# not want to use the GUI toolkit. Acceptible values are:
6050
# True: build the extension. Exits with a warning if the
6151
# required dependencies are not available
6252
# False: do not build the extension
6353
# auto: build if the required dependencies are available,
6454
# otherwise skip silently. This is the default
6555
# behavior
6656
#
67-
#gtk = False
68-
#gtkagg = False
69-
#tkagg = False
70-
#macosx = False
71-
#windowing = False
57+
#gtk = auto
58+
#gtkagg = auto
59+
#tkagg = auto
60+
#macosx = auto
61+
#windowing = auto
7262

7363
[rc_options]
7464
# User-configurable options
@@ -77,7 +67,7 @@
7767
# FltkAgg, MacOSX, Pdf, Ps, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg.
7868
#
7969
# The Agg, Ps, Pdf and SVG backends do not require external
80-
# dependencies. Do not choose GTK, GTKAgg, GTKCairo, MacOSX, TkAgg or WXAgg
70+
# dependencies. Do not choose GTK, GTKAgg, GTKCairo, MacOSX, or TkAgg
8171
# if you have disabled the relevent extension modules. Agg will be used
8272
# by default.
8373
#

setup.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
__version__ = setupext.Matplotlib().check()
3939

4040

41-
# These are the packages in the order we want to build them. This
41+
# These are the packages in the order we want to display them. This
4242
# list may contain strings to create section headers for the display.
4343
mpl_packages = [
4444
'Building Matplotlib',
@@ -47,6 +47,8 @@
4747
setupext.Platform(),
4848
'Required dependencies and extensions',
4949
setupext.Numpy(),
50+
setupext.Dateutil(),
51+
setupext.Pyparsing(),
5052
setupext.CXX(),
5153
setupext.LibAgg(),
5254
setupext.FreeType(),
@@ -92,6 +94,7 @@
9294
ext_modules = []
9395
package_data = {}
9496
package_dir = {'': 'lib'}
97+
install_requires = []
9598
default_backend = None
9699

97100

@@ -149,6 +152,7 @@
149152
for key, val in data.items():
150153
package_data.setdefault(key, [])
151154
package_data[key] = list(set(val + package_data[key]))
155+
install_requires.extend(package.get_install_requires())
152156

153157
# Write the default matplotlibrc file
154158
if default_backend is None:
@@ -204,7 +208,7 @@
204208
classifiers=classifiers,
205209

206210
# List third-party Python packages that we require
207-
install_requires=['dateutils', 'pyparsing'],
211+
install_requires=install_requires,
208212

209213
# Automatically 2to3 source on Python 3.x
210214
use_2to3=True,
@@ -214,11 +218,10 @@
214218
# check for zip safety.
215219
zip_safe=False,
216220

217-
# This option is important -- it reverts to the standard
218-
# distutils installation method. Otherwise, the behavior is to
219-
# build an egg and install that, which unfortunately, makes
220-
# building and importing much slower.
221-
options={
222-
'install': {'old_and_unmanageable': 'True'}
223-
}
221+
# Install our nose plugin so it will always be found
222+
entry_points={
223+
'nose.plugins.0.10': [
224+
'KnownFailure = matplotlib.testing.noseclasses:KnownFailure'
225+
]
226+
},
224227
)

setupext.py

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@
4343
except:
4444
pass
4545

46-
try:
47-
options['verbose'] = not config.getboolean("status", "verbose")
48-
except:
49-
pass
50-
5146
try:
5247
options['backend'] = config.get("rc_options", "backend")
5348
except:
@@ -249,7 +244,7 @@ def setup_extension(self, ext, package, default_include_dirs=[],
249244
"""
250245
flag_map = {
251246
'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
252-
command = "pkg-config --libs --cflags {0}".format(package)
247+
command = "pkg-config --libs --cflags " + package
253248

254249
use_defaults = < EF5E span class=pl-c1>True
255250
if self.has_pkgconfig:
@@ -349,6 +344,14 @@ def get_extension(self):
349344
"""
350345
return None
351346

347+
def get_install_requires(self):
348+
"""
349+
Get a list of Python packages that we require.
350+
pip/easy_install will attempt to download and install this
351+
package if it is not installed.
352+
"""
353+
return []
354+
352355
def _check_for_pkg_config(self, package, include_file, min_version=None,
353356
version=None):
354357
"""
@@ -803,6 +806,42 @@ def get_extension(self):
803806
return ext
804807

805808

809+
class Dateutil(SetupPackage):
810+
name = "dateutil"
811+
812+
def check(self):
813+
try:
814+
import dateutil
815+
except ImportError:
816+
return (
817+
"dateutil was not found. It is required for date axis "
818+
"support. pip/easy_install may attempt to install it "
819+
"after matplotlib.")
820+
821+
return "using dateutil version %s" % dateutil.__version__
822+
823+
def get_install_requires(self):
824+
return ['python_dateutil']
825+
826+
827+
class Pyparsing(SetupPackage):
828+
name = "pyparsing"
829+
830+
def check(self):
831+
try:
832+
import pyparsing
833+
except ImportError:
834+
return (
835+
"pyparsing was not found. It is required for mathtext "
836+
"support. pip/easy_install may attempt to install it "
837+
"after matplotlib.")
838+
839+
return "using pyparsing version %s" % pyparsing.__version__
840+
841+
def get_install_requires(self):
842+
return ['pyparsing']
843+
844+
806845
class BackendAgg(OptionalBackendPackage):
807846
name = "agg"
808847
force = False
@@ -874,6 +913,7 @@ def get_extension(self):
874913

875914
ext = make_extension('matplotlib.backends._tkagg', sources)
876915
self.add_flags(ext)
916+
Numpy().add_flags(ext)
877917
LibAgg().add_flags(ext)
878918
CXX().add_flags(ext)
879919
return ext
@@ -1250,6 +1290,8 @@ def get_extension(self):
12501290
ext = make_extension('matplotlib.backends._gtkagg', sources)
12511291
self.add_flags(ext)
12521292
LibAgg().add_flags(ext)
1293+
CXX().add_flags(ext)
1294+
Numpy().add_flags(ext)
12531295
return ext
12541296

12551297

0 commit comments

Comments
 (0)
0