Default matplotlib data path (HAS CHANGED)

I just committed my changes. The simplest approach would be to
specify the matplotlib module package_data, but the current cvs layout
doesn't tailor to that very well. So I mimicked distutils install
command to determine where matplotlib is installed. The datapath is
then defined as $platlib/matplotlib/mpl-data.
     Why this change? If you take a look at
matplotlib._get_data_path() you will see. This method has grown to
probably 100 lines of code to check for various cases, e.g. py2exe,
setuptools, embedding mpl, etc. Now that the data is installed into
the matplotlib module you could pretty much reduce to 1 line:
"os.sep.join([os.path.dirname(__file__), 'mpl-data'])". This now
handles all the cases mentioned above. I left in the initial check
for the MATPLOTLIBDATA env key to still allow for some flexibility.
     I have tested on posix and w/wo setuptools. I am going to check
windows right now, but pretty sure it should work. Please check this
very carefully before next release as it is a pretty major change.
Let me know if anyone encounters a problem.

Thanks,
- Charlie

···

On 12/7/05, John Hunter <jdhunter@...5...> wrote:

    > Would it be considered cleaner to embed the mpl data into
    > the matplotlib module? This would make it easier to
    > clean a mpl install. The data path could be expressed
    > fairly easily too, as a one-liner:

    > os.sep.join([os.path.split(matplotlib.__file__)[0],
    > 'matplotlib-data'])

Yes, if you can engineer in a way that works with setup w/ and w/o a
--prefix arg it would be preferable, in my view.

JDH

FYI, built a bdist_wininst and it worked fine.

···

On 12/12/05, Charlie Moad <cwmoad@...149...> wrote:

     I just committed my changes. The simplest approach would be to
specify the matplotlib module package_data, but the current cvs layout
doesn't tailor to that very well. So I mimicked distutils install
command to determine where matplotlib is installed. The datapath is
then defined as $platlib/matplotlib/mpl-data.
     Why this change? If you take a look at
matplotlib._get_data_path() you will see. This method has grown to
probably 100 lines of code to check for various cases, e.g. py2exe,
setuptools, embedding mpl, etc. Now that the data is installed into
the matplotlib module you could pretty much reduce to 1 line:
"os.sep.join([os.path.dirname(__file__), 'mpl-data'])". This now
handles all the cases mentioned above. I left in the initial check
for the MATPLOTLIBDATA env key to still allow for some flexibility.
     I have tested on posix and w/wo setuptools. I am going to check
windows right now, but pretty sure it should work. Please check this
very carefully before next release as it is a pretty major change.
Let me know if anyone encounters a problem.

Thanks,
- Charlie

On 12/7/05, John Hunter <jdhunter@...5...> wrote:

>
> > Would it be considered cleaner to embed the mpl data into
> > the matplotlib module? This would make it easier to
> > clean a mpl install. The data path could be expressed
> > fairly easily too, as a one-liner:
>
> > os.sep.join([os.path.split(matplotlib.__file__)[0],
> > 'matplotlib-data'])
>
> Yes, if you can engineer in a way that works with setup w/ and w/o a
> --prefix arg it would be preferable, in my view.
>
> JDH
>

Charlie Moad wrote:

FYI, built a bdist_wininst and it worked fine.

I just tested it too and it works for me with a non-setuptools install,
with a setuptools install, and with a non-setuptools install in which
setuptools was later installed. I think it should be fine.