[Distutils] extra files into the package dir
Rene Liebscher
R.Liebscher@gmx.de
Thu Oct 19 10:26:54 2000
Berthold Höllmann wrote:
>
> >>>>> "Rene" == Rene Liebscher <R.Liebscher@gmx.de> writes:
>
> Rene> Pete Shinners wrote:
> >> i have some extra files i'd like to have copied into the
> >> destination package directory when installing.
> >>
> >> it seems that distutils only installs the .PY(C) files when
> >> installing a package directory. how can i tell distutils to
> >> copy my other files too?
> >>
> >> does this involve 'extending' the install command? i could
> >> probably do that if there were docs or an example of something
> >> like that.
> >>
> Rene> I had a similar problem with PyOpenGL. (It needs some data
> Rene> files for its examples.) May be my solution is what you
> Rene> need. (At least it could serve as an example.)
>
> Rene> Look at the following address:
> Rene> http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/PyOpenGL/?cvsroot=PyOpenGL
>
> Rene> "my_install_data.py" extends distutils' install_data
> Rene> command. "setup.py" uses then this alternative command. (The
> Rene> important parts are at the end of this file. One is the
> Rene> specification of this alternative install command =
> Rene> "cmdclass" parameter of the setup function. The other is the
> Rene> "data_files" parameter to the setup function.)
>
> There is support for installing data files, but they get to data
> directories. When writing setup.py for biggles, I had the problem,
> that a config file had to go to the package directory. All I did was adding
>
> class my_install_data (install_data):
> def finalize_options (self):
> self.set_undefined_options('install',
> ('install_lib', 'install_dir'),
> ('root', 'root'),
> ('force', 'force'),
> )
>
> and
>
> cmdclass = {'install_data': my_install_data},
> data_files = [('biggles', ["src/config.ini"])]
>
> to the setup command line. This got everything to the right place.
>
This is probably the simplest possible solution. My approach goes
further, it handles also MANIFEST.in-like templates and some other
special things, and it was written primary to replace distutils'
install_data as whole.
(Greg, do you remember my mail of 06/26/2000?
http://www.python.org/pipermail/distutils-sig/2000-June/001671.html )
Kind regards
Rene Liebscher