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

Skip to content

Commit 3f03686

Browse files
committed
Support for setuptools/pkg_resources to build and use
matplotlib as an egg. Still allows matplotlib to exist using a traditional distutils install. - ADS svn path=/trunk/matplotlib/; revision=1914
1 parent e759325 commit 3f03686

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

CHANGELOG

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
h2005-12-03 Modified setup to build matplotlibrc based on compile time
1+
2005-12-11 Support for setuptools/pkg_resources to build and use
2+
matplotlib as an egg. Still allows matplotlib to exist
3+
using a traditional distutils install. - ADS
4+
5+
2005-12-03 Modified setup to build matplotlibrc based on compile time
26
findings. It will set numerix in the order of scipy,
37
numarray, Numeric depending on which are founds, and
48
backend as in preference order GTKAgg, WXAgg, TkAgg, GTK,
@@ -11,12 +15,12 @@ h2005-12-03 Modified setup to build matplotlibrc based on compile time
1115
than from scipy.fftpack import *
1216

1317
2005-12-03 Applied some fixes to Nicholas Young's nonuniform image
14-
patch
18+
patch
1519

16-
2005-12-01 Applied Alex Gontmakher hatch patch - PS only for now
20+
2005-12-01 Applied Alex Gontmakher hatch patch - PS only for now
1721

1822
2005-11-30 Added Rob McMullen's EMF patch
19-
h
23+
2024
2005-11-30 Added Daishi's patch for scipy
2125

2226
2005-11-30 Fixed out of bounds draw markers segfault in agg

lib/matplotlib/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@
181181
except ImportError: _havedate = False
182182
else: _havedate = True
183183

184+
try:
185+
import pkg_resources # pkg_resources is part of setuptools
186+
except ImportError: _have_pkg_resources = False
187+
else: _have_pkg_resources = True
188+
184189
if not _python23:
185190
def enumerate(seq):
186191
for i in range(len(seq)):
@@ -363,6 +368,20 @@ def _get_configdir():
363368
def _get_data_path():
364369
'get the path to matplotlib data'
365370

371+
if _have_pkg_resources:
372+
try:
373+
dist = pkg_resources.get_distribution('matplotlib')
374+
except pkg_resources.DistributionNotFound:
375+
# pkg_resources is installed, but setuptools wasn't used into install matplotlib.
376+
used_setuptools_to_install_MPL = False
377+
else:
378+
used_setuptools_to_install_MPL = True
379+
380+
if used_setuptools_to_install_MPL:
381+
req = pkg_resources.Requirement.parse('matplotlib')
382+
path = pkg_resources.resource_filename(req, 'share/matplotlib')
383+
return path
384+
366385
if os.environ.has_key('MATPLOTLIBDATA'):
367386
path = os.environ['MATPLOTLIBDATA']
368387
if os.path.isdir(path): return path

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
5959

6060
from distutils.core import setup
61+
62+
try:
63+
from setuptools import setup # use setuptools if possible
64+
except ImportError:
65+
pass
66+
6167
import sys,os
6268
import glob
6369
from distutils.core import Extension

0 commit comments

Comments
 (0)