Skip to content

Commit

Permalink
Merge pull request #421 from di/fix/420
Browse files Browse the repository at this point in the history
Remove unnecessary usage of readme_renderer.markdown
  • Loading branch information
sigmavirus24 authored Oct 29, 2018
2 parents bd1d8b0 + ee131f3 commit 79b1c2f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions twine/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@
except ImportError:
from _io import StringIO

import readme_renderer.markdown
import readme_renderer.rst
import readme_renderer.txt

from twine.commands import _find_dists
from twine.package import PackageFile

_RENDERERS = {
None: readme_renderer.rst, # Default if description_content_type is None
"text/plain": readme_renderer.txt,
"text/plain": None, # Rendering cannot fail
"text/x-rst": readme_renderer.rst,
"text/markdown": readme_renderer.markdown,
"text/markdown": None, # Rendering cannot fail
}


Expand Down Expand Up @@ -101,7 +99,11 @@ def check(dists, output_stream=sys.stdout):
output_stream.write('warning: `long_description` missing.\n')
output_stream.write("Passed\n")
else:
if renderer.render(description, stream=stream, **params) is None:
if (
renderer
and renderer.render(description, stream=stream, **params)
is None
):
failure = True
output_stream.write("Failed\n")
output_stream.write(
Expand Down

0 comments on commit 79b1c2f

Please sign in to comment.