20
20
import versioneer
21
21
22
22
23
- PY3min = (sys .version_info [0 ] >= 3 )
24
-
25
-
26
23
def _get_xdg_cache_dir ():
27
24
"""
28
25
Return the XDG cache directory.
@@ -57,16 +54,10 @@ def _get_xdg_cache_dir():
57
54
LOCAL_FREETYPE_HASH = _freetype_hashes .get (LOCAL_FREETYPE_VERSION , 'unknown' )
58
55
59
56
if sys .platform != 'win32' :
60
- if not PY3min :
61
- from commands import getstatusoutput
62
- else :
63
- from subprocess import getstatusoutput
57
+ from subprocess import getstatusoutput
64
58
65
59
66
- if PY3min :
67
- import configparser
68
- else :
69
- import ConfigParser as configparser
60
+ import configparser
70
61
71
62
72
63
# matplotlib build options, which can be altered using setup.cfg
@@ -80,10 +71,7 @@ def _get_xdg_cache_dir():
80
71
81
72
setup_cfg = os .environ .get ('MPLSETUPCFG' , 'setup.cfg' )
82
73
if os .path .exists (setup_cfg ):
83
- if PY3min :
84
- config = configparser .ConfigParser ()
85
- else :
86
- config = configparser .SafeConfigParser ()
74
+ config = configparser .ConfigParser ()
87
75
config .read (setup_cfg )
88
76
89
77
if config .has_option ('status' , 'suppress' ):
@@ -809,14 +797,7 @@ def check(self):
809
797
except ImportError :
810
798
msgs += [bad_pytest ]
811
799
812
- if PY3min :
813
- msgs += ['using unittest.mock' ]
814
- else :
815
- try :
816
- import mock
817
- msgs += ['using mock %s' % mock .__version__ ]
818
- except ImportError :
819
- msgs += [msg_template .format (package = 'mock' )]
800
+ msgs += ['using unittest.mock' ]
820
801
821
802
return ' / ' .join (msgs )
822
803
@@ -934,19 +915,12 @@ class Numpy(SetupPackage):
934
915
935
916
@staticmethod
936
917
def include_dirs_hook ():
937
- if PY3min :
938
- import builtins
939
- if hasattr (builtins , '__NUMPY_SETUP__' ):
940
- del builtins .__NUMPY_SETUP__
941
- import imp
942
- import numpy
943
- imp .reload (numpy )
944
- else :
945
- import __builtin__
946
- if hasattr (__builtin__ , '__NUMPY_SETUP__' ):
947
- del __builtin__ .__NUMPY_SETUP__
948
- import numpy
949
- reload (numpy )
918
+ import builtins
919
+ if hasattr (builtins , '__NUMPY_SETUP__' ):
920
+ del builtins .__NUMPY_SETUP__
921
+ import imp
922
+ import numpy
923
+ imp .reload (numpy )
950
924
951
925
ext = Extension ('test' , [])
952
926
ext .include_dirs .append (numpy .get_include ())
@@ -1157,10 +1131,7 @@ def do_custom_build(self):
1157
1131
pass
1158
1132
1159
1133
if not os .path .isfile (tarball_path ):
1160
- if PY3min :
1161
- from urllib .request import urlretrieve
1162
- else :
1163
- from urllib import urlretrieve
1134
+ from urllib .request import urlretrieve
1164
1135
1165
1136
if not os .path .exists ('build' ):
1166
1137
os .makedirs ('build' )
@@ -1473,7 +1444,7 @@ def check(self):
1473
1444
def runtime_check (self ):
1474
1445
""" Checks whether TkAgg runtime dependencies are met
1475
1446
"""
1476
- pkg_name = 'tkinter' if PY3min else 'Tkinter'
1447
+ pkg_name = 'tkinter'
1477
1448
try :
1478
1449
import_module (pkg_name )
1479
1450
except ImportError :
0 commit comments