Skip to content

Commit 6dd5552

Browse files
author
Michał Jaworski
committed
docs/release: add optional translation from markdown to rst of long description using pypandoc
1 parent 2cca1b3 commit 6dd5552

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

setup.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ def get_version(version_tuple):
4242

4343
INSTALL_REQUIRES = reqs('requirements.txt')
4444

45-
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
45+
try:
46+
from pypandoc import convert
47+
read_md = lambda f: convert(f, 'rst')
48+
except ImportError:
49+
print(
50+
"warning: pypandoc module not found, could not convert Markdown to RST"
51+
)
52+
read_md = lambda f: open(f, 'r').read()
53+
54+
README = os.path.join(os.path.dirname(__file__), 'README.md')
4655
PACKAGES = find_packages('src')
4756
PACKAGE_DIR = {'': 'src'}
4857

@@ -52,7 +61,7 @@ def get_version(version_tuple):
5261
author='Clearcode - The A Room',
5362
author_email='thearoom@clearcode.cc',
5463
description='Doorkeeper for consul discovered services.',
55-
long_description=README,
64+
long_description=read_md(README),
5665

5766
packages=PACKAGES,
5867
package_dir=PACKAGE_DIR,

0 commit comments

Comments
 (0)