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

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


Hello,

so you think that this is a better way:

import os
from distutils.core import setup
from distutils.file_util import copy_file

files = ['Changelog', 'HACKING', 'INSTALL', 'LICENSE', 'LICENSE.icons-oxygen',
         'README.icons-oxygen', 'TODO']

# Copy files temporarely to pc directory
for file in files:
   copy_file(file, "pc/")

pys60 = 'PythonForS60_1_4_5_3rdEd.sis'

if os.name == 'posix':
   sisfolder = "/usr/share/series60-remote/"
else:
   sisfolder = "mobile/"

setup(name='series60-remote',
      version='1.0',
      packages=['series60_remote', 'series60_remote.devices', 
'series60_remote.lib', 'series60_remote.ui',
                 'series60_remote.window', 'series60_remote.widget'],
      package_dir={'series60_remote': 'pc'},
      package_data={'series60_remote' : files},
      data_files=[(sisfolder, ['mobile/series60-remote.sis', 'mobile/' + 
pys60])],
      scripts=['series60-remote'],
      )

# Remove temp files
for file in files:
   os.remove("pc/" + file)



Thank you for all your comments,
Lukas

Am Montag 14 Dezember 2009 12:30:20 schrieben Sie:
> 2009/12/14 Lukas Hetzenecker <LuHe at gmx.at>:
> > Hello,
> >
> > 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']
> 
> Hacking the schemes that way can get you in trouble if the end user system
> runs a command that work with the schemes.
> 
> Another clean way to achieve this is to copy those files temporarely
> in the pc directory
> in your release process, so your files will be in a *package* declared
> in packages and then you can use package_data together with
> MANIFEST.in:
> 
> http://docs.python.org/distutils/setupscript.html#installing-package-data
> 
> Tarek
> 


More information about the Distutils-SIG mailing list