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

Lukas Hetzenecker LuHe at gmx.at
Sun Dec 13 15:08:36 CET 2009


Hello,

i have the following folder structure:

<application>
   INSTALL
   Changelog
   LICENCE
   <src>
      main.py
      <module 1>
          module.py
      <module 2>
          modile.py

Is it possible to create a setup.py script which copies INSTALL, Changelog and 
LICENCE also in the installation folder (by default /usr/lib/python2.6/site-
packages/application)?

I have this script:

from distutils.core import setup

setup(name='application',
      version='1.0',
      packages=['src', 'src.module1', 'src.module2'],
      package_data={'' : ['Changelog', 'HACKING', 'INSTALL', 'LICENSE',
                               'LICENSE.icons-oxygen', 'README.icons-oxygen',
                               'TODO']},
      scripts=['application-wrapper']
      )

I also tried it so:

from distutils.core import setup

setup(name='application',
      version='1.0',
      packages=['application', 'application.module1', 
                        'application.module2'],
      package_dir={'application': 'src/'},
      package_data={'application' : ['Changelog', 'HACKING', 'INSTALL',
                               'LICENSE', 'LICENSE.icons-oxygen', 
                               'README.icons-oxygen', 'TODO']},
      scripts=['application-wrapper']
      )

But this did also not work.
I think another way would be to use data_files instead of package_data - but 
this copys the files to /usr/bin by default, and I don't know the actual 
application directory - or would this be possible?

(If you suggest to move the content of the src/ directory to the root folder, 
or to copy the INSTALL and LICENCE files to the src folder, this wouldn't work. 
The src folder is actually not named src/ but pc/ and there is also a folder 
for the part of the mobile phone - and I want the LICENSE and INSTALL file in 
the root directory to not confuse the users, but I only want to install the 
content of the pc/ (or as in this simple example, the src/ folder) on the 
computer.)

Thanks for any help,
Lukas


More information about the Distutils-SIG mailing list