I have a lot of media assets to include in my python rpm. I am confused as to the best way to include these files in my rpm.
Here is my setup:
setup.py sun.py gfx/sun_1.png gfx/sun_2.png gfx/sun_3.png gfx/core/core_1.png gfx/core/core_2.png ... gfx/core/core_99.png
I list everything I want to include in my manifest.in file with:
recursive-include gfx *.png
and when I make a source tar.gz ( via python setup.py bdist --format=rpm ) all of the media assets are included in the resultant tar.gz bundle.
Then I move the source tar.gz into ~/rpmbuild/SOURCES/ and then I run rpmbuild -ba SunnyApp.spec
Unfortunately, none of the gfx are transfered over. However, if I modify my setup.py as follows:
from setuptools import find_packages
pkgs = find_packages( )
setup( name='SunnyApp', ...
data_files=[ ('SunnyApp/gfx', ['gfx/sun_1.png', 'gfx/sun_2.png'] ),
('SunnyApp/gfx/core', ['gfx/core/core_1.png', 'gfx/core/core_2.png'] ) ],
...
packages=pkgs,
....
)
Only those files that I list make it into the rpm (in this case sun_1.png, sun_2.png, core_1.png, core_2.png) Unfortunately, there does not appear to be a way to include *.png for all subdirectories in gfx.
Is there a way to include lots of files with a pattern when calling rpmbuild? I am not sure how to use package_data to list wildcards because of how I am using packages=find_packages( )
Any suggestions? Thanks much.
On Mon, 2011-01-24 at 21:02 -0500, Erik Blankinship wrote:
Unfortunately, there does not appear to be a way to include *.png for all subdirectories in gfx.
You might find os.walk() or glob.glob() useful here.
On Mon, Jan 24, 2011 at 9:14 PM, Ignacio Vazquez-Abrams < ivazqueznet@gmail.com> wrote:
On Mon, 2011-01-24 at 21:02 -0500, Erik Blankinship wrote:
Unfortunately, there does not appear to be a way to include *.png for all subdirectories in gfx.
You might find os.walk() or glob.glob() useful here.
Thank you for introducing me to glob. Problem solved. That's a great function!
Erik Blankinship wrote:
Unfortunately, none of the gfx are transfered over. However, if I modify my setup.py as follows:
from setuptools import find_packages pkgs = find_packages( ) setup( name='SunnyApp', ... data_files=[ ('SunnyApp/gfx', ['gfx/sun_1.png', 'gfx/sun_2.png'] ), ('SunnyApp/gfx/core', ['gfx/core/core_1.png', 'gfx/core/core_2.png'] ) ], ... packages=pkgs, .... )
Only those files that I list make it into the rpm (in this case sun_1.png, sun_2.png, core_1.png, core_2.png) Unfortunately, there does not appear to be a way to include *.png for all subdirectories in gfx.
Is there a way to include lots of files with a pattern when calling rpmbuild? I am not sure how to use package_data to list wildcards because of how I am using packages=find_packages( )
Any suggestions? Thanks much.
Since it's setuptools-based project use include_package_data=True. This is documented at http://peak.telecommunity.com/DevCenter/setuptools#including-data-files
Is there a way to include lots of files with a pattern when calling rpmbuild? I am not sure how to use package_data to list wildcards because of how I am using packages=find_packages( )
Any suggestions? Thanks much.
Since it's setuptools-based project use include_package_data=True. This is documented at http://peak.telecommunity.com/DevCenter/setuptools#including-data-files
Unfortunately, I cannot get this approach to work. I tried both just include_package_data = True and specifics with package_data=<lots of specifics>
All of the gfx files are included in the manifest, and all of the files are under subversion control.
maybe: I am using the wrong version of something (e.g. python or setuptools)? I need to include a __init__.py in my gfx/ directories so they look like packages?
python-devel@lists.fedoraproject.org