"Out of source" bdist_egg, missing metadata

Hi, sorry if this email arrives twice. Now I'm registered to this list, so I can check that the email is delivered. :)
I've a question on setuptools egg creation. I've a directory structure like this:
python_libs/ |---- setup_foo | |---- setup.py |---- src | |---- foo | | |---- __init__.py | | |---- foo_module.py | |---- bar | | |---- __init__.py | | |---- bar_module.py | |---- common | | |---- __init__.py | | |---- common_module.py
Basically I have a src directory containing three packages (foo, bar and common), and I have a setup_foo directory OUTSIDE src, where I want to build an egg containing foo and common packages, and NOT bar package.
In the setup_foo/setup.py script I have something like this:
# -*- coding: utf-8 -*- from setuptools import setup, find_packages
src_dir = "../src"
setup(name='foo', version='0.1', description="foo and common packages", packages=find_packages(src_dir, exclude=['bar', 'bar.*']), package_dir={'': src_dir}, zip_safe=False, install_requires=[ 'PasteDeploy', ], entry_points=""" [paste.app_factory] foo_app = foo.foo_module:app_factory common_app = common.common_module:app_factory """, )
You can see that I have two entry points (in this case for use with PasteDeploy in a wsgi project).
If I build an egg with that file:
$ cd setup_foo/ $ python setup.py bdist_egg
I can find a foo.egg-info directory under src which contains all metadata:
$ ls src/foo.egg-info/ dependency_links.txt entry_points.txt not-zip-safe PKG-INFO requires.txt SOURCES.txt top_level.txt
But in the egg created under setup_foo/dist I don't have those metadata:
$ cd setup_foo/dist/ $ unzip foo-0.1-py2.6.egg $ ls EGG-INFO/ not-zip-safe SOURCES.txt
And of course, after installing that egg with easy_install, PasteDeploy can't find the entry points.
Is this a setuptools bug or I'm doing something wrong? I use setuptools 0.6.10 distributed in Ubuntu Lucid.
Thank you in advance for your help, and excuse me for the lenghty email!

On Thu, May 27, 2010 at 8:08 PM, Augusto Destrero destrero@imavis.com wrote:
Hi, sorry if this email arrives twice. Now I'm registered to this list, so I can check that the email is delivered. :)
I've a question on setuptools egg creation. I've a directory structure like this:
python_libs/ |---- setup_foo | |---- setup.py |---- src | |---- foo | | |---- __init__.py | | |---- foo_module.py | |---- bar | | |---- __init__.py | | |---- bar_module.py | |---- common | | |---- __init__.py | | |---- common_module.py
I guess you have a reason to do so, but I would strongly advice against doing what you are doing. Distutils has no notion of src directory, and you will hit all kind of corner cases.
Basically I have a src directory containing three packages (foo, bar and common), and I have a setup_foo directory OUTSIDE src, where I want to build an egg containing foo and common packages, and NOT bar package.
Split the packages, then, that's by far the best solution. Handle the aggregation at a higher level using one of the existing tool (either python tool, or system packaging tool depending on your preference).
David

Thank you for your suggestion. I solved changing my structure a little bit:
python_libs/ |---- src | |---- setup_foo.py | |---- foo | | |---- __init__.py | | |---- foo_module.py | |---- bar | | |---- __init__.py | | |---- bar_module.py | |---- common | | |---- __init__.py | | |---- common_module.py
And changed setup_foo.py like this:
setup(name='foo', version='0.1', description="foo and common packages", packages=find_packages(exclude=['bar', 'bar.*']), zip_safe=False, ...
Now everything works as expected. Maybe as you said an "out of source" build is not well supported.
Split the packages, then, that's by far the best solution. Handle the aggregation at a higher level using one of the existing tool (either python tool, or system packaging tool depending on your preference).
That's of course a good idea, but for now my project is made up of just three packages and I find this solution quite handy.
Thanks again!
participants (2)
-
Augusto Destrero
-
David Cournapeau