Skip to content

Commit

Permalink
Use pandoc to convert README.md to rst for setuptools.long_description
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoseph committed Oct 17, 2013
1 parent 192232b commit a4e4b15
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@


from .cli import main # noqa
from .pandoc import md2rst
11 changes: 11 additions & 0 deletions changes/pandoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pypandoc
#

def md2rst(markdown):
return pypandoc.convert(
markdown.decode('utf-8'),
'rst',
format='md'
)


3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import re
from setuptools import setup

import changes

init_py = open('changes/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
Expand All @@ -9,6 +11,7 @@
name='changes',
version=metadata['version'],
description=metadata['doc'],
long_description=changes.md2rst('README.md'),
author=metadata['author'],
author_email=metadata['email'],
url=metadata['url'],
Expand Down

0 comments on commit a4e4b15

Please sign in to comment.