From c54433437fc3e74878169b562dcd4e811f2858ba Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Sat, 4 Mar 2017 19:26:12 -0500 Subject: [PATCH] Convert README.md to rst in setup.py Enable formatted descriptions for future PyPI releases. --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 93de7602..aa445007 100755 --- a/setup.py +++ b/setup.py @@ -2,19 +2,27 @@ from setuptools import setup, find_packages import os +import subprocess from bitcoin import __version__ here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.md')) as f: - README = f.read() +readme_path = os.path.join(here, 'README.md') +try: + args = 'pandoc', '--from', 'markdown', '--to', 'rst', readme_path + readme = subprocess.check_output(args).decode() +except Exception as error: + print('README.md conversion to reStructuredText failed. Error:') + print(error) + with open(readme_path) as read_file: + readme = read_file.read() requires = [] setup(name='python-bitcoinlib', version=__version__, description='The Swiss Army Knife of the Bitcoin protocol.', - long_description=README, + long_description=readme, classifiers=[ "Programming Language :: Python", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",