[Distutils] Finding dependencies and Limiting download

Phillip J. Eby pje at telecommunity.com
Thu Mar 16 21:46:47 CET 2006

At 12:24 PM 3/16/2006 +0200, Juha Tuomala wrote:
>On Wednesday 15 March 2006 21:33, Phillip J. Eby wrote:
> > Well, you can work around this, but it's a pain because it makes it
> > impossible for you to use setup.py develop.  What you do is delete the
> > __init__.py from all the packages, except for a special extra project that
> > includes only the __init__.py.  Then you make all the packages depend on
> > that one.  (And each package with a missing __init__ needs to have the
> > package name explicitly listed in setup(), since find_packages() won't see
> > it's there otherwise.)
>Where those __init__.py files should be deleted? From SVN snapshot
>taken from Script? Or from installed target chroot during RPM packaging?

Either the source tree you're building from, or the installed chroot.

> > At that point, setuptools will add automatically-created __init__.py files
> > into any eggs it makes, but it will not include them in
> > --single-version-externally-managed installs.
>Currently I'm doing
>   %{__python} setup.py install --root $RPM_BUILD_ROOT
>- --single-version-externally-managed
>And it installs below:
>   /usr/lib/python2.3/site-packages/paste/script
>which is logcical but also below:
>   /usr/lib/python2.3/site-packages/PasteScript-0.5.1dev-py2.3.egg-info/
>so that must be the egg-info you talked about.

Yes.  Again, please note that "setup.py bdist_rpm" can do a lot of this for 
you without you needing to do it manually.

> > The downside, however, is that it makes "setup.py develop" useless for the
> > original source packages.
>I don't even know what that 'develop' does, recall reading the docs that it
>helps with syncing the svn snapshot or something.

Yeah, I wouldn't worry about it, given what you're trying to do.  I was 
just pointing out why Ian can't just remove the __init__.py files from the 
original source code; it would interfere with him working on the package 

>So, all what I would like to do is do
>   make install
>and say
>   paster serve <plaa> <plaa>
>and if that would work, it would be great. Somehow I'm stuck with this
>setuptools/egg stuff what looks that it's making things complicated.
>Doing it manually is not an option as everything is installed with RPM
>what allows strict management.

Actually, it's the way in which you're building the RPMs that's making 
things complicated here.  If you just did this:

     export PYTHONPATH=/some/project/dir
     easy_install -d /some/project/dir Paste PasteDeploy PasteScript

You'd get everything neatly installed in /some/project/dir with nothing 
installed anywhere else, and no need for an RPM.  (It would also install a 
copy of Cheetah with the missing egg-info.)

But if you really *must* have an RPM, you can just make an RPM of the 
resulting directory, as long as you don't mind it always being installed to 
/some/project/dir.  (Because the created files will contain some absolute 

Anyway, you could do something like "/usr/local/paste" as the target 
directory, and just put in whatever you need to either symlink the 
executables from there to a bin directory.  If you don't want to have to 
set PYTHONPATH at runtime, you can use the "administrator install" setup 
instructions for easy_install to make /usr/local/paste an automatic "site" 
directory when Python starts.

All this having been said, I think there *is* a reasonable way to work 
around the __init__.py issue for packaging tools like RPM, but what I've 
just given you should work now, so that you don't have to wait for any new 
features to come out in setuptools.

More information about the Distutils-SIG mailing list