|
From: Charlie M. <cw...@gm...> - 2006-01-25 16:51:44
|
Short explanation:
Use --prefix instead
Long explanation:
Without explicitly moving around files in cvs and declaring the
mpl data as package_data, it is pretty hard to be 100% compliant. The
code you put below is basically how distutils now determines where to
stick data_files, and that is why I used it as a guide too faking it.=20
--home is unix specific I think, and I don't know that it gives you
any power over --prefix. --install-data is useless now since the data
is embedded into the matplotlib module itself.
I think I wrote a little a while back justifying the move, but
I'll restate. If you look at older versions of the
matplotlib._get_data_path() method, it was becoming a huge collection
of special cases. Those cases are still in cvs, but commented out.=20
It had the approach of try everything until I find the data. Now you
could acutally write this method in one line, "return
os.sep.join([os.path.dirname(__file__), 'mpl-data'])". However it
does a little more by still checking the MATPLOTLIBDATA env variable
first and verifying that the embedded mpl-data folder actually exists.
Another strong reason for the move is it makes matplotlib a lot
more embeddable. I personally have some plugins I have developed for
applications that ship with their own python, and it is much easier to
just drop matplotlib into on place, and not have to worry about
installing data files outside the scope of the application. It also
allows for multiple versions/instances of matplotlib to live on one
machine, where as before they would be forced to use a single version
of the dataset unless special care was taken to prevent that.
- Charlie
On 1/25/06, Nadezhda Dencheva <den...@st...> wrote:
> Hello,
>
> I somehow missed all the action between matplotlib 0.84 and 0.86.2.
> Trying to install v0.86.2 I find data files are not installed correctly
> in all cases. Specifically support for '--home=3D' and '--install-data' i=
s
> broken. (We use --install-data for our installations.)
>
> I know this is a very tricky issue (in fact if someone can tell me
> how to get this done correctly for bdist_wininst, I'll be very gratefull)
> but here's a suggestion which worked for me. I am copying the relevant
> part from setup.py and hope someone has a better solution.
>
> Thanks,
> Nadia Dencheva
>
>
> if has_setuptools: # EGG's make it simple
> datapath =3D os.path.curdir
> datapath =3D os.sep.join([datapath, 'matplotlib', 'mpl-data']) # Thi=
s is where mpl data
> will be installed
> # logic from distutils.command.install.finalize_options
> elif os.name =3D=3D 'posix':
> py_version_short =3D sys.version[0:3]
> #datapath =3D INSTALL_SCHEMES['unix_prefix']['platlib']
> #datapath =3D datapath.replace('$platbase/', '').replace('$py_versio=
n_short',
> py_version_short)
> #datapath =3D os.sep.join(['mpl-data']) # This is where mpl data wil=
l be installed
> args =3D sys.argv
> for a in args:
> if a.startswith('--home=3D'):
> dir =3D os.path.abspath(a.split('=3D')[1])
> datapath =3D os.path.join(dir, 'lib', 'python', 'matplotlib'=
, 'mpl-data')
> elif a.startswith('--prefix=3D'):
> dir =3D os.path.abspath(a.split('=3D')[1])
> pythonver =3D 'python'+py_version_short
> datapath =3D os.path.join(dir, 'lib', pythonver, 'site-packa=
ges', 'matplotlib',
> 'mpl-data')
> elif a.startswith('--install-data=3D'):
> dir =3D os.path.abspath(a.split('=3D')[1])
> datapath =3D os.path.join(dir, 'mpl-data')
> else:
> pythonlib =3D distutils.sysconfig.get_python_lib(plat_specif=
ic=3D1)
> datapath =3D os.path.join(pythonlib, 'matplotlib', 'mpl-data=
')
> else:
> datapath =3D INSTALL_SCHEMES[os.name]['platlib'].replace('$base/', '=
')
> datapath =3D os.sep.join([datapath, 'matplotlib', 'mpl-data']) # Thi=
s is where mpl data
> will be installed
>
> Charlie Moad wrote:
> > Alright, I'll give it a shot and let you know.
> >
> > On 12/7/05, John Hunter <jdh...@ac...> wrote:
> >
> >>>>>>>"Charlie" =3D=3D Charlie Moad <cw...@gm...> writes:
> >>
> >> Charlie> Would it be considered cleaner to embed the mpl data into
> >> Charlie> the matplotlib module? This would make it easier to
> >> Charlie> clean a mpl install. The data path could be expressed
> >> Charlie> fairly easily too, as a one-liner:
> >>
> >> Charlie> os.sep.join([os.path.split(matplotlib.__file__)[0],
> >> Charlie> '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
> >>
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
files
> > for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dclick
> > _______________________________________________
> > Matplotlib-devel mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
|