1
- from __future__ import print_function , absolute_import
2
-
3
- from importlib import import_module
4
-
5
- from distutils import sysconfig
6
- from distutils import version
1
+ from distutils import sysconfig , version
7
2
from distutils .core import Extension
8
3
import distutils .command .build_ext
9
4
import glob
10
5
import multiprocessing
11
6
import os
7
+ import pathlib
12
8
import platform
13
9
import re
14
10
import shutil
17
13
import sys
18
14
import warnings
19
15
from textwrap import fill
16
+
17
+ import setuptools
20
18
import versioneer
21
19
22
20
@@ -660,9 +658,7 @@ class Python(SetupPackage):
660
658
name = "python"
661
659
662
660
def check (self ):
663
- major , minor1 , minor2 , s , tmp = sys .version_info
664
-
665
- if major < 3 or minor1 < 5 :
661
+ if sys .version_info < (3 , 5 ):
666
662
error = """
667
663
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.
668
664
Beginning with Matplotlib 3.0, Python 3.5 and above is required.
@@ -672,7 +668,6 @@ def check(self):
672
668
Make sure you have pip >= 9.0.1.
673
669
"""
674
670
raise CheckFailed (error )
675
-
676
671
return sys .version
677
672
678
673
@@ -683,55 +678,29 @@ def check(self):
683
678
return versioneer .get_version ()
684
679
685
680
def get_packages (self ):
686
- return [
687
- 'matplotlib' ,
688
- 'matplotlib.backends' ,
689
- 'matplotlib.backends.qt_editor' ,
690
- 'matplotlib.compat' ,
691
- 'matplotlib.projections' ,
692
- 'matplotlib.axes' ,
693
- 'matplotlib.sphinxext' ,
694
- 'matplotlib.style' ,
695
- 'matplotlib.testing' ,
696
- 'matplotlib.testing._nose' ,
697
- 'matplotlib.testing._nose.plugins' ,
698
- 'matplotlib.testing.jpl_units' ,
699
- 'matplotlib.tri' ,
700
- 'matplotlib.cbook'
701
- ]
681
+ return setuptools .find_packages (
682
+ "lib" ,
683
+ include = ["matplotlib" , "matplotlib.*" ],
684
+ exclude = ["matplotlib.tests" , "matplotlib.*.tests" ])
702
685
703
686
def get_py_modules (self ):
704
687
return ['pylab' ]
705
688
706
689
def get_package_data (self ):
690
+
691
+ def iter_dir (base ):
692
+ return [
693
+ str (path .relative_to ('lib/matplotlib' ))
694
+ for path in pathlib .Path ('lib/matplotlib' , base ).rglob ('*' )]
695
+
707
696
return {
708
697
'matplotlib' :
709
698
[
710
- 'mpl-data/fonts/afm/*.afm' ,
711
- 'mpl-data/fonts/pdfcorefonts/*.afm' ,
712
- 'mpl-data/fonts/pdfcorefonts/*.txt' ,
713
- 'mpl-data/fonts/ttf/*.ttf' ,
714
- 'mpl-data/fonts/ttf/LICENSE_STIX' ,
715
- 'mpl-data/fonts/ttf/COPYRIGHT.TXT' ,
716
- 'mpl-data/fonts/ttf/README.TXT' ,
717
- 'mpl-data/fonts/ttf/RELEASENOTES.TXT' ,
718
- 'mpl-data/images/*.xpm' ,
719
- 'mpl-data/images/*.svg' ,
720
- 'mpl-data/images/*.gif' ,
721
- 'mpl-data/images/*.pdf' ,
722
- 'mpl-data/images/*.png' ,
723
- 'mpl-data/images/*.ppm' ,
724
- 'mpl-data/example/*.npy' ,
725
- 'mpl-data/matplotlibrc' ,
726
- 'backends/web_backend/*.*' ,
727
- 'backends/web_backend/js/*.*' ,
728
- 'backends/web_backend/jquery/js/*.min.js' ,
729
- 'backends/web_backend/jquery/css/themes/base/*.min.css' ,
730
- 'backends/web_backend/jquery/css/themes/base/images/*' ,
731
- 'backends/web_backend/css/*.*' ,
732
- 'backends/Matplotlib.nib/*' ,
733
- 'mpl-data/stylelib/*.mplstyle' ,
734
- ]}
699
+ * iter_dir ('mpl-data/fonts' ),
700
+ * iter_dir ('mpl-data/images' ),
701
+ * iter_dir ('mpl-data/stylelib' ),
702
+ * iter_dir ('backends/web_backend' ),
703
+ ]}
735
704
736
705
737
706
class SampleData (OptionalPackage ):
@@ -742,11 +711,16 @@ class SampleData(OptionalPackage):
742
711
name = "sample_data"
743
712
744
713
def get_package_data (self ):
714
+
715
+ def iter_dir (base ):
716
+ return [
717
+ str (path .relative_to ('lib/matplotlib' ))
718
+ for path in pathlib .Path ('lib/matplotlib' , base ).rglob ('*' )]
719
+
745
720
return {
746
721
'matplotlib' :
747
722
[
748
- 'mpl-data/sample_data/*.*' ,
749
- 'mpl-data/sample_data/axes_grid/*.*' ,
723
+ * iter_dir ('mpl-data/sample_data' ),
750
724
]}
751
725
752
726
@@ -1432,9 +1406,8 @@ def check(self):
1432
1406
def runtime_check (self ):
1433
1407
""" Checks whether TkAgg runtime dependencies are met
1434
1408
"""
1435
- pkg_name = 'tkinter'
1436
1409
try :
1437
- import_module ( pkg_name )
1410
+ import tkinter
1438
1411
except ImportError :
1439
1412
return False
1440
1413
return True
0 commit comments