[Python-Dev] New PyPI broken package editing

Walter Dörwald walter at livinglogic.de
Wed Mar 30 13:43:50 CEST 2005

Martin v. Löwis wrote:
> Walter Dörwald wrote:
>> So can I have one setup.py for both Python 2.4 and Python 2.5 that 
>> does the correct thing when creating a Windows installer for
>> Python 2.4 (I've used Unicode strings for that until now) and using 
>> the upload command with Python CVS (which seems to require a
>> byte string now)? I'd like to avoid having to use version checks in 
>> setup.py.
> Well, the upload command doesn't look at the metadata. It is the
> register command which does,


> and it indeed requires utf-8 at the
> moment. This can be fixed, of course,

The register command in 2.4 (and current CVS) simply does a
    value = str(value)
in post_to_server() so the encoded bytes sent depend on the
default encoding. Would it be sufficient to change this to
    value = unicode(value).encode("utf-8")

Another solution might be to include the encoding in the Content-type 
header of the request. IMHO the best solution would be to do both:
Always use UTF-8 as the encoding and include this in the Content-type
header in the request. PyPI should honor this encoding when it finds
it and should fall back to whatever it used before if it doesn't.

> but not for already-released
> versions.

True, but I can live with that as long as I can use the same setup.py 
for bdist_windist and register under Python 2.4 and upload under
Python CVS.

    Walter Dörwald

More information about the Python-Dev mailing list