Skip to content

Always install mpl_toolkits. #12317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions setup.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#
#tests = False
#sample_data = True
#toolkits = True
# Tests for the toolkits are only automatically installed
# if the tests and toolkits packages are also getting installed.
#toolkits_tests = auto

[gui_support]
# Matplotlib supports multiple GUI toolkits, including
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
setupext.Tri(),
'Optional subpackages',
setupext.SampleData(),
setupext.Toolkits(),
setupext.Tests(),
setupext.Toolkits_Tests(),
'Optional backend extensions',
setupext.BackendAgg(),
setupext.BackendTkAgg(),
Expand Down
117 changes: 29 additions & 88 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,37 +608,37 @@ def check(self):
return sys.version


def _pkg_data_helper(pkg, subdir):
"""Glob "lib/$pkg/$subdir/**/*", returning paths relative to "lib/$pkg"."""
base = pathlib.Path("lib", pkg)
return [str(path.relative_to(base)) for path in (base / subdir).rglob("*")]


class Matplotlib(SetupPackage):
name = "matplotlib"

def check(self):
return versioneer.get_version()

def get_packages(self):
return setuptools.find_packages(
"lib",
include=["matplotlib", "matplotlib.*"],
exclude=["matplotlib.tests", "matplotlib.*.tests"])
return setuptools.find_packages("lib", exclude=["*.tests"])

def get_namespace_packages(self):
return ['mpl_toolkits']

def get_py_modules(self):
return ['pylab']

def get_package_data(self):

def iter_dir(base):
return [
str(path.relative_to('lib/matplotlib'))
for path in pathlib.Path('lib/matplotlib', base).rglob('*')]

return {
'matplotlib':
[
'matplotlib': [
'mpl-data/matplotlibrc',
*iter_dir('mpl-data/fonts'),
*iter_dir('mpl-data/images'),
*iter_dir('mpl-data/stylelib'),
*iter_dir('backends/web_backend'),
]}
*_pkg_data_helper('matplotlib', 'mpl-data/fonts'),
*_pkg_data_helper('matplotlib', 'mpl-data/images'),
*_pkg_data_helper('matplotlib', 'mpl-data/stylelib'),
*_pkg_data_helper('matplotlib', 'backends/web_backend'),
],
}


class SampleData(OptionalPackage):
Expand All @@ -649,39 +649,17 @@ class SampleData(OptionalPackage):
name = "sample_data"

def get_package_data(self):

def iter_dir(base):
return [
str(path.relative_to('lib/matplotlib'))
for path in pathlib.Path('lib/matplotlib', base).rglob('*')]

return {
'matplotlib':
[
*iter_dir('mpl-data/sample_data'),
]}


class Toolkits(OptionalPackage):
name = "toolkits"

def get_packages(self):
return [
'mpl_toolkits',
'mpl_toolkits.mplot3d',
'mpl_toolkits.axes_grid',
'mpl_toolkits.axes_grid1',
'mpl_toolkits.axisartist',
]

def get_namespace_packages(self):
return ['mpl_toolkits']
'matplotlib': [
*_pkg_data_helper('matplotlib', 'mpl-data/sample_data'),
],
}


class Tests(OptionalPackage):
name = "tests"
pytest_min_version = '3.6'
default_config = False
default_config = True

def check(self):
super().check()
Expand All @@ -706,61 +684,24 @@ def check(self):
return ' / '.join(msgs)

def get_packages(self):
return [
'matplotlib.tests',
'matplotlib.sphinxext.tests',
]
return setuptools.find_packages("lib", include=["*.tests"])

def get_package_data(self):
baseline_images = [
'tests/baseline_images/%s/*' % x
for x in os.listdir('lib/matplotlib/tests/baseline_images')]

return {
'matplotlib':
baseline_images +
[
'matplotlib': [
*_pkg_data_helper('matplotlib', 'tests/baseline_images'),
'tests/cmr10.pfb',
'tests/mpltest.ttf',
'tests/test_rcparams.rc',
'tests/test_utf32_be_rcparams.rc',
'sphinxext/tests/tinypages/*.rst',
'sphinxext/tests/tinypages/*.py',
'sphinxext/tests/tinypages/_static/*',
]}


class Toolkits_Tests(Tests):
name = "toolkits_tests"

def check_requirements(self):
conf = self.get_config()
toolkits_conf = Toolkits.get_config()
tests_conf = Tests.get_config()

if conf is True:
Tests.force = True
Toolkits.force = True
elif conf == "auto" and not (toolkits_conf and tests_conf):
# Only auto-install if both toolkits and tests are set
# to be installed
raise CheckFailed("toolkits_tests needs 'toolkits' and 'tests'")
return ""

def get_packages(self):
return [
'mpl_toolkits.tests',
],
'mpl_toolkits': [
*_pkg_data_helper('mpl_toolkits', 'tests/baseline_images'),
]

def get_package_data(self):
baseline_images = [
'tests/baseline_images/%s/*' % x
for x in os.listdir('lib/mpl_toolkits/tests/baseline_images')]

return {'mpl_toolkits': baseline_images}

def get_namespace_packages(self):
return ['mpl_toolkits']
}


class DelayedExtension(Extension, object):
Expand Down