|
From: Nadia D. <den...@st...> - 2006-01-25 17:06:48
|
On Jan 25, 2006, at 11:51 AM, Charlie Moad wrote:
> Short explanation:
> Use --prefix instead
Hmm, I don't want to use --prefix.
I understand the reasoning behind this change but I think it misses one
important case - installations under a user specified directory=20
(without getting the
unnecessary tree structure from '--home' and ''--prefix'),
For example, to install matplotlib under /home/users/matpltolib in the=20=
past
I would do
python setup.py install --install-lib=3D/home/user=20
--install-data=3D/home/user/matplotlib
This, I think, covers two important cases:
- easy support for multiple versions on the system
- installation in a user directory (not having write permissions in=20
site-packages)
Of course this can be done (in an ugly way) with --prefix.
I think you and I need the same kind of installation - data files=20
bundled with
matplotlib, except that I don't want to install them in site-packages=20
and this is
what's missing from the setup file now.
Am I missing something?
Nadia
> 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.
> --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.
> 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=20
>> correctly
>> in all cases. Specifically support for '--home=3D' and =
'--install-data'=20
>> is
>> 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=20
>> 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']) #=20=
>> This 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/',=20
>> '').replace('$py_version_short',
>> py_version_short)
>> #datapath =3D os.sep.join(['mpl-data']) # This is where mpl data=20=
>> will 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',=20
>> '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,=20
>> 'site-packages', '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=20
>> distutils.sysconfig.get_python_lib(plat_specific=3D1)
>> datapath =3D os.path.join(pythonlib, 'matplotlib',=20
>> 'mpl-data')
>> else:
>> datapath =3D =
INSTALL_SCHEMES[os.name]['platlib'].replace('$base/',=20
>> '')
>> datapath =3D os.sep.join([datapath, 'matplotlib', 'mpl-data']) #=20=
>> This 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=20
>>>> 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=20=
>>> log files
>>> for problems? Stop! Download the new AJAX search engine that makes
>>> searching your log files as easy as surfing the web. DOWNLOAD=20
>>> 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
>>
|