@@ -608,37 +608,37 @@ def check(self):
608
608
return sys .version
609
609
610
610
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
+
611
617
class Matplotlib (SetupPackage ):
612
618
name = "matplotlib"
613
619
614
620
def check (self ):
615
621
return versioneer .get_version ()
616
622
617
623
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' ]
622
628
623
629
def get_py_modules (self ):
624
630
return ['pylab' ]
625
631
626
632
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
-
633
633
return {
634
- 'matplotlib' :
635
- [
634
+ 'matplotlib' : [
636
635
'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
+ }
642
642
643
643
644
644
class SampleData (OptionalPackage ):
@@ -649,39 +649,17 @@ class SampleData(OptionalPackage):
649
649
name = "sample_data"
650
650
651
651
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
-
658
652
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
+ }
679
657
680
658
681
659
class Tests (OptionalPackage ):
682
660
name = "tests"
683
661
pytest_min_version = '3.6'
684
- default_config = False
662
+ default_config = True
685
663
686
664
def check (self ):
687
665
super ().check ()
@@ -706,61 +684,24 @@ def check(self):
706
684
return ' / ' .join (msgs )
707
685
708
686
def get_packages (self ):
709
- return [
710
- 'matplotlib.tests' ,
711
- 'matplotlib.sphinxext.tests' ,
712
- ]
687
+ return setuptools .find_packages ("lib" , include = ["*.tests" ])
713
688
714
689
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
-
719
690
return {
720
- 'matplotlib' :
721
- baseline_images +
722
- [
691
+ 'matplotlib' : [
692
+ * _pkg_data_helper ('matplotlib' , 'tests/baseline_images' ),
723
693
'tests/cmr10.pfb' ,
724
694
'tests/mpltest.ttf' ,
725
695
'tests/test_rcparams.rc' ,
726
696
'tests/test_utf32_be_rcparams.rc' ,
727
697
'sphinxext/tests/tinypages/*.rst' ,
728
698
'sphinxext/tests/tinypages/*.py' ,
729
699
'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' ),
753
703
]
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
+ }
764
705
765
706
766
707
class DelayedExtension (Extension , object ):
0 commit comments