[Distutils] custom egg metadata

Phillip J. Eby pje at telecommunity.com
Tue Jan 9 16:57:27 CET 2007

At 12:34 PM 1/9/2007 +0100, Lutz Pälike wrote:
> > Your custom writer has to be on sys.path in order to work, but your
> > package_dir isn't on sys.path.
>Well this is the case, since i want to use a general setuptools writer and 
>need no fancy custom writer (yet).
> > You'll have to either install the writer as a separate egg and use
> > setup_requires to ensure it gets on the path, or else move your
> > package_dir to the setup.py directory.
>Ok. But the writer just needs to be importable right?

It needs to be an *egg* on sys.path, meaning that both the source and the 
.egg-info are there.

>  there is no real need to have the package_dir directly alongside the 
> setup.py ?
>I have only a single setup.py, but lots of subprojects that i want to keep 
>in subfolders. And there are no setup.py in the project subfolders
>but everything is controlled through the single setup.py and a config file 
>within each project.

That's not really a supported arrangement; note that you won't be able to 
make proper source distributions, for example.  (Source distributions must 
contain a setup.py to be installable.)

>I tried to set pkg_resources.working_set , but it does not seem to have 
>the necessary impact for the bdist_egg command.
>I guess  the working_set instance is imported at an earlier stage into 
>setuptools and thus does'nt get updated.

Correct.  Also, your package_dir would have to be on sys.path.

>I think the main problems i got is because i want to use setuptools from 
>an api perspective and not from a tool perspective.
>Finally i want to integrate the setup script into a gui and make the 
>building accessible to non-developers (this is a necessity).
>And because i want to catch exceptions and all that i don't like to use 
>something like os.system() to launch different steps of
>the build.
>Maybe you can give me some more hints why this fails.

To be blunt, the distutils doesn't really support what you're trying to 
do.  And setuptools inherits certain of its limitations, like the fact that 
it is built to assume that there is a setup.py in the current directory and 
the current directory is the root of a project.

>At present i invoke the egg_info and the bdist_egg build step by setting 
>the 'script_args' parameter for each step and call
>setup(). As already mentioned this fails.

You would need to run egg_info, put the package_dir on sys.path, require() 
the new distribution, then run egg_info a second time (or bdist_egg, which 
calls egg_info).

More information about the Distutils-SIG mailing list