From e4629ba985ca3312643eb7921e0505585b4e94e3 Mon Sep 17 00:00:00 2001 From: Andrew Velis Date: Tue, 12 Jul 2016 15:23:50 -0500 Subject: [PATCH] Adds the ability to convert README file for Pypi We can potentially use pypandoc to conditionally try to convert the current reaadme markdown into restructured text. If not will simply send over the markdown as is to Pypi. --- setup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 08186479..8c3fa624 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,16 @@ import os from setuptools import setup -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme_file: - README = readme_file.read() +try: + from pypandoc import convert + + def read_md(f): return convert(f, 'rst') +except ImportError: + print("warning: pypandoc module not found, could not convert Markdown to RST") + + def read_md(f): return open(f, 'r').read() + +README = read_md('README.md') # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))