Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 019e303

Browse files
committed
Enforce python 2.4 or later; some other version-related cleanup
svn path=/trunk/matplotlib/; revision=5075
1 parent 59759ab commit 019e303

4 files changed

Lines changed: 18 additions & 61 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2008-04-25 Enforce python >= 2.4; remove subprocess build - EF
2+
3+
2008-04-25 Enforce the numpy requirement at build time - JDH
14

25
2008-04-24 Make numpy 1.1 and python 2.3 required when importing
36
matplotlib - EF

lib/matplotlib/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@
9595
from rcsetup import validate_cairo_format
9696

9797
major, minor1, minor2, s, tmp = sys.version_info
98-
_python23 = major>=2 and minor1>=3
99-
100-
_havemath = _python23
98+
_python24 = major>=2 and minor1>=4
10199

102100
try:
103101
import datetime
@@ -111,14 +109,14 @@
111109
#except ImportError: _have_pkg_resources = False
112110
#else: _have_pkg_resources = True
113111

114-
if not _python23:
115-
raise SystemExit('matplotlib requires Python 2.3 or later')
112+
if not _python24:
113+
raise SystemExit('matplotlib requires Python 2.4 or later')
116114

117115
import numpy
118116
nn = numpy.__version__.split('.')
119117
if not (int(nn[0]) >= 1 and int(nn[1]) >= 1):
120118
raise SystemExit(
121-
'numpy >= 1.1 is required; you have %s' % numpy.__version__)
119+
'numpy 1.1 or later is required; you have %s' % numpy.__version__)
122120

123121
def is_string_like(obj):
124122
if hasattr(obj, 'shape'): return 0

setup.py

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,15 @@
2020
import sys
2121
major, minor1, minor2, s, tmp = sys.version_info
2222

23-
if major==2 and minor1<=3:
24-
# setuptools monkeypatches distutils.core.Distribution to support
25-
# package_data
26-
try: import setuptools
27-
except ImportError:
28-
raise SystemExit("""\
29-
matplotlib requires setuptools for installation with python-2.3. Visit:
30-
http://cheeseshop.python.org/pypi/setuptools
31-
for installation instructions for the proper version of setuptools for your
32-
system. If this is your first time upgrading matplotlib with the new
33-
setuptools requirement, you must delete the old matplotlib install
34-
directory.""")
35-
36-
if major==2 and minor1<3 or major<2:
37-
raise SystemExit("""matplotlib requires Python 2.3 or later.""")
23+
if major==2 and minor1<4 or major<2:
24+
raise SystemExit("""matplotlib requires Python 2.4 or later.""")
3825

3926
import glob
4027
from distutils.core import setup
4128
from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\
4229
build_ft2font, build_image, build_windowing, build_path, \
4330
build_contour, build_nxutils, build_traits, build_gdk, \
44-
build_subprocess, build_ttconv, print_line, print_status, print_message, \
31+
build_ttconv, print_line, print_status, print_message, \
4532
print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \
4633
check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \
4734
check_for_cairo, check_provide_traits, check_provide_pytz, \
@@ -100,24 +87,7 @@
10087
]}
10188

10289
if not check_for_numpy():
103-
sys.exit()
104-
105-
try: import subprocess
106-
except ImportError: havesubprocess = False
107-
else: havesubprocess = True
108-
109-
if havesubprocess and sys.version < '2.4':
110-
# Python didn't come with subprocess, so let's make sure it's
111-
# not in some Python egg (e.g. an older version of matplotlib)
112-
# that may get removed.
113-
subprocess_dir = os.path.dirname(subprocess.__file__)
114-
if subprocess_dir.endswith('.egg/subprocess'):
115-
havesubprocess = False
116-
117-
if not havesubprocess:
118-
packages.append('subprocess')
119-
if sys.platform == 'win32':
120-
build_subprocess(ext_modules, packages)
90+
sys.exit(1)
12191

12292
if not check_for_freetype():
12393
sys.exit(1)

setupext.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -532,38 +532,31 @@ def check_for_pdftops():
532532
return False
533533

534534
def check_for_numpy():
535-
gotit = False
536535
try:
537536
import numpy
538537
except ImportError:
539538
print_status("numpy", "no")
540-
print_message("You must install numpy to build matplotlib.")
541-
return False
542-
543-
major, minor1, minor2 = map(int, numpy.__version__.split('.')[:3])
544-
if major<1 or (major==1 and minor1<1):
545-
print_status("numpy version", "no")
546539
print_message("You must install numpy 1.1 or later to build matplotlib.")
547-
548540
return False
549-
541+
nn = numpy.__version__.split('.')
542+
if not (int(nn[0]) >= 1 and int(nn[1]) >= 1):
543+
print_message(
544+
'numpy 1.1 or later is required; you have %s' % numpy.__version__)
545+
return False
550546
module = Extension('test', [])
551547
add_numpy_flags(module)
552548
add_base_flags(module)
553549

554550
print_status("numpy", numpy.__version__)
555551
if not find_include_file(module.include_dirs, os.path.join("numpy", "arrayobject.h")):
556552
print_message("Could not find the headers for numpy. You may need to install the development package.")
553+
return False
557554
return True
558555

559556
def add_numpy_flags(module):
560557
"Add the modules flags to build extensions which use numpy"
561558
import numpy
562-
# TODO: Remove this try statement when it is no longer needed
563-
try:
564-
module.include_dirs.append(numpy.get_include())
565-
except AttributeError:
566-
module.include_dirs.append(numpy.get_numpy_include())
559+
module.include_dirs.append(numpy.get_include())
567560

568561
def add_agg_flags(module):
569562
'Add the module flags to build extensions which use agg'
@@ -1267,10 +1260,3 @@ def build_gdk(ext_modules, packages):
12671260

12681261
BUILT_GDK = True
12691262

1270-
def build_subprocess(ext_modules, packages):
1271-
module = Extension(
1272-
'subprocess._subprocess',
1273-
['src/_subprocess.c', ],
1274-
)
1275-
add_base_flags(module)
1276-
ext_modules.append(module)

0 commit comments

Comments
 (0)