8000 Merge pull request #12317 from anntzer/alwaystoolkits · matplotlib/matplotlib@0f7367c · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f7367c

Browse files
authored
Merge pull request #12317 from anntzer/alwaystoolkits
BLD: Always install mpl_toolkits.
2 parents ddbdd4a + fc73b77 commit 0f7367c

File tree

3 files changed

+29
-94
lines changed

3 files changed

+29
-94
lines changed

setup.cfg.template

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
#
2828
#tests = False
2929
#sample_data = True
30-
#toolkits = True
31-
# Tests for the toolkits are only automatically installed
32-
# if the tests and toolkits packages are also getting installed.
33-
#toolkits_tests = auto
3430

3531
[gui_support]
3632
# Matplotlib supports multiple GUI toolkits, including

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@
6565
setupext.Tri(),
6666
'Optional subpackages',
6767
setupext.SampleData(),
68-
setupext.Toolkits(),
6968
setupext.Tests(),
70-
setupext.Toolkits_Tests(),
7169
'Optional backend extensions',
7270
setupext.BackendAgg(),
7371
setupext.BackendTkAgg(),

setupext.py

Lines changed: 29 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -608,37 +608,37 @@ def check(self):
608608
return sys.version
609609

610610

611+
def _pkg_data_helper(pkg, subdir):
612+
"""Glob "lib/$pkg/$subdir/**/*", returning paths relative to "lib/$pkg"."""
613+
base = pathlib.Path("lib", pkg)
614+
return [str(path.relative_to(base)) for path in (base / subdir).rglob("*")]
615+
616+
611617
class Matplotlib(SetupPackage):
612618
name = "matplotlib"
613619

614620
def check(self):
615621
return versioneer.get_version()
616622

617623
def get_packages(self):
618-
return setuptools.find_packages(
619-
"lib",
620-
include=["matplotlib", "matplotlib.*"],
621-
exclude=["matplotlib.tests", "matplotlib.*.tests"])
624+
return setuptools.find_packages("lib", exclude=["*.tests"])
625+
626+
def get_namespace_packages(self):
627+
return ['mpl_toolkits']
622628

623629
def get_py_modules(self):
624630
return ['pylab']
625631

626632
def get_package_data(self):
627-
628-
def iter_dir(base):
629-
return [
630-
str(path.relative_to('lib/matplotlib'))
631-
for path in pathlib.Path('lib/matplotlib', base).rglob('*')]
632-
633633
return {
634-
'matplotlib':
635-
[
634+
'matplotlib': [
636635
'mpl-data/matplotlibrc',
637-
*iter_dir('mpl-data/fonts'),
638-
*iter_dir('mpl-data/images'),
639-
*iter_dir('mpl-data/stylelib'),
640-
*iter_dir('backends/web_backend'),
641-
]}
636+
*_pkg_data_helper('matplotlib', 'mpl-data/fonts'),
637+
*_pkg_data_helper('matplotlib', 'mpl-data/images'),
638+
*_pkg_data_helper('matplotlib', 'mpl-data/stylelib'),
639+
*_pkg_data_helper('matplotlib', 'backends/web_backend'),
640+
],
641+
}
642642

643643

644644
class SampleData(OptionalPackage):
@@ -649,39 +649,17 @@ class SampleData(OptionalPackage):
649649
name = "sample_data"
650650

651651
def get_package_data(self):
652-
653-
def iter_dir(base):
654-
return [
655-
str(path.relative_to('lib/matplotlib'))
656-
for path in pathlib.Path('lib/matplotlib', base).rglob('*')]
657-
658652
return {
659-
'matplotlib':
660-
[
661-
*iter_dir('mpl-data/sample_data'),
662-
]}
663-
664-
665-
class Toolkits(OptionalPackage):
666-
name = "toolkits"
667-
668-
def get_packages(self):
669-
return [
670-
'mpl_toolkits',
671-
'mpl_toolkits.mplot3d',
672-
'mpl_toolkits.axes_grid',
673-
'mpl_toolkits.axes_grid1',
674-
'mpl_toolkits.axisartist',
675-
]
676-
677-
def get_namespace_packages(self):
678-
return ['mpl_toolkits']
653+
'matplotlib': [
654+
*_pkg_data_helper('matplotlib', 'mpl-data/sample_data'),
655+
],
656+
}
679657

680658

681659
class Tests(OptionalPackage):
682660
name = "tests"
683661
pytest_min_version = '3.6'
684-
default_config = False
662+
default_config = True
685663

686664
def check(self):
687665
super().check()
@@ -706,61 +684,24 @@ def check(self):
706684
return ' / '.join(msgs)
707685

708686
def get_packages(self):
709-
return [
710-
'matplotlib.tests',
711-
'matplotlib.sphinxext.tests',
712-
]
687+
return setuptools.find_packages("lib", include=["*.tests"])
713688

714689
def get_package_data(self):
715-
baseline_images = [
716-
'tests/baseline_images/%s/*' % x
717-
for x in os.listdir('lib/matplotlib/tests/baseline_images')]
718-
719690
return {
720-
'matplotlib':
721-
baseline_images +
722-
[
691+
'matplotlib': [
692+
*_pkg_data_helper('matplotlib', 'tests/baseline_images'),
723693
'tests/cmr10.pfb',
724694
'tests/mpltest.ttf',
725695
'tests/test_rcparams.rc',
726696
'tests/test_utf32_be_rcparams.rc',
727697
'sphinxext/tests/tinypages/*.rst',
728698
'sphinxext/tests/tinypages/*.py',
729699
'sphinxext/tests/tinypages/_static/*',
730-
]}
731-
732-
733-
class Toolkits_Tests(Tests):
734-
name = "toolkits_tests"
735-
736-
def check_requirements(self):
737-
conf = self.get_config()
738-
toolkits_conf = Toolkits.get_config()
739-
tests_conf = Tests.get_config()
740-
741-
if conf is True:
742-
Tests.force = True
743-
Toolkits.force = True
744-
elif conf == "auto" and not (toolkits_conf and tests_conf):
745-
# Only auto-install if both toolkits and tests are set
746-
# to be installed
747-
raise CheckFailed("toolkits_tests needs 'toolkits' and 'tests'")
748-
return ""
749-
750-
def get_packages(self):
751-
return [
752-
'mpl_toolkits.tests',
700+
],
701+
'mpl_toolkits': [
702+
*_pkg_data_helper('mpl_toolkits', 'tests/baseline_images'),
753703
]
754-
755-
def get_package_data(self):
756-
baseline_images = [
757-
'tests/baseline_images/%s/*' % x
758-
for x in os.listdir('lib/mpl_toolkits/tests/baseline_images')]
759-
760-
return {'mpl_toolkits': baseline_images}
761-
762-
def get_namespace_packages(self):
763-
return ['mpl_toolkits']
704+
}
764705

765706

766707
class DelayedExtension(Extension, object):

0 commit comments

Comments
 (0)
0