[Distutils] Packaging of files, which aren't in the package root folder

Lukas Hetzenecker LuHe at gmx.at
Mon Dec 14 16:49:42 CET 2009

Am Montag 14 Dezember 2009 15:44:54 schrieben Sie:
> What I meant was to copy your files in the package directory when you
> create your distribution,
> *before* "python setup.py sdist" is called, so the classical install
> mechanisms will work.
> e.g.=
> relase.sh:
>     cp file pc/file
>     python setup.py sdist
>     rm pc/file
> Meaning that in your development layout, they would stay out of "pc",
> but get in there when you create the archive.

The layout for the release tarball should be like my development layout, only 
the installation layout should be different.

This means: The user downloads a tarball which has the package for his pc (in 
the pc/ directory), a package for his mobile phone (in the mobile/ directory) 
and the LICENCE, README files (in the root directory).
Now he wants to install the pc package. Only now the modules of the pc/ 
directory are mixed with the README files and copied to the site-packages 

So he has the README files in the root directory of his tarball _and_ in the 
package (site-packages/series60_remote) directory when he installed the 
> What you have done will not work as-is because setup.py can be called
> for doing something else than 'sdist', so you need to run the code
> only if 'sdist' is called.

Well, this "mixing" should _not_ happen when sdist is called.

> But fixing this can make your setup.py code more fragile, thats why I
> was thinking of a higher level
> script.
> Last, if you really dislike the idea of seeing these file shipped in
> the distribution archive within a package, (pc), David's proposal is
> the less hackish:
> Create your own distutils command with your custom behavior for
> copying files in the target system
> at install time. overriding install_data.run would be the simplest way
> in that case.
> see:
>  http://docs.python.org/distutils/extending.html#integrating-new-commands
> Tarek

More information about the Distutils-SIG mailing list