Including non-Python files in site-packages/application directory
All, 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 can get the file included in the MANIFEST and thus included in the zip and tar.gz files, but when I run "python setup.py install" the 'build' function only copies files with a .py extension. Is there any way to augment this? I'm open to any suggestions short of re-writing distutils ;-) Regards, Andy -- ---------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com
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 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
On Fri, 10 May 2002, Andy Todd wrote:
All,
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 can get the file included in the MANIFEST and thus included in the zip
Hi, we ran into this with Gnosis_Utils as well - our "solution" (correct or not :-) is to let the "build" command run, then go through MANIFEST copying files to build/lib (or build/lib.ARCH, if you have extensions). Then, when the "install" command runs, it pulls files from the build/lib* dir and installs them. I can email you the setup file if you'd like to see it (not yet in the latest release ... Real Soon Now :-) I'm hoping there is a better answer, and I just don't know distutils well enough to come up with it ... frank
Regards, Andy
participants (3)
-
Andy Todd
-
Frank McIngvale
-
Pete Shinners