[Distutils] Packaging of files, which aren't in the package root folder

Lukas Hetzenecker LuHe at gmx.at
Mon Dec 14 12:12:51 CET 2009


i just found this solution and is seems to work for my application:

import os
from distutils.core import setup

# Install data files to package directory
from distutils.command.install import INSTALL_SCHEMES
for scheme in INSTALL_SCHEMES.values():
    scheme['data'] = scheme['purelib']

      packages=['series60_remote', 'series60_remote.devices', 
'series60_remote.lib', 'series60_remote.ui',
                 'series60_remote.window', 'series60_remote.widget'],
      package_dir={'series60_remote': 'pc'},
      data_files=[('series60_remote', ['Changelog', 'HACKING', 'INSTALL', 
'LICENSE', 'LICENSE.icons-oxygen',
                    'README.icons-oxygen', 'TODO']),

Am Montag 14 Dezember 2009 05:40:34 schrieb David Cournapeau:
> On Mon, Dec 14, 2009 at 12:12 AM, Lukas Hetzenecker <LuHe at gmx.at> wrote:
> > Hello,
> >
> > thanks for your reply.
> > I added these files to MANIFEST.in but they are only in the tarball
> > (generated using python setup.py sdist), and not in the installation
> > directory.
> Yes, MANIFEST.in does not handle installed files, and is only
> concerned with sdist (the MANIFEST.in handling is done in the sdist
> command).
> There is no easy solution to your problem AFAIK. Since your data files
> are outside a package, you have to use data_files argument, but
> data_files arguments only install relatively to root or the install
> prefix.
> You need to write your own command for this, at least with straight
> distutils. The easier solution is to put INSTALL and co into a
> package, and use package_data:
> from distutils.core import setup
> if __name__ == '__main__':
>     dist = setup(
>         name='example',
>         packages=['foo'],
>         package_data={'foo': ['INSTALL']},
>         )
> In this case, INSTALL will be installed wherever the package foo is
> installed, but this requires INSTALL to be in the foo package.
> David

More information about the Distutils-SIG mailing list