[Distutils] Including non-Python files in site-packages/application
directory
Andy Todd
andy47@halfcooked.com
Thu May 9 21:46:20 2002
Pete Shinners wrote:
> Andy Todd wrote:
>
>> In the latest version of PythonCard we need to include a configuration
>> file with the application code. What this means is that we would like
>> to include a file called stc-styles.cfg in our package and when
>> someone does an install it needs to end up in
>> /usr/lib/python2.2/site-packages/PythonCard (or
>> C:\Python\Lib\site-packages\PythonCard on Windows).
>
>
> i've got a 'datafile installer' for pygame that'll do what you desire.
>
>
>
> #data installer with improved intelligence over distutils.
> #data files are copied into the project directory instead
> #of willy-nilly
> class smart_install_data(install_data):
> def run(self):
> #need to change self.install_dir to the actual library dir
> install_cmd = self.get_finalized_command('install')
> self.install_dir = getattr(install_cmd, 'install_lib')
> return install_data.run(self)
>
> project_name = 'pygame'
> setup(
> name = project_name
> packages = [project_name]
> cmdclass = {'install_data': smart_install_data},
> data_files = [[project_name, ['stc_styles.cfg', 'blah']]]
> ...)
>
>
>
> ...or something to this effect. of course, please change "project_name"
> to something that won't clobber my files :]
>
>
Pete,
You are a legend, thank you very much. This has solved our issue and now
everything gets created under the PythonCard directory.
I will need to do a little more tinkering as the data_files parameter
was fairly complex (it includes a number of documentation
sub-directories for instance) and my initial brute force approach was
just to include the application package directory in this list. The
important thing is that it works though.
Thanks again, I owe you at least a couple of beers.
Regards,
Andy
--
----------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com