[Distutils] Mystery solved

Phillip J. Eby pje at telecommunity.com
Mon Jul 10 23:50:17 CEST 2006

At 08:38 AM 6/24/2006 -0400, Jim Fulton wrote:
>Suppose you have some distributions of interest in a directory
>somewhere. You ask easy_install to update your packages.  You use
>find-links to tell it to look in the directory of distributions.  By
>default, it looks for  an index at http://www.python.org/pypi.
>Further assume that the distribution you are updating is not in
>PyPI.  You'll get the following messages:
>   Couldn't find index page for 'jimtest' (maybe misspelled?)
>   Scanning index of all packages (this may take a while)
>And easy install will have made 2 connections, to:
>  http://www.python.org/pypi/jimtest/, and to  http://www.python.org/ pypi/.
>You should be able to easily reproduce this.
>Now, suppose, instead, you provide an index (-i) option telling
>easy_install to look somewhere else?  Say, http://www.python.org. You
>don't get the messages and only a single connection is made.Why?
>What's the difference you ask?  Well, PyPI (and my test server)
>returns a content type of text/plain for 404 results, while most web
>servers return text/html.  I changed my test server to return HTML
>Non-Found results, and the messages went away and I only get a single

Ah, the irony.  Your change, and the recent change of PyPI to do the same 
thing, are actually forcing *erroneous* behavior now, by suppressing the 
fallback search.  :)

>So what is the correct behavior?  I dunno.  The warnings are rather
>annoying, so I'm glad I've found out how to make them go away.

They'll come back when I release 0.6b4, since it's setuptools' behavior 
that's broken here.  If a response was text/plain, it was doing the right 
thing, but it wasn't checking text/html responses to see if they were 404 

>However, I'm pretty sure your intent was to search both / project_name/ 
>and /.  When a server returns an HTML not-found error,
>easy_install skips the / check.
>I think there are 2 bugs here:
>1. The scan of the all-package index is skipped if the content-type
>of the
>      if the /project_name/ request is HTML.

Yep, that's a bug, and I'm fixing it now.

>2. The messages:
>        Couldn't find index page for 'jimtest' (maybe misspelled?)
>        Scanning index of all packages (this may take a while)
>     should be info messages, not warning messages.  If they
>     remain warnings, and you fix the first problem, it will be
>     impossible to avoid the warnings without creating a PyPI
>     project or creating an index server, and I don't think it was
>     your intent to require either of these.  I don't think a warning
>     should be issues for correct use of software.

Here's the problem.  Reducing everything to info messages means there's 
effectively no control over output detail.  I generally use 'warn()' for 
things that *may* reflect an error in input parameters.  So, my take on the 
above is that although the "Scanning" message could become an info(), the 
previous one shouldn't.

More information about the Distutils-SIG mailing list