Sorry, this version didn't run correctly on windows, i attached a new one.
It would be great if you could quickly look at it and tell me if this could 
make any problems.

Thanks
Lukas

Am Montag 14 Dezember 2009 12:56:41 schrieb Lukas Hetzenecker:
> 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 <[email protected]>:
> > > 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
> 
import os
from distutils.core import setup
from distutils.file_util import copy_file
from distutils.dir_util import copy_tree, remove_tree

textfiles = ['Changelog', 'HACKING', 'INSTALL', 'LICENSE', 'LICENSE.icons-oxygen',
         'README.icons-oxygen', 'TODO']
pys60 = 'PythonForS60_1_4_5_3rdEd.sis'
sisfiles = ['mobile/series60-remote.sis', 'mobile/' + pys60]

extra = {}

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

if os.name == 'posix':
   sisfolder = "/usr/share/series60-remote/"
   extra['data_files'] = [(sisfolder, sisfiles)]
   extra['package_data'] = {'series60_remote' : textfiles}
else:
   sisfolder = "mobile/"

   # use package_data in windows
   copy_tree("mobile", "pc/mobile")

   extra['package_data'] = {'series60_remote' : sisfiles + textfiles}
   

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'},
      scripts=['series60-remote'],
      **extra
      )

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

if os.name != 'posix':
   remove_tree("pc/mobile")
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to