[Distutils] Having trouble with 'exclude'

Rene Liebscher R.Liebscher@gmx.de
Wed Sep 12 08:06:10 2001


Andy Todd wrote:
> 
> I am having a few problems with creating a source distribution and would
> appreciate any help or pointers.
> 
> The situation, I have the world's simplest package, in the directory are
> five files;
> 
> """
> MANIFEST.in
> setup.py
> wibble.py
> wibble.user.py
> """
> 
> The only line in MANIFEST.in is;
> "exclude wibble.user.py"
> 
> because for my own reasons I do not want that file even in my source
> distribution.
> 
> When I run "python setup.py sdist" I get the following output;
> """
> running sdist
> reading manifest template 'MANIFEST.in'
> warning: no previously-included files found matching 'wibble.user.py'
> writing manifest file 'MANIFEST'
> creating Wibble-1.0
> making hard links in Wibble-1.0...
> hard linking README.txt -> Wibble-1.0
> hard linking setup.py -> Wibble-1.0
> hard linking ./wibble.py -> Wibble-1.0/.
> hard linking ./wibble.user.py -> Wibble-1.0/.
> tar -cf dist/Wibble-1.0.tar Wibble-1.0
> gzip -f9 dist/Wibble-1.0.tar
> removing 'Wibble-1.0' (and everything under it)
> """
> 
> Any suggestions?
> 
> If it is any help my setup.py file is basically;
> 
> """
> #!/usr/bin/env python
> APPLICATION_NAME = "Wibble"
> from distutils.core import setup
> import glob, os, sys
> 
> setup(name=APPLICATION_NAME,
>        version=1.0,
>        description="My application",
>        author="me",
>        author_email="my.email",
>        url="http://my.url",
>        packages=[APPLICATION_NAME],
>        package_dir={APPLICATION_NAME: '.'},
>        scripts=[],
>        licence="Python",
>        data_files=[]
>       )
> """
> 
> Whilst I'm here, is there any definitive documentation on the arguments
> and their valid values that can be passed to 'setup'? The shipped
> documentation seems to be a bit all over the place.
> 
> Thanks in advance,
> Andy

You specify the package dir as '.'. Then the file wibble.user.py
is listed as './wibble.user.py' and is not matched as 
'^wibble\.user\.py$' (regular expression.)
(You can see this by setting the environment variable
DISTUTILS_DEBUG=1 before you run your setup.py.)

If you use 
exclude ./wibble.user.py 
it should work as you want.


Kind regards
Rene Liebscher