Created
February 24, 2014 08:48
-
-
Save aubricus/9184003 to your computer and use it in GitHub Desktop.
Use pandoc to convert README.md into .rst for Pypi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long_description = '' | |
try: | |
import subprocess | |
import pandoc | |
process = subprocess.Popen( | |
['which pandoc'], | |
shell=True, | |
stdout=subprocess.PIPE, | |
universal_newlines=True | |
) | |
pandoc_path = process.communicate()[0] | |
pandoc_path = pandoc_path.strip('\n') | |
pandoc.core.PANDOC_PATH = pandoc_path | |
doc = pandoc.Document() | |
doc.markdown = open('README.md').read() | |
long_description = doc.rst | |
except: | |
pass | |
# other params omitted for berevity | |
setup( | |
long_description=long_description | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what I ended up doing, since I know where pandoc is installed on my build system: