Skip to content

Commit ec78a86

Browse files
committed
Adds a simple fix (originally from https://github.com/dhimmel/hetio) for converting README.md to README.rst for PyPi
1 parent 832d2dd commit ec78a86

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,4 @@ ENV/
102102

103103
*.dll
104104

105+
README.rst

setup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
from setuptools import setup
22
import re, sys, shutil, os
3+
import subprocess
4+
5+
# Convert README.md to RST for PyPi -- copied from (CC0) https://github.com/dhimmel/hetio
6+
# Thank you, Daniel Himmelstein (dhimmel)!
7+
8+
# Try to create an rst long_description from README.md
9+
try:
10+
args = 'pandoc', '--to', 'rst', 'README.md'
11+
long_description = subprocess.check_output(args)
12+
long_description = long_description.decode()
13+
except Exception as error:
14+
print('README.md conversion to reStructuredText failed. Error:')
15+
print(error)
16+
print('Setting long_description to None.')
17+
long_description = None
18+
19+
320

421
with open('dss/__init__.py', 'r') as f:
522
match = re.search("__version__ = '(.*?)'", f.read())
@@ -46,6 +63,7 @@
4663
ext_package="dss",
4764
install_requires=["cffi>=1.11.2", "numpy>=1.0"],
4865
zip_safe=False,
66+
long_description=long_description,
4967
classifiers=[
5068
'Intended Audience :: Science/Research',
5169
'Intended Audience :: Education',

0 commit comments

Comments
 (0)