[Distutils] Newbie questions about setuptools

Phillip J. Eby pje at telecommunity.com
Wed Jun 20 20:10:49 CEST 2007

At 09:43 AM 6/20/2007 -0500, Edward Ream wrote:
>>>http://sourceforge.net/project/showfiles.php?group_id=3458 leo
>>...you can use the above URL as your "Download URL"
>Success, or close to it.  Here is the present status.
>1.  setup.py register works.
>2. setup.py sdist upload --show-response fails as follows:
>[big snip: creating files]
>removing 'leo-4.4.3preview10' (and everything under it)
>running upload
>Submitting dist\leo-4.4.3preview10.zip to http://www.python.org/pypi
>Upload failed (400): Bad Request
>Error processing form
>invalid distribution file
>Not a big deal.  Any idea what might be happening?  (see the P.S. 
>for the call to setup.py)

No.  I'd suggest following up with the Catalog-SIG or the PyPI support tracker.

>3. After uploading 'leo-4.4.3preview10.zip to SourceForge,
>easy_install leo -v works (I think), but I was surprised that 
>easy_install builds an egg:
>[big snip: copying, compiling and building the egg]
>Installed c:\python25\lib\site-packages\leo-4.4.3preview10-py2.5.egg
>Processing dependencies for leo
>Finished processing dependencies for leo
>I'm also a surprised that this new egg did not become the default 
>version of Leo.

It did; your setup() is broken.  See below.

>setuptools.setup (
>    name='leo',
>    version='4.4.3preview10', # No spaces!
>        # pre-release tags: 4.4.3b1 or 4.4.3rc1 or 4.4.3preview1
>        # Do not use post-release-tags: 4.4.3-whatever.
>        # final release: 4.4.3final or just 4.4.3.
>    author='Edward K. Ream',
>    author_email='edreamleo at charter.net',
>    url='http://webpages.charter.net/edreamleo/front.html',
>    download_url='http://sourceforge.net/project/showfiles.php?group_id=3458',
>        #'http://downloads.sourceforge.net/leo/leo-4.4.3preview9.egg',
>    # py_modules=[], # The manifest specifies everything.

Sorry, you can't not list the modules and still install correctly or 
build correct binary distributions.  py_modules isn't 
optional.  That's as true for setuptools as it is for 
distutils.  However, it's not clear to me whether you're intending to 
distribute a bunch of modules under 'src', or a package called 'leo'...

Your sitecustomize implies that you have a bunch of modules under 
'src' -- in which case you should list them in py_modules, and 
include a "package_dir={'': 'src'}" along with a bunch of other 
tricky-to-get-right things.

However, the next line of your setup() implies that you intend to 
install some packages instead...

>    packages = setuptools.find_packages(),

This line will find a bunch of packages named "plugins", "scripts", 
"src", "modes", "Icons", "config", "dist", "doc", "test", "www", 
"extensions", "extensions.Pmw", etc.

This looks completely hosed, because I assume these should all be 
subpackages of "leo", not top-level packages.  And you probably don't 
want a package called "src"!

So, your layout and setup are quite hosed, regardless of whether 
you're using distutils or setuptools.  What is it that you intend to 
distribute?  Is it one package called 'leo' with a bunch of 
subpackages?  Or what?  Is everything in there really a 
package?  (e.g. why is 'doc' a package?)

>    exclude_package_data = { '': ['*.pyc','*.pyo']},

This line is unnecessary; setuptools doesn't consider those files to 
be package data anyway, and it won't stop them from being put into 
any eggs built by easy_install.

More information about the Distutils-SIG mailing list