recursive package_data (setuptools?)
I have a nested directory with templates, like templates/foo.pt templates/admin/bar.pt I thought I could include them in a package with: setup(... package_data={ 'mypackage': ['templates/*']}) But it doesn't work -- while the package is fine, when installed setuptools (maybe just inheriting distutils here) tries to copy templates/admin over, and it can't copy a directory. And, I assume, it won't even try templates/admin/bar.pt. So... is there a way to do this, without enumerating (a) every subdirectory I'm interested in, and (b) every extension I'm intersted in? -- Ian Bicking / ianb@colorstudy.com / http://blog.ianbicking.org
I've had success with something like this: package_data = { '' : ["*.pt"]} Of course, if you have page templates in directories other than "templates", you'll end up snagging those, too. Kevin On 9/15/05, Ian Bicking <ianb@colorstudy.com> wrote:
I have a nested directory with templates, like
templates/foo.pt templates/admin/bar.pt
I thought I could include them in a package with:
setup(... package_data={ 'mypackage': ['templates/*']})
But it doesn't work -- while the package is fine, when installed setuptools (maybe just inheriting distutils here) tries to copy templates/admin over, and it can't copy a directory. And, I assume, it won't even try templates/admin/bar.pt.
So... is there a way to do this, without enumerating (a) every subdirectory I'm interested in, and (b) every extension I'm intersted in?
-- Ian Bicking / ianb@colorstudy.com / http://blog.ianbicking.org _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig
At 05:55 PM 9/15/2005 -0500, Ian Bicking wrote:
I have a nested directory with templates, like
templates/foo.pt templates/admin/bar.pt
I thought I could include them in a package with:
setup(... package_data={ 'mypackage': ['templates/*']})
But it doesn't work -- while the package is fine, when installed setuptools (maybe just inheriting distutils here) tries to copy templates/admin over, and it can't copy a directory. And, I assume, it won't even try templates/admin/bar.pt.
So... is there a way to do this, without enumerating (a) every subdirectory I'm interested in, and (b) every extension I'm intersted in?
Write a function to do it for you? :) Seriously, it might not be a bad idea to add a 'find_package_data()' function along the lines of the sdist command's "include everything that's under source control" algorithm. Then you could just do: package_data = find_package_data() and be done with it. We could perhaps have it use the actual sdist command's file finding code, so that MANIFEST.in is respected if you're not using source control. It would need to filter out .py files and files that are not inside packages, and create a package_data mapping based on the nearest containing package.
participants (3)
-
Ian Bicking
-
Kevin Dangoor
-
Phillip J. Eby