[Distutils] RFC822, PKG-INFO and the Description field

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Sun Dec 6 17:37:38 CET 2009


On Sat, 2009-12-05 at 03:49 +0100, Tarek Ziadé wrote:
> Hi,
> 
> I am currently fixing a bug in Distutils: http://bugs.python.org/issue1923
> 
> this bugs makes a Description field like:
> 
> """
> Text::
>        a literal python block::
>        >>> import this
> """
> 
> Transformed into :
> 
> """
> Text::
> a literal python block::
> >>> import this
> """
> 
> Which is fine for RFC822 compliancy but sucks for reST if someone
> wants to parse it back.
> 
> There's another problem: empty lines.
> 
> For instance:
> 
> """
> Description: Text::
> 
>        a literal python block::
> 
>            >>> import this
> """
> 
> Will not be parseable with rfc822 because the first empty line ends the header.
> 
> IOW we need to encode that multi-line field differently.
> 
> I want to take the chance that we are changing PEP 345, to introduce a
> smarter marker
> in 1.2, that will add a character (:) after the 8 spaces to avoid
> losing empty lines:
> 
> """
> Description: Text::
>        :
>        :a literal python block::
>        :
>        :    >>> import this
> """
> 
> So we are able to unparse it.
> 
> Thoughts ?

How about turning that file into a real mime message instead of just a
set of pseudo mime headers with some pseudo encodings for multiline
stuff.

That way the long description could be the body of that message,
no more messy recoding needed.

As far as i can tell, all the other optional fields are designed to fit
single lines anyway.

IMHO its a perfect match.

If the idea is liked, i'd take 3-4 Hours to write a new
DistributionMetadata class that handles the new format as well as
backward compatibility (i suppose a new version number is needed anyway
for some of the other additions)


Regards Ronny



More information about the Distutils-SIG mailing list