You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally reported by: Jason Madden (Bitbucket: jamadden, GitHub: jamadden)
Long Description
There was a bug report against twine where a user complained that the description for an uploaded project was rendered incorrectly when the wheel was uploaded, but rendered correctly when only the sdist was uploaded.
Tracking this down, it turns out that creating the METADATA in the wheel mangles the description un-renderable if a line just so happens to start with "From" and be a header.
wheel uses email.generator to write the METADATA file. By default, email.generator will write files compatible with Unix mbox format, which means that lines that begin with "From" are mangled to be ">From" (to indicate that they do not begin a new message in the multi-message mbox format). (sdists don't have this problem because the description is in a "header" and headers aren't mangled.)
The METADATA file can only ever be one message, so this is not a concern. (Even if it was, the pkginfo library uses email.parser to read the METADATA files, which doesn't support this convention.)
Example
Mangling "From" to ">From" causes rendering issues when the line happens to be a header.
Take this perfectly correct RST document:
======
Head
======
Body 1
From Place
----------
A place
Mangle the from line:
======
Head
======
Body 1
>From Place
----------
A place
Increasing the length of the line makes the underline too short and rendering fails with "Bad.rst:17: (WARNING/2) Title underline too short." (This was verified using rstview which uses readme-renderer.)
Proposed Fix
The simple fix is to pass mangle_from_=False to the email.generator.Generator object used to write the file (in wheel.pkginfo.write_pkg_info, I think). This eliminates the mangling. This parameter is available all the way back to 2.6.
Originally reported by: Jason Madden (Bitbucket: jamadden, GitHub: jamadden)
Long Description
There was a bug report against twine where a user complained that the description for an uploaded project was rendered incorrectly when the wheel was uploaded, but rendered correctly when only the sdist was uploaded.
Tracking this down, it turns out that creating the METADATA in the wheel mangles the description un-renderable if a line just so happens to start with "From" and be a header.
wheel uses
email.generator
to write the METADATA file. By default,email.generator
will write files compatible with Unix mbox format, which means that lines that begin with "From" are mangled to be ">From" (to indicate that they do not begin a new message in the multi-message mbox format). (sdists don't have this problem because the description is in a "header" and headers aren't mangled.)The METADATA file can only ever be one message, so this is not a concern. (Even if it was, the pkginfo library uses
email.parser
to read the METADATA files, which doesn't support this convention.)Example
Mangling "From" to ">From" causes rendering issues when the line happens to be a header.
Take this perfectly correct RST document:
Mangle the from line:
Increasing the length of the line makes the underline too short and rendering fails with "Bad.rst:17: (WARNING/2) Title underline too short." (This was verified using
rstview
which usesreadme-renderer
.)Proposed Fix
The simple fix is to pass
mangle_from_=False
to theemail.generator.Generator
object used to write the file (in wheel.pkginfo.write_pkg_info, I think). This eliminates the mangling. This parameter is available all the way back to 2.6.The text was updated successfully, but these errors were encountered: