[Distutils] setuptools and data files

Phillip J. Eby pje at telecommunity.com
Sun Oct 1 23:01:30 CEST 2006

At 09:43 PM 9/30/2006 +0200, Walter Dörwald wrote:
>Hello Philip!
>I'm having trouble with using setuptools with data files. The layout of
>my directory is this:
>MANIFEST.in contains the line:
>include src/coverage.css

Setuptools only includes data files that are inside a *package* (which is 
why it's called "package_data"), or inside the .egg-info directory 
(metadata files), as that's the only way to ensure the files are accessible 
in all possible installation configurations (egg zips, egg dirs, and 
"traditional" installs).

>My arguments to setup() look like this:
>   args = dict(
>      name="pycoco",
>      version="0.1",
>      description="Python code coverage",
>      long_description="...",
>      author=u"Walter Doerwald",
>      author_email="walter at livinglogic.de",
>      url="...",
>      download_url="...",
>      license="Python",
>      classifiers="...",
>      keywords="...",
>      package_dir={"": "src"},
>      py_modules=["pycoco"],
>      package_data={
>         "": ["*.css"],
>      }
>   )

For this configuration, I would suggest that you move the .css file to the 
package's .egg-info directory, and use this expression at runtime to 
retrieve the contents:

     data = 

>However when I do an "easy_install -Z ." I get the following directory
>with no coverage.css in sight. I'm using a ~/.pydistutils.cfg, which
>install_lib = ~/pythonroot
>I've also tried including the include_package_data=True argument, moved
>the CSS file out of the src directory, changes the include statement in
>MANIFEST.in to "include coverage.css" and various combination thereof
>always with the same result. I'm using setuptools 0.6c3.
>Am I doing something stupid?
>BTW, I've moved most of our Python packages to setuptools, and so far it
>really simplifies packages handling. The only remaining problem is
>setuptools+pyexe. So thanks for all your work on setuptools.
>    Walter

More information about the Distutils-SIG mailing list